Restarting timer inside its own IRQ

Hello all!

I have a timer that sometimes gets started inside the IRQ of the ESB and sometimes needs to be restarted inside its own IRQ

I'm running it in a "one shot" mode, so it stops after it interrupts, and then you need to use code to start it again.

This works fine when this is done inside the ESB IRQ. But when I try to configure it to interrupt again inside its own IRQ, it will interrupt again, but at the wrong time.

I'm trying to make it interrupt 200ms after it is started, but no matter what value I load into the CC register, it always interrupts after around 70ms-80ms

But I'm using the same function to configure it in both the ESB IRQ and in its own IRQ (the code is the same then), so the only thing that I can think of is that it's not recommended to configure a timer to interrupt again inside its own IRQ. Maybe this causes undefined behaviour?

Thank you so much!

Related