AnsweredAssumed Answered

KL17Z32 PWM Init Problem

Question asked by BOB KOHAN on Dec 18, 2018
Latest reply on Dec 18, 2018 by Kerry Zhou

We are using the Kinetis KL17Z32VFM4 and three PWM channels to control three strings of Red, Green and Blue LEDs.The IDE is KDS 3.2 with KSDK 1.3. Processor Expert is used to configure the PMW channels. The PWM setup is "Edge Aligned", 1000Hz and the Duty Cycle is 0%, "High true".

The configs are:

 

tpm_general_config_t tpmTmr1_InitConfig0 = {
.isDBGMode = false,
.isGlobalTimeBase = false,
.isTriggerMode = false,
.isStopCountOnOveflow = false,
.isCountReloadOnTrig = true,
.triggerSource = kTpmTrigSel8,
};

tpm_pwm_param_t tpmTmr1_BluConfig0 = {
.mode = kTpmEdgeAlignedPWM,
.edgeMode = kTpmHighTrue,
.uFrequencyHZ = 1000U,
.uDutyCyclePercent = 0U,
};

tpm_pwm_param_t tpmTmr1_GrnConfig4 = {
.mode = kTpmEdgeAlignedPWM,
.edgeMode = kTpmHighTrue,
.uFrequencyHZ = 1000U,
.uDutyCyclePercent = 0U,
};

tpm_pwm_param_t tpmTmr1_RedConfig5 = {
.mode = kTpmEdgeAlignedPWM,
.edgeMode = kTpmHighTrue,
.uFrequencyHZ = 1000U,
.uDutyCyclePercent = 0U,
};

 

It generates the following code to initialize the TPM:

 

/*! tpmTmr1 Auto initialization start */
TPM_DRV_Init(tpmTmr1_IDX, &tpmTmr1_InitConfig0);
TPM_DRV_SetClock(tpmTmr1_IDX, kTpmClockSourceModuleClk, kTpmDividedBy32);
TPM_DRV_PwmStart(tpmTmr1_IDX, &tpmTmr1_BluConfig0, 0U);
TPM_DRV_PwmStart(tpmTmr1_IDX, &tpmTmr1_GrnConfig4, 4U);
TPM_DRV_PwmStart(tpmTmr1_IDX, &tpmTmr1_RedConfig5, 5U);
/*! tpmTmr1 Auto initialization end */

 

On power up we see the Red LEDs flash on. If the Blue LED PWM channel is setup last, the Blue LEDs flash.
Green LEDs flash if the Green PWM channel is last.

What causes this and how can it be prevented?

Outcomes