Hello NXP Community,
I am trying to implement CAN communication on MPC5775E. My Transmite and Receive functions are as follows. While debugging, I see that it is stuck in the while loop inside the TransmitMsg function.
while ( CAN_A.IFLAG1.B.BUF31TO8I == 0) { } // wait until the tx is completed.
Could you pelase help me how to solve these problems?
Best Regards,
Berfin.
Hello @PetrS @martin_kovar,
I have studied your examples on this subject, but I could not solve these problems. Could you please help me?
Best Regards.
Hi,
this while statement is checking if MB flag is set, that is, if message is successfully transmitted without error.
So check that, if any error is detected (ESR1, ECR registers), check MB CODE field.
Do you have node (MPC5775E with active CAN transceiver) connected to any other node and bus properly terminated?
BR, Petr
Hello,
I expect CAN communication to occur between the computer and the evaluation board. There is no other node in between and bus properly terminated.
Best Regards
Hi,
ESR1 cannot be zero if module is in Normal mode. At that case at least SYNC and IDLE bits should be set for free bus. So either you are not in normal mode or for example pins are not properly set. Check the MCR as well, if FZRACK and NOTRDY indicate normal mode, then you can try to disconnect TX/RX pins from transceiver and connect it together, to test pin setting. Send a message and you should get ACK error with TX error counter at 0x80 value. If this is true connect transceiver back and do the same with disconnecting from bus. You should get the same behavior as above.
BR, Petr
Hello Petr,
Thank you so much for your help and interest. ESR1 and ECR registers are zero.
MB Registers are as below. It seems to be true
Best Regards