Hi Subhradeep,
Actually it is the same, you just need to refer the configuration code.
1. You should know your TPM source clock.

From this picture, you can get that the TPM have four source clock: MCGIRCLK, OSCERCLK, MCGFLLCLK, MCGPLLCLK.
Because I use the OSCERCLK 8Mhz, then the code is:
SIM_SOPT2 = (uint32_t)((SIM_SOPT2 & (uint32_t)~(uint32_t)(
SIM_SOPT2_TPMSRC(0x01)
)) | (uint32_t)(
SIM_SOPT2_TPMSRC(0x02)
));
2. Configure the TPM module
The TPM input clock is 8Mhz, because you want to get the 10us, then I divide the TPM clock with 8, and get 1Mhz, it is 1us.
Now, if you want to get 10us cycle, you just need to set MOD=9, then you will get (1+9)*1us=10us cycle.
The bare bone TPM code can be initialized like this:
void TPM0_Init(void)
{
/* SIM_SCGC6: TPM0=1 */
SIM_SCGC6 |= SIM_SCGC6_TPM0_MASK; // enable the TPM module
TPM0_C0SC = (TPM_CnSC_MSB_MASK | TPM_CnSC_ELSB_MASK); // choose the channel 0 mode as edge-aligned PWM mode
TPM0_C0V = TPM_CnV_VAL(0x05); // choose channel 0 value = 5, dufy is 5us
/* TPM0_MOD: MOD=9 */
TPM0_MOD = (uint32_t)((TPM0_MOD & (uint32_t)~(uint32_t)(
TPM_MOD_MOD(0xFFF6)
)) | (uint32_t)(
TPM_MOD_MOD(0x09)
)); // TPM MOD =9 ,it means the TPM cycle is 10us
/* TPM0_SC: DMA=0,TOF=1,TOIE=1,CPWMS=0,CMOD=1,PS=3 */
TPM0_SC = (uint32_t)((TPM0_SC & (uint32_t)~(uint32_t)(
TPM_SC_DMA_MASK |
TPM_SC_CPWMS_MASK |
TPM_SC_CMOD(0x02) |
TPM_SC_PS(0x04)
)) | (uint32_t)(
TPM_SC_TOF_MASK |
TPM_SC_TOIE_MASK |
TPM_SC_CMOD(0x01) |
TPM_SC_PS(0x03)
));
}
The test result is the same as PE.
You can try it on your side, but at first, you should make sure your project have 8Mhz OSC at first, you can use the FRDM-KL25 board to test it.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------