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

App timer with 500 ms period filling app scheduler queue

Hello,

today I had a problem where a timer was causing my device to reset after a while, because the app scheduler queue got full and it was raising an NRF_ERROR_NO_MEM exception.

The period of the timer was 500 ms. My question is: Does a 500 ms repeated timer really put that much of a pressure on the app scheduler? Is it possible to increase the size of the queue to avoid such problems?

Parents
  • In the latest SDK the size of the queue is based on the value you set during the app_sched_init call. The first passed parameter is the maximum size of any queue message, and the second parameter is the number of messages that may be queued before you hit the no memory error. The only requirement should be that you make sure to call app_sched_execute to clear the messages before you hit your limit. Conveniently enough, a 500ms app timer will add one message every 500ms, so it should be easy to calculate how often you have to execute the messages.

    All app scheduler messages go onto a common queue, so if you're using the scheduler for other operations such as handling BLE connection events, you have to take their contribution to the queue size into consideration.

Reply
  • In the latest SDK the size of the queue is based on the value you set during the app_sched_init call. The first passed parameter is the maximum size of any queue message, and the second parameter is the number of messages that may be queued before you hit the no memory error. The only requirement should be that you make sure to call app_sched_execute to clear the messages before you hit your limit. Conveniently enough, a 500ms app timer will add one message every 500ms, so it should be easy to calculate how often you have to execute the messages.

    All app scheduler messages go onto a common queue, so if you're using the scheduler for other operations such as handling BLE connection events, you have to take their contribution to the queue size into consideration.

Children
No Data
Related