From f15a178be0697cc4c50ab23e03afd21a9face56a Mon Sep 17 00:00:00 2001 From: Mahadevan Mahesh Date: Tue, 28 Jun 2016 09:24:27 -0500 Subject: [PATCH] Set the clock source in KL27 PWMOUT driver By default the TPM clock source is disabled Signed-off-by: Mahadevan Mahesh --- .../TARGET_KSDK2_MCUS/TARGET_KL27Z/pwmout_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/pwmout_api.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/pwmout_api.c index dd5e5fd1b3..a2a90e8b8b 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/pwmout_api.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/pwmout_api.c @@ -34,6 +34,9 @@ void pwmout_init(pwmout_t* obj, PinName pin) { obj->pwm_name = pwm; uint32_t pwm_base_clock; + + /* Set the TPM clock source to be IRC 48M */ + CLOCK_SetTpmClock(1U); pwm_base_clock = CLOCK_GetFreq(kCLOCK_McgIrc48MClk); float clkval = (float)pwm_base_clock / 1000000.0f; uint32_t clkdiv = 0;