I am trying to read a FTM counter inside an interrupt raised on CnV match of the same FTM timer.
void vBIOS_CPG_Handler(oc_event_t event, void * userData)
u16CounterValue = FTM_DRV_CounterRead(5);
u16CounterValue2 = FTM_DRV_CounterRead(5);
A breakpoint on the last line will give me 2 values closed to each other for u16CounterValue and u16CounterValue2 as expected (few ticks difference).
But If I watch the FTM-> CNT register, the value is not the same?
Any idea why there is a difference?
Thx. I am using FTM5 on a S32K146!
I guess my issue is the debug, when breaking the FTM may continue to run or something.
If I make a breakpoint somewhere else in the code, the 2 variables seems to have an expected value.
i.e. if Cvn register is 500, I will see 525 for example which is ok as there is the time for the interrupt, few codes lines etc.
May the question is more if there is a way to do debug by breaking in the interrupt routine?
Thank you so much for your interest in our products and for using our community.
I'm very sorry for the delay. We are currently facing some backlog issues.
Could you confirm that you are using FTM5 and S32K144 please?
What happens is that the S32K144 only has FTM from 0 to 3 (Table 47-1. FTM instances and features of Reference Manual).
Have a nice day!