Dear Nordic team,
I am maintain firmware on nRF51802QFAA with SDK12.3.
It starts a timer within 5 seconds interval, in timeout_handler, it will read sensor data via i2C, then save data in flash memory via SPI.
When it is connected by mobile phone, phone will request data which is stored in flash memory, device will restart timer with 100 milliseconds interval. In timeout_handler function, it will read flash data one by one and send to mobile phone quickly.
Unfortunately, almost every time, the timeout_handler can not be triggered immediately after I call app_timer_stop() and app_timer_start(). I wait for about 30 seconds or even longer time, then timeout_handler is triggered. After this, it can be triggered every 100ms correctly.
Note:
(1) I set SPI priority to 2, while timer and I2C priority is 3. Because I found SPI transfer will be blocked if its priority is set to 3. I think it is competing for cpu resources with timer & I2C.
(2) I already tried to put app_timer_stop() and app_timer_start() in CRITICAL_REGION_ENTER() and CRITICAL_REGION_EXIT() to help timer restarting well. But it help just a little, can not make timer restart immediately every time.
Can you please figure out how to fix this problem?
Many thanks!
Bob