AnsweredAssumed Answered

Kinetis E Signal Multiplexing

Question asked by Daniele Mereu on Apr 8, 2015
Latest reply on Apr 9, 2015 by Daniele Mereu

Hi all

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:

//     PTC4

SIM_RemapFTM2CH2Pin();

FTM_PWMInit(FTM2, FTM_PWMMODE_EDGEALLIGNED, FTM_PWM_HIGHTRUEPULSE);

FTM_SetFTMEnhanced(FTM2);

FTM_SetModValue(FTM2, 39999);

FTM_ClockSet(FTM2, FTM_CLOCK_SYSTEMCLOCK, FTM_CLOCK_PS_DIV1); 

NVIC_EnableIRQ(FTM2_IRQn);

FTM_SetCallback(FTM2, FTM2_Task);

FTM_SetChannelValue(FTM2, FTM_CHANNEL_CHANNEL2, 20000);

 

//     PTB4

KBI_ConfigType  sKBIConfig;

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[6].bEdge = KBI_FALLING_EDGE_LOW_LEVEL;

sKBIConfig.sBits.bIntEn  = 1;

sKBIConfig.sPin[6].bEn   = 1;

KBI_Init(KBI1, &sKBIConfig);

KBI_SetCallback(KBI1, &KBI1_Task);

 

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?

Daniele

Outcomes