I encountered the following problem during the development of S32K144:
The initialization timer's interrupt overflow period should be 1 second.
The premise is that my clock configuration is 8MHz.
However, after I changed the clock to a 20M clock...
I discovered that my timer overflow period is no longer 1 second, but has become 400 milliseconds.
However, my timer clock selection is still set to the 8MHz internal clock.
PCC->PCCn[PCC_FTM1_INDEX] |= PCC_PCCn_PCS(0x01) /* Clock src=1, 8 MHz SIRCDIV1_CLK */
| PCC_PCCn_CGC_MASK; /* Enable clock for FTM regs */
I'm not sure what configuration issue is causing this problem.
Hi
建议看一下S32K1 RM的Table 27-9. Peripheral module clocking (continued),FTM具体选择哪个时钟源需要查看FTMn_SC[CLKS]和29.6.17 PCC FTM1 Register (PCC_FTM1)的PCS位。
你用Processor Expert生成配置,又用baremetal方式直接操作寄存器。我不确定是否是因为调用了SDK里的API导致和你的baremetal程序冲突了。 建议debug情况下直接检查上述两个寄存器。
顺便提一句,baremetal直接操作寄存器的话建议参考S32K144_Project_FTM例程,如果想用ProcessorExpert 搭配SDK的API则建议参考ftm_periodic_interrupt_s32k144例程。
Best Regards,
Robin