I'm developing a firmware with the evaluation board FRDM-KE04Z using IAR embedded workbench and "KEXX_DRIVERS_V1.2.1" library.
I would like to set:
- PTB4 as KBI1_P6 falling edge interrupt
- PTC4 as FTM2_CH2 PWM signal with frequency of 1KHz and 50% duty cycle
This is my source code:
FTM_PWMInit(FTM2, FTM_PWMMODE_EDGEALLIGNED, FTM_PWM_HIGHTRUEPULSE);
FTM_ClockSet(FTM2, FTM_CLOCK_SYSTEMCLOCK, FTM_CLOCK_PS_DIV1);
FTM_SetChannelValue(FTM2, FTM_CHANNEL_CHANNEL2, 20000);
for (int i = 0; i < KBI_MAX_PINS_PER_PORT; i++)
sKBIConfig.sPin[i].bEn = 0;
sKBIConfig.sBits.bMode = KBI_MODE_EDGE_ONLY;
sKBIConfig.sPin.bEdge = KBI_FALLING_EDGE_LOW_LEVEL;
sKBIConfig.sBits.bIntEn = 1;
sKBIConfig.sPin.bEn = 1;
The problem is that PWM signal is perfect but PTB4 interrupt not works.
PTB4 interrupt only works if I don't setup PTC4 PWM, as if there was a problem with the signal multiplexing of the PTB4 pin because I see also on PTB4 the PWM signal!
How can I setup these pins to works together but with different roles?
Anyone can help me?