AnsweredAssumed Answered

KW40Z Connectivity TMR and TPM coexistence issue

Question asked by Lucian Firan on Feb 22, 2017
Latest reply on Mar 6, 2017 by Lucian Firan

KW40Z_Connectivity_Software_1.0.1 (KSDK_1.3.0); IAR 7.50

 

If TPM is initialized before TPM timers TimerCallback are not triggered any more.

 

ApplMain.c
void main_task(uint32_t param)
TMR_Init();
TPM_PWM_Init();

 

TimersManager.c

void TMR_Init ( void) {
.....
StackTimer_Init(StackTimer_ISR);
    
TMR_Adapter.c
.....                                           
void StackTimer_Init(void (*cb)(void))        

TPM_Type *tpmBaseAddr = g_tpmBase[gStackTimerInstance_c];

CLOCK_SYS_EnableTpmClock(gStackTimerInstance_c);

TPM_HAL_Reset(tpmBaseAddr, gStackTimerInstance_c);
TPM_HAL_SetClockDiv(tpmBaseAddr, kTpmDividedBy128);

 

TPM files

 

void TPM_PWM_Init(void)
{

...

TPM_DRV_Init(BOARD_TPM_INSTANCE_1, &driverInfo_1);

TPM_DRV_SetClock(BOARD_TPM_INSTANCE_1, kTpmClockSourceModuleClk, kTpmDividedBy2);

...

  TPM_DRV_Init(BOARD_TPM_INSTANCE_0, &driverInfo_0);
  TPM_DRV_SetClock(BOARD_TPM_INSTANCE_0, kTpmClockSourceModuleClk, kTpmDividedBy2);

}

 

How can this be solved ?

Outcomes