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

Watchdog Timer Implementation

Hello, 

I am transmitting 1 byte BLE data across a central and peripheral and the central does other things like control PWM, sample SAADC (scan mode), GPIO pins interrupts etc. I need to ensure that my application is not stuck while doing any of those tasks or in any of the event handlers and hence, I want to implement a watchdog timer.

What is the ideal way for using the watchdog in such a case or in other words when should I kick the dog in such an application. I though of having a watchdog at start of every event handler and disabling at end of event handler but if SoftDevice interferes while running the SAADC event handler, the dog wont be kicked and the system will be reset.

Thanks in advance

Parents Reply Children
  • Yes, as mentioned at the page you linked: "An interrupt at priority level 0 sets up and performs the flash activity. The CPU is halted for most of the time in this interrupt".

    Note that 90ms is the maximum time for a page erase. When I have tested this, I have seen typical times in the range of 2-3 ms for a flash page erase operation to complete.

    Whenever the softdevice is enabled, all flash write/erase operations needs to go through the softdevice. The softdevice will schedule flash access according to the priorities described on this page. Performing flash access directly when softdevice is enabled will most likely cause an assert, as the CPU is halted during the operation, preventing the softdevice from handling its timing-critical tasks. FDS runs on top of Fstorage, which have separate backends for use with and without softdevice. The Fstorage softdevice backend will use the softdevice flash API for flash operations.

Related