This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Tiva CAN bus error with error code 0xE5

Hi all,

I have just started with CAN protocol. I am trying to make the example from the website below working. The example uses MCP2551 to be the can interface IC.

The problem with me is that the Can bus error occur with error code 0xE5 from the sender and nothing happend in the receiver? I checked that the connection on my test board is right. So what is the problem here? Please help me. Thank you!

  • Hello Tuan,

    Unfortunately, I cannot browse to the site you provided the link to as it is not recognized by our TI security and is therefore listed as a potential threat. Can you provide more detail such as the meaning of an error code 0xE5 on your transmitting system? Is there additional information you can offer regarding your setup? i.e., what is the sender? What baud rate are you using? What TM4C device/board are you using? Can you share your schematic of your test setup? Is there any need for level shifting between the CAN transceiver and the TM4C that is accounted for?

    Also, please make sure you have the proper termination resistors in place as well as the use of twisted pair cabling. Finally, also be certain that message masks are properly configured in your TM4C code so that messages being send that are intended for the TM4C can be received and are not rejected due to wrong CAN Msg ID.
  • @Chuck Davenport: Thanks for your reply. The reason for the error is bus off state and a bit stuffing error. I use TM4C1294 as the master for sending message and TM4C123 as the slave for receiving message. The CAN interface IC MCP2551 is used and there isn't any level shifting. My message ID mask is 0.

    I also have a question: how can I get the an appropriate value for the termination resistor?
  • The value of the termination resistor is defined by the CAN standard. It is typically a 120 Ohm resistor between CANH and CANL.

    For starters, I would suggest to try to use the CAN in a loopback mode to make sure your code is working properly and all IOs are configured as they should be. This should be done on each end (TM4C129, and TM4C123 boards). Once you have confirmed that the CAN code is working as expected, then introduce the transceivers on each of the boards to complete the network insuring both boards are setup with the same network settings. Note that there many threads on this forum covering CAN programming (mostly it is recommended to use the simpleTx and simpleRX can examples that come with TivaWare) so you should be able to find a lot of support in developing your code using the search bar above, but, as always, if you run into road blocks, we can provide some direction. In addition, there are quite a few posts on using the MCP2551 and I believe there are some issues with the voltage levels that have been identified when using it with TM4C129 CANRx since TM4C129 CANRx is not 5V tolerant. This isn't an issue on the TM4C123 as it has 5V tolerant IO.

    Finally, if you are trying to replicate the results of the link you provided earlier, I would also suggest you see if you can get them to provide some guidance as they have already completed the task. They may be able to provide some additional information that would help isolate the problem you are seeing. (Like did they use 2 TM4C123 boards or a combination such as you are attempting).
  • @Chuck Davenport: Thank you very much for helping me. My problem is that I use wrong resistor value for Rs pin in MCP2551. It should be in range of 10k Ohm to 300k Ohm for slope control. My issue is solved. Now I will go further: add another node to my CAN bus system and I have some more questions:
    1/ Does the field "ui32MsgID" from the struct "tCANMsgObject" represent for the identifier (11bits for standard or 29 bits for extend)?
    2/ How a CAN node can distinguish that it is receving a message with 11-bit or 29-bit message ID?

    I am using API form tivaware in my code.
  • Hello Tuan,

    I am glad you were able to identify the issue with your transceiver and that you are able to send and receive messages now. In regard to your follow up questions:

    Tuan Hua said:
    1/ Does the field "ui32MsgID" from the struct "tCANMsgObject" represent for the identifier (11bits for standard or 29 bits for extend)?

    Yes. This is the message ID of the message in the specific message mailbox you are reading from.

    Tuan Hua said:
    2/ How a CAN node can distinguish that it is receving a message with 11-bit or 29-bit message ID?

    Generally speaking this is configured on a message object by message object basis using the CANMessageSet API. The driverlib user guide describes configuring the ID extended mode as follows:

    "If the CAN network is only using extended (20-bit) identifiers, then the MSG_OBJ_EXTENDED_ID flag should be specified. The CANMessageSet() function forces this flag to be set if the length of the identifier is greater than an 11-bit identifier can hold"

    For reference, the TM4C DriverLib user guide is located here: