This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52832 Crashing after sending Notification

Hi All,

I am developing an application with a custom BLE profile, one in which i would like to notify the central of certain values as soon as they connect. I have built the app such that once the user subscribes to the notifications, they are immediately notified of the values for the characteristic.  My problem is that immediately after I send the notification the program jumps to "unknown function at 0x000008c8". I've looked around a bit and i gathered that this is happening because of a softdevice assertion, is that correct?

I have tried to set breakpoints to get more info but i can't seem to get anything helpful. The problem occurs anytime i send a notification, although it is not directly after the sd_ble_gatts_hvx call, i can get a few stack calls away from that and then I lose the thread and I'm in no man's land. 

It might also be worth mentioning that I am using the RNG peripheral on the chip and I' not using the recommended sd_rand functions to access the values because they were not generating any values for me. I'm not sure if this would affect the softdevice in the aforementioned way.

this is what is shown in the disassembly when the error occurs. nothing is in the call stack except this address. I'm using softdevice s132 v. 5.0, and SDK14.2 on the NRF52 DK.

 

Any and all help is appreciated!

Patrick

  • Hello Patrick,

     

    It might also be worth mentioning that I am using the RNG peripheral on the chip and I' not using the recommended sd_rand functions to access the values because they were not generating any values for me. I'm not sure if this would affect the softdevice in the aforementioned way.

     It is not unlikely that this is what's causing the problems. How did you try to use the softdevice implementation for the random number generations, and what was it that didn't work?

  • I tried to generate a 16 byte random vector, and used a function that contained the sd_rand functions that would check the number of available bytes and write them to the buffer as they came in in a do, while loop. but the number of available bytes was always zero.

    I put in a separate devzone ticket for that problem, and made this one after i switched to using the nrf_drv_rng functions directly (link to rng ticket https://devzone.nordicsemi.com/f/nordic-q-a/61445/softdevice-rng-functions-not-working)

    I have been doing some experimenting with this problem more (crashing after notify) and it seems that if i use an indication the program will not crash however i have two indications that i am trying to send one after the other and only one of them gets sent (I assume because the sd is waiting for the response from the central)

  • I have made some more headway on the possible problem. After setting some breakpoints I can see that the sd_ble_gatts_hx() function is returning err_code 0x0C indicating that my data size transmission however I am only transmitting 16 bytes, well within the 20 byte MTU size when accounting for the opcode and handle length. Any ideas?

  • I Have found the issue, I simply set up the attribute incorrectly in the characteristic add function and pu t the wrong value in the macro  was using to set max_len. 

    I will close this ticket

Related