Manual of KL26 says the following:
Counter Reset
Any write to CNT resets the TPM counter and the channel outputs to their initial values
(except for channels in output compare mode).
However, I am unable to reset the counter doing that, my code is simple:
tpm_config_t tpmConfig;
CLOCK_SetTpmClock(1);
CLOCK_EnableClock(kCLOCK_Tpm2);
TPM_GetDefaultConfig(&tpmConfig);
TPM_Init(TPM2, &tpmConfig);
TPM_StartTimer(TPM2, kTPM_SystemClock);
for (uint8_t i = 0; i < 255; i++); /* Give time to increment counter */
TPM_StopTimer(TPM2);
TPM2->CNT = 0; /* Does nothing, CNT register maintains its previous value */
Do I need to configure anything else? I have the same problem in KL26 and KL27 MCUs.
Thank you in advance