FRDM-KE06Z Problems with the PWM and CAN, need help!!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-KE06Z Problems with the PWM and CAN, need help!!

748 Views
yuqili
Contributor I

Hello to all,

I got the board recently and have tested the modules with the code in the Typical used, now I have 2 problems:

1. I used the Processor Expert to generate a PWM signal with 400ms period and 100 starting pulse width, then I checked the signal by a oscilloscope ,I found the period was 360ms and there's always 16% error with the period and the duty time after I use the SetDutyMS(). And the method SetRatio16() seems don't work at all, the ratio was always <1% regardless the number I set. Same situation after changed the FTM.

int main(void)

{

  LDD_TError Error;

  LDD_TDeviceData *MyPWMPtr;

  unsigned int i,j;

  PE_low_level_init();

  /* Write your code here */

  MyPWMPtr=PWM1_Init((LDD_TUserData *)NULL);

  for(i = 0; i < 65535; ++i) {

     Error=PWM1_SetRatio16(MyPWMPtr,i);

      //PWM1_SetRatio16();

      for(j = 0; j < 65535; ++j);}

...

}

2. The CAN module can't generate any signal to the pins: I used the looping mode for testing, the receiver can receive the frames sent by it self in the debug mode , but there is no signal detected on the CAN_H or CAN_L.

Thanks very much for the help !!

0 Kudos
5 Replies

550 Views
davidsherman
Senior Contributor I

Check the pin selection register, SIM_PINSEL1.  The FRDM-KE06 board uses the alternate pins PTE7 and PTH2 for the CAN signals, so the MSCANPS bit will need to be set to use them.

0 Kudos

550 Views
yuqili
Contributor I

Thanks you for your following,

   I have checked the SIM_PINSEL1 and it seems all right, the signal on the pins of the processor is as same as the pins of the module CAN J11:  always a flat.

0 Kudos

550 Views
davidsherman
Senior Contributor I

What is the MSCANPS bit set for?

0 Kudos

550 Views
yuqili
Contributor I

HI,

  I have found out the problem is the interrupt of the component CAN_LDD, when I disable the interrupt the signal is OK......

0 Kudos

550 Views
yuqili
Contributor I

Capture.PNG.png

Here is the capture photo of debugging.

What is interesting is when I tested the sample code of MDK Keil, everything is fine.....I think its the problem of CW or Processor Expert.

0 Kudos