Hi,
I am using timer2 as PWM to play sound on piezo. My whole application works fine if I flash only application on my device. But if I combine it with bootloader and then flash it on device, all the functionalities work fine, escape piezo which is running on timer2.
What am I missing here?
Device:
我有肌萎缩性侧索硬化症o seen that if I use timer2 along with timer0 then all the things are working fine. But I remove timer0, then timer2 also stops working.
Currently, I am using app_easy_timer() function instead of timer0 and that's how the issue is being produced.
Okay, I found it.
Actually while initializing timer0, I was calling following fuction.
set_tmr_enable( CLK_PER_REG_TMR_ENABLED );
set_tmr_div( CLK_PER_REG_TMR_DIV_8 );
So, it enables timer0 and timer2 clock. But as I have removed timer0 initialization code, timer2 clock source was also in the default ( disabled ) state.
Now, I am adding above mentioned function at the time of timer2 initialization and it is working fine now.
But still, I am not getting that if I do not integrate secondary bootloader, then timer2 perfectly works. And if I integrated secondary bootloader, then timer2 clock initialization must be done.
Hi Ankit,
The difference that you see is when the device is flashed via JTAG or flashed via the secondary bootloader (using the AN_B_001 header or the multiple image configuration) or the primary bootloader ? Most probably the issue is related to what the device does before running the actual fw, and what is the state of the CLK_PER_REG before the actual fw runs, so what the bootloader is executing (both bootloaders primary and secondary use the timer0 in order to measure time), since its quite different to download the image directly from the JTAG and executing the bootloader. Anyway, you should make sure that the peripheral clocks on the device for the timers are enabled before actually using the timers.
Thanks MT_dialog