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

write_buf_store crash

      I use nrf52832 sdk15.2 to develop products, use WDT to prevent program crashes, WDT set time is 10S, nrf52832 will be paired and bound after connecting with IOS phone, when nrf52832 and IOS binding, keep opening The IOS mobile phone's Bluetooth switch will crash, the function of the problem is write_buf_store, the following picture is the data in Call Stack+Locals, please help me to see what might be caused? How should it be solved? Thank you!

        call stack.zip

  •          I am not quite sure about the operating mechanism of fds_gc(). I suddenly thought that nrf52832 will call the "NVIC_SystemReset()" function for reset processing in a certain state. If it is being processed at some point in fds, call "NVIC_SystemReset( )) After the reset, call the fds_gc function to collect garbage when there is no problem? Is it necessary to determine certain flags before resetting, delay reset?
            In addition, I understand that peer mananger will use fds, but I don't know when I need to store records. When do I need to delete records? Is there any reference to this information? Thank you!

  • Hi,

    Have you tried to reload the WD timer more frequently? The FDS write shouldn't take more than a few milliseconds, so it should not lead to WD timeout. 

     I am not quite sure about the operating mechanism of fds_gc(). I suddenly thought that nrf52832 will call the "NVIC_SystemReset()" function for reset processing in a certain state. If it is being processed at some point in fds, call "NVIC_SystemReset( )) After the reset, call the fds_gc function to collect garbage when there is no problem? Is it necessary to determine certain flags before resetting, delay reset?

    It's shouldn't be necessary to perform a reset after garbage collection. Where is the NVIC_SystemReset() function called in your code? 

    In addition, I understand that peer mananger will use fds, but I don't know when I need to store records. When do I need to delete records? Is there any reference to this information? Thank you!

    You can use the API in peer_manager.h to delete bonds. I would also recommend to periodically call fds_stat() to check the flash usage, then perform garbage collection when flash usage is above a certain threshold, 80 % for instance. Note that GC is pretty time consuming so should preferably be done while the app is "idle" (i.e., disconnected and doing slow or no advertising). 

Related