App_timer interrupt doesn't wake the processor from System ON sleep

Hi everyone. Here is my code for 2 different timers that put uc to sleep and wake it up(supposedly)

Definitions:

Create Timers:

Handlers:

Main() function calls:

sleep_Uc() function:

the code works fine when there is no sleep_Uc(); function. But when it is used, LED_1 toggle from low to high and uC goes to sleep. But the timer for lcd doesn't wake the processor. Additionally, when app_timer IRQ priority higher then GPIOTE IRQ priority, GPIOTE interrupts doesnt wake the uC either.

At the moment, IRQ_Priority of app_timer is 3, IRQ_Priority of GPIOTE is 2. When an GPIOTE interrupt occurs, uC wakes and goes to sleep immediatelly due to queued interrupts of app_timer i guess. How can i make the system wake with app_timer interrupts ?

Parents Reply Children
  • yes i did started it. Can you see sleep_uC function inside the app_timer handler? if i move it to while loop in main function. processor wakes and goes to sleep as it should be. but it stops when it is in handler. Does subroutine work after wake with app_timer interrupt ?

  • I have tested multiple approaches. When i put the sleep_uC(); function to inside of one of the app_timer handlers, __wfe stucks at the inside of the handler. But if i put sleep_uC(); function to while loop of the main function, it works like a charm. Wakes, run the handler and go back to sleep. I think i will have to constuct a logic map for my needs like setting a flag in handler and execute the code accourding to flag values. same with gpiote interrupts.