I have a problem setting up PWM on MK22
The device has a backlight LED on an LCD display, which is on PORTC pin 4
Simple GPIO works fine, but I cant seem to get PWM working
Using the SDK example as a template, I've set the port/pin as
PORT_SetPinMux(PORTC,4, kPORT_MuxAlt4);/* Configured as PWM FTM0_CH4 */
But I'm not sure if kPOST_MuxAlt4 is OK for Port C, since the example LED pin was on Port D
I've setup the FTM as per the template, except I'm only using 1kHz instead of 24kHz
ftm_config_t ftmInfo;
ftm_chnl_pwm_signal_param_t ftmParam;
ftmParam.chnlNumber = BOARD_FTM_CHANNEL;
ftmParam.level = kFTM_LowTrue;
ftmParam.dutyCyclePercent = 99;
ftmParam.firstEdgeDelayPercent = 0U;
FTM_GetDefaultConfig(&ftmInfo);
FTM_Init(BOARD_FTM_BASEADDR, &ftmInfo);/* Initialize FTM module */
FTM_SetupPwm(BOARD_FTM_BASEADDR, &ftmParam, 1U, kFTM_CenterAlignedPwm, 1000U, FTM_SOURCE_CLOCK);
FTM_StartTimer(BOARD_FTM_BASEADDR, kFTM_SystemClock);
But I don't seem to be getting any PWM from the pin.
I also tried setting the pin as output
GPIO_PinInit(PORTC, 4, &pin_config_output);
But that didn't resolve the problem.
So I don't know what I've missed or have done wrong.
Thanks