Hi , I started one transmission of MSCAN using the code as follows. However, the program is always running in the code"while ( (CAN1TFLG & txbuffer) != txbuffer);". And can not jump out. I checked the registers, and the CAN1TFLG=0b00000110. Which means TX0 buffer in not empty after I start one transmission. What is the problem?
___________________________________________________________________________
......
CAN1TBSEL = CAN1TFLG; /* Select lowest empty buffer */
txbuffer = CAN1TBSEL; /* Backup selected buffer */
......
CAN1TFLG = txbuffer; /* Start transmission */
while ( (CAN1TFLG & txbuffer) != txbuffer); /* Wait for Transmission* completion*/
_________________________________________________________________________
I guess that message from TX0 buffer cannot be delivered.
It means that MSCAN module try send this message again and again, but module didn’t receive any acknowledge from any other CAN node.
Note: this typically means cumulative increasing of MSCAN transmit error counter. Transmitter could continue in repeated sending until error counter(s) achieve dedicated level (bus-off).
Please check:
When CAN module receives acknowledge, transmit buffer is released automatically.
Hi Radek,
Thank you very much for your quick and nice reply.
The codes run well now. I have a better unstanding of the transmission mechnism of CAN bus with your nice help. In fact, the problem lies in the isolation chip ISO 7221, which blocks the route of receiving message from CAN bus:smileylaugh: