Hi,
I'm building a wireless product on KW242512 IC.
I planned to drive a LED brightness with a PWM signal.
I started with KSDK1.3.0 / examples / twrkw24d512 / driver_examples / ftm
PTD4 configured as FTM0_Ch4 is used to drive LED brightness.
I have changed board.h as follow
/* The Flextimer instance/channel used for board */
#define BOARD_FTM_INSTANCE 0
#define BOARD_FTM_CHANNEL 4
When I run the example code nothing happens on PTD4 where I thought a PWM wave will show up.
What is wrong in my setting?
How do I need to use this example code to get a PWM signal on PTD4 pin.
Attached the project files
Original Attachment has been moved to: board.h.zip
Original Attachment has been moved to: main.c.zip
Original Attachment has been moved to: pin_mux.c.zip
Hi Pavel,
The example code for FTM works fine with your changes!
Thank's a lot.
Regards.
Fabrice.
Hi Fabrice,
I have to start with the obvious questions first. What development platform are you using? FRDM?
Are you positive the code is running? Are you able to see the print outs? Are you able to step through the code and see the appropriate variables increment and decrement properly (ftmParam.uDutyCyclePercent)?
Regards,
Chris
Hi Chris,
Thank you for your reply Chris.
I'm using a KW24 TWR board (twrkw24d512) on IAR workbench
Regards,
Fabrice
Hi Fabrice,
I have already tested this example together with TWR-KW24 with small changes in the code:
#define BOARD_FTM_CHANNEL 4
void configure_ftm_pins(uint32_t instance)
{
switch(instance) {
case FTM0_IDX: /* FTM0 */
/* Affects PORTD_PCR6 register */
PORT_HAL_SetDriveStrengthMode(PORTD,4u,kPortLowDriveStrength);
PORT_HAL_SetMuxMode(PORTD,4u,kPortMuxAlt4);
PORT_HAL_SetSlewRateMode(PORTD,4u,kPortSlowSlewRate);
break;
default:
break;
}
}
Everything works fine, I see the PWM signal on the pin PTA4 - J19 pin 2.
Best regards,
Pavel