I am testing the flexcan module of MPC5643L using the example program,but the transmission works while reception doesn't work.I have watched the register, and found that the reception cannot get its flag when comes to the program as below.I don't know what's wrong.
if(1 == CAN_1.IFLAG1.B.BUF9I)
I will be appreciate if someone can help me sovle the problem.Thank you.
and here is the sample program.
Original Attachment has been moved to: MPC5643L-FlexCAN-SimpleRXTX-CW210.zip
Hi,
This example is designed for and was tested on MPC5643L EVB. Two MCU’s FlexCAN modules are used. FlexCAN_A is used to transmit a message and FlexCAN_B is configured to receive it.
The connection scheme between modules is similar as AN2865 states and it is mentioned in the main.c file.
If CAN(H) transceiver is used, you can also use following jumper setting
* J29 all off
* J27 1-3 and PJ1 5-6
* J27 2-4 and PJ1 3-4
* J28 on
But it looks you have modified the example little bit. Do you use different board instead of MPC5643L EVB?
The PLL config was changed for 8Mhz crystal as input clock. Also the Bit timing of the both FlexCAN modules are different.
So do you use just single FlexCAN module? If not how do you have both modules connected together on your board?
BR, Petr
Dear Petr:
I am using my own board designing based on MPC5643L. The example I got before is like what you said that 'The PLL config was changed for 8Mhz crystal as input clock. Also the Bit timing of the both FlexCAN modules are different.' and I have modified the example for 40 Mhz crystal as input clock. Also I set the FlexCAN modules bit timing 500kHz both. I have tried using LPB mode on FLEXCAN_1 by set the LPB register 1,which doesn't need any more wire.But the transmission is right but the reception flag can't be gotten. I don't know why.and here is my program.
I wish you can give me a right example or help me find what's wrong with my program. Thank you very much.
Enable self-reception (MCR[SRX_DIS]=0) if you want to receive transmitted message. Also for the loop-back mode.
But in your code the CTRL[LPB] is not set , but maybe you sent different code version.
BR, Petr
Oh,I forgot to set MCR[SRX_DIS]=0. And it's right now. Thank you very much!