KL17Z32 PWM Init Problem

cancel
Showing results for 
Search instead for 
Did you mean: 

KL17Z32 PWM Init Problem

99 Views
Contributor II

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?

Labels (1)
Tags (1)
0 Kudos
1 Reply

18 Views
NXP TechSupport
NXP TechSupport

Hi BOB KOHAN,

      I highly recommend you use our newest SDK2.x instead of the SDK 1.3.0, that is really very old and not updated even it has bugs.

     Please download the SDK2.x from this link:

      https://mcuxpresso.nxp.com/en/select 

   In the processor choose your MKL17z32 part number, than generate the code and download it.

  You can refer to the project tpm_pwm_twochannel in folder:SDK_2.4.1_FRDM-KL27Z\boards\frdmkl27z\driver_examples\tpm\pwm_twochannel

   pastedImage_2.png

Then you can refer to this code, just add another channel.

Wish it helps you!

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos