I am working on MPC5634M and I written a code develped from the example code about CAN_A to transmit and recive by CAN_C. I just changed CAN_A to CAN_C and Its pin number in original example code,but the new code doesn't run.Anybody can help me?
Here is the original code named CAN_A,the new code named CAN_C.
Hi,
the code looks normal. Open drain config for TX pin is not needed, but it depends on used PHY circuitry.
What does not work in fact? Do you see eny errors (check ESR, ECR registers)?
What is the other node on the bus?
BR, Petr
Thanks,Petr.
When I debug the new code CAN_C,the code loops at a certain location(from PC 00001000 to PC 0000203A) and cannot execute the application layer code,as the pictures show.
I only changed the channel from CAN_A to CAN_C,can you give some suggestions about it?
Thanks,Petr.
Hi,
I see, the CAN_C contains just 32MBs while CAN_A 64 MBs.
So on CAN_C the memory area corresponding to MBs 32–63 and Rx Individual Filters 32–63 are considered
reserved space, and you should not access it.
Modify your code to access just first 32MBs.
BR, Petr
Hi,
Thanks,Petr.I modify the part of MB initialization,and it worked.The code can transmit messege well,but it can not recive messege .I checked the Error and Status Register(CAN_ESR) ,I checked the value of each registers are showed in picture when it failed to recive messege.
I tried to set ERRMSK,RERNMSK,TWRNMSK in CAN_CR ,and WRNEN in CAN_MCR,Transmition can not funtion well,either.How can I solve this problem?
BR Justin
Hi,
it shows you got Bus off error. The reason could be wrong pin setting, incorrect bit timing, wrong transceiver or bus termination.
To check pin setting just disconnect transceiver and short TX/RX line. Do not use open drain config on TX line.
Send message, it should be repeated still and ACK error is detected.
Petr