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.

CAN loopback not working after some time



I am not using internal loopback. I am using simple canTransmit and canRecive functions. , My communication flow is described below

                      Gateway ---------------------------ECU(Hercules)

                      CAN Tx-------------------->------CAN Rx

Console<--------CANRx--------------<-------------CAN Tx

  • After receiving data in (ECU)hercules, I am transmitting data back to Gateway. But after a certain time, I see no data in the console. 
  • I could see that both Gateway and ECU microcontrollers are waiting in while loop to check for read data in debug mode.
  • How can I solve this issue?? Is it because of overload? 

  • Are you using CAN transceivers? Can you see the signal on CANH and CANL out of the transceivers and do you see that the ECU responds with an acknowledge bit to the first message from the Gateway?

  • The gateway board comes with transcievers. I could see the CANH and CANL signals in CRO. However, I am unable to recognize the acknowledge bit for the first message from gateway.

    In fact, I have verified the received messages from ECU and it is correct.

    Don't know why both the ECU and gateway wait in while loop for checking new rx data from each other.

  • Sorry, I don't have enough information to answer your question. If I understand correctly, the Gateway sends a message to the ECU, then the ECU sends a message back to the Gateway. You have verified that message received by the Gateway is correct. That implies no hardware problem. Am I understanding correctly? If you are worried about overflow, you can look at the CAN bus with a scope and verify there is idle time on the bus, that the CAN messages are no continuous. If the ECU receives a new message that matches the mailbox message identifier, the previous message will be overwritten. However, unless the CPU is overburdened doing other tasks, the CPU should be able to respond to CAN interrupts and read the received message before another message can come in.
  • Yes, your understanding is correct. This communication is in while loop. Currently I am using polling mechanism. I tried to use Interrupt while recieving in ECU(Hercules). But somehow Disable_Interrupts() doesn't seems to be working.

    CPU is not overburdened as this is the only task which is carried out.

  • Then this appears to be a software debugging issue. If you have verified that the Gateway received a proper message from the ECU, can you verify that the Gateway then sent the next message to the ECU?
  • Yes, I have verified and it is correct. Since I am printing in the console, I can see the data.

    But after a while, suddenly it stops printing. In debug mode both the CAN modules in gateway and ECU are waiting for new RX data.

  • Can you narrow down the failure more? Do you think that the ECU is not capturing a message from the Gateway? If so, have you properly setup the acceptance mask?
  • Initially, ECU captures the messages and I have verified the messages. And after some time, it does not receive. I suspect either synchronisation or overloading issues in the CAN bus.