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

Why does the NRF52840 application stops working when i add code to the timeout handler of the application timer?

I have a function which writes data to the external flash which is using a FAT file-system further using block device implementation of the SDK. Whenever I am calling the function in the Application timer timeout handler, the total crashes after 10 to 60 seconds of operation. I also saw an error log as "Softdevice assertion failed". I understand there is timing issues because of which this might be happening. I want to know the right way to synchronize all the small tasks i have in my App. What is the correct way to run all the different peripherals with synchronization and call functions inside the timer handler? 

And how can i program the nrf52840 correctly to do all the tasks when the program in running in the while(1) loop.

Parents
  • Hi Rit,

    All app_timer timeout handlers are called from the RTC interrupt handler context. So if the operation takes long, then it is ok to request those operations in the timeout handlers as long as those operations are asynchronous. It looks to me that something in your operation is not letting the softdevice pre-empt your code. That most likely will happen when you are running on a very high priority context. Did you make sure that all your peripheral drivers are running on the interrupt priority NOT reserved by the softdevice as mentioned here? If you have not initialized any priority for the peripheral you are using, it takes a default highest priority of 0 on ARM NVIC, which is reserved only for softdevice and application are not allowed to use this high priority when working with softdevice..

Reply
  • Hi Rit,

    All app_timer timeout handlers are called from the RTC interrupt handler context. So if the operation takes long, then it is ok to request those operations in the timeout handlers as long as those operations are asynchronous. It looks to me that something in your operation is not letting the softdevice pre-empt your code. That most likely will happen when you are running on a very high priority context. Did you make sure that all your peripheral drivers are running on the interrupt priority NOT reserved by the softdevice as mentioned here? If you have not initialized any priority for the peripheral you are using, it takes a default highest priority of 0 on ARM NVIC, which is reserved only for softdevice and application are not allowed to use this high priority when working with softdevice..

Children
Related