Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf52840: crash running heartrate example #310

Open
deadprogram opened this issue Dec 12, 2024 · 1 comment
Open

nrf52840: crash running heartrate example #310

deadprogram opened this issue Dec 12, 2024 · 1 comment

Comments

@deadprogram
Copy link
Member

I tried to run the heartrate example with the latest dev branch of both this package and TinyGo, only to discover that it crashes:

$ tinygo flash -size short -target itsybitsy-nrf52840 -monitor ./examples/heartrate
   code    data     bss |   flash     ram
  41216    1464    4680 |   42680    6144
Connected to /dev/ttyACM0. Press Ctrl-C to exit.
Sread error: Port has been closed

Some println() debugging seems to indicate that this the line where it crashes:
https://github.com/tinygo-org/bluetooth/blob/release/examples/heartrate/main.go#L60

Changing that line to

return uint8(min)

allows the example to execute as expected.

Calling rand.Intn() function from a normal serial program without softdevice does not cause any problems.

Running the heartrate example on HCI or Linux does not cause any problems either.

I also experience this same crash on most recent TinyGo release.

@deadprogram
Copy link
Member Author

I experienced problem also on pca10040 board:

$ tinygo flash -size short -target pca10040-s132v6 -monitor ./examples/heartrate
   code    data     bss |   flash     ram
  38624    1356    4588 |   39980    5944
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
Info : J-Link OB-SAM3U128-V2-NordicSemi compiled Jan  7 2019 14:07:15
Info : Hardware version: 1.00
Info : VTarget = 3.300 V
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : [nrf51.cpu] Cortex-M4 r0p1 processor detected
Info : [nrf51.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf51.cpu on 3333
Info : Listening on port 3333 for gdb connections
[nrf51.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000a80 msp: 0x20000400
** Programming Started **
Info : nRF52832-QFAA(build code: E0) 512kB Flash, 64kB RAM
Warn : Adding extra erase range, 0x0002fc30 .. 0x0002ffff
** Programming Finished **
** Resetting Target **
shutdown command invoked
Connected to /dev/ttyACM0. Press Ctrl-C to exit.
BBBstarting
tick 00:00.009
SoftDevice assert
starting
tick 00:00.009
SoftDevice assert
starting
tick 00:00.009
SoftDevice assert
starting
tick 00:00.009
SoftDevice assert

The program does not crash, but it does not correctly publish the heart rate notifications. This same board does work correctly when running the scanner example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant