Tool/software: Starterware
Hello,
Using starterware timer example for an M4 we put together software to program the Timer 10 module to function as a 1-ms timer.
Normal program sequence is:
0. Systems powers up and loads timer config software
1. timer config software force enables the timer module using CM_L4PER_TIMER10_CLKCTRL, selecting SYS_CLK1_32K_CLK (aka FUNC_32K_CLK) as source clock.
2. configures timer interrupt xbar and link to ISR
3. Soft Resets the Timer module then program the necessary registers as per the TRM.
4. Clears existing interrupt flags then enable timer
We're sometimes experiencing an issue at #3. After issuing a soft reset (using TIMERReset) we attempt to load the TPIR register, then the TNIR register, followed by all other necessary registers. The problem is that we never exit out of the function to write to the TNIR register. It appears the timer config is halting there due to the check TimerWaitForWrite(). That would mean that the TPIR register hasn't actually been written yet, correct?
We've tried writing other registers first, after the soft reset, but we still get the halt every once in a while so it's not specific to TPIR. We've manually checked that the reset command executed even though the reset API function checks to make the reset has completed before exiting and that looked good. Using a separate CPU core to help debug we've tried accessing other Timer 10 registers when the error occurs to try and find the source of the error but any read attempt of Timer 10 registers freezes the system. This is similar to to when the Timer module isn't enabled but we checked CM_L4PER_TIMER10_CLKCTRL and the read value indicates it's still enabled.
Is there any other reason why Timer 10 module would be frozen? Anything we can check to debug the issue? The Timer module doesn't always freeze and when it doesn't freeze, the 1-ms timer works great so not sure why this is sometimes happening.
Thanks,
Juan