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-80msBut 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!
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
How do you know it interrupts after 70-80ms? Do you share this TIMER instance with the ESB stack, and if so does the ESB stack use the timer at the same time as you're using it?
I'm using a function to measure the time between two interrupts. I should see a 200ms difference between the values that this function outputs, but I'm seeing the value I mentionedIm using TIMER2 and I just saw at the docs that the ESB stack uses timer 2 as well (https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Fesb_users_guide.html&cp=5_1_5_2_1&anchor=esb_config)So I think this might be the problem, Im gonna this with another instance of the system timers
Yeah, that's it. I'm surprised you're able to run any ESB links at all.
I switched to another instance of the timer and that worked! So the recommendation is that user code never uses TIMER_2 and TIMER_3 when also running the ESB?Thanks!