AnsweredAssumed Answered

[MKW01] TPM pulse counter in VLPS

Question asked by Giancarlo Zanuz on Feb 9, 2018
Latest reply on Mar 9, 2018 by Giancarlo Zanuz

Hello, I'm having some trouble to use the TPM as a pulse counter in VLPS.

In RUN mode it counts the pulses, but when I put in VLPS it stops counting.

I'm using the input pin PTE16 - ALT4 (TPM_CLKIN0).

Some question, do the TPM source clock needs to be active in VLPS to count pulses? Isn't it an async operation? Cause the TPM clock source is 'kClockTpmSrcPllFllSel', which is disabled in VLPS.


Thanks in advance.



EDIT: Ok, when I change the clock source to 'kClockTpmSrcOsc0erClk', it works normally. But now it is generating a wakeup interrupt every ~60s, which is strange, since the interruptions are off. I'm using an external xtal at 32.768kHz as the clock source.

Here is the source code:


            tpm_general_config_t TPMConfig = {
                .isDBGMode                  = false,
                .isGlobalTimeBase           = false,
                .isTriggerMode              = false,
                .isStopCountOnOveflow       = false,
            if(TPM_DRV_Init(DEFAULT_PULSES_TPM_INSTANCE, &TPMConfig) != kStatusTpmSuccess)
                return false;
            CLOCK_SYS_SetTpmSrc(DEFAULT_PULSES_TPM_INSTANCE, kClockTpmSrcOsc0erClk);
            TPM_DRV_SetClock(DEFAULT_PULSES_TPM_INSTANCE, kTpmClockSourceExternalClk, kTpmDividedBy1);
            CLOCK_SYS_SetTpmExternalSrc(DEFAULT_PULSES_TPM_INSTANCE, kSimTpmClkSel0);
            TPM_DRV_CounterStart(DEFAULT_PULSES_TPM_INSTANCE, kTpmCountingUp, 0xFFFF, false);