AnsweredAssumed Answered

Wrong routing for TPM input capture source

Question asked by Kolja Waschk on Oct 30, 2015
Latest reply on Nov 3, 2015 by Kerry Zhou

Hi,

 

I'm converting a Processor Expert/KSDK 1.2.0-based project from KL27Z64 to KL17Z64.

 

A configuration for TPM1 channel 0 for input capture from pin PTA12/TPM1_CH0 (which is available and the same on both MCUs) does work on the KL27Z64 but is not set up correctly on KL17Z64. A line is generated in Generated_Code/pin_mux.c which is (IMHO) plain wrong and doesn't allow proper operation unless overridden in user code.

 

The SIM_HAL_SetTpmChSrcMode(SIM,TPM1_IDX,0,) should IMHO select KSimTpmChSrc0 on both MCUs. The KSimTpmChSrc2, selected on KL17Z64, seems to refer to a source mode which is "reserved" according to the reference manual.

 

To ensure that no other components affect this outcome, I tried with fresh, new KL17 vs KL27 projects, just added the fsl_tpm component for TPM1 and configured that pin and the result is the same. If I add SIM_HAL_SetTpmChSrcMode(SIM,TPM1_IDX,0,kSimTpmChSrc0) in user code or just zero SIM_SOPT4 register after normal HW initialization, all starts functioning as desired.

KL27Z64 init_tpm_pins():

 

void init_tpm_pins(uint32_t instance)

{

  switch(instance) {   

    case TPM1_IDX:                      /* TPM1_IDX */

      /* Affects PORTA_PCR12 register */

      PORT_HAL_SetMuxMode(PORTA,12UL,kPortMuxAlt3);

      SIM_HAL_SetTpmChSrcMode(SIM,TPM1_IDX,0,kSimTpmChSrc0);

 

KL17Z64 init_tpm_pins():

 

void init_tpm_pins(uint32_t instance)

{

  switch(instance) {   

    case TPM1_IDX:                      /* TPM1_IDX */

      /* Affects PORTA_PCR12 register */

      PORT_HAL_SetMuxMode(PORTA,12UL,kPortMuxAlt3);

      SIM_HAL_SetTpmChSrcMode(SIM,TPM1_IDX,0,kSimTpmChSrc2);

 

Thanks for any hints how to prevent this in the configuration..

Kolja

Outcomes