Electronic – Why won’t the CAN transceiver receive messages unless there is a long startup delay or a bus analyzer connected


I am using a 16-bit MCU, PIC24HJ64GP504, to write a CAN based application. Basically it is communication between my board and one another node which continuously keeps on sending data to my board using CAN at 1 Mbit/s. I am configuring the ECAN module in my PIC24 to work at 1 Mbit/s. I have written the code in such a way that for the first 10 ms the ECAN module will accept all messages coming in from the other side, and after that I have re-configured the ECAN module to accept only those messages with message ID 0x13.

Now here comes the issue.. The other node and my board are powered up at the same instant. The other node starts transmitting messages after 40 ms or so after powerup. But I am not able to get any message from it on my board. Now if I power up my board first, give it some time to reconfigure the ECAN module with new filters and settle down and then power up the other node, then everything works perfectly.

Now the strangest part.. If I have a CAN bus analyzer connected between my board and the other node and even if I power up both the nodes at the same time, everything works fine…no need to power up my board first. I have tried this with three different bus analyzers from different manufacturers and got the same results.

To me it appears that during re-configuration of the ECAN module, it takes some time to settle down. And with the introduction of the bus analyzer in the bus, this time is somehow cut short so that everything works perfectly. But I am not sure what exactly the problem might be.

I have been struggling with this issue for the past seven days.

PS: Today I checked with a scope and found out that if the other node starts transmitting after 170 ms after powerup, then the whole thing works fine. Before that, my device won't receive any messages from it unless the bus analyzer is connected. The worst part is I can't delay the transmission of the other node, the firmware of that node is proprietary.

Also I read in a forum today that CAN needs the 120 Ω resistor at the node to make it working (even though my node does not have one and it works fine, provided given some time to settle after reconfiguration). I suspect the introduction of the bus analyzer somehow changes some network's electrical parameters such that the time taken by my node to settle after reconfiguration is cut short. But I am not sure.. 🙁

Best Answer

You "read on a forum" somewhere that the CAN bus needs resistors? Seriously!!?

This is a integral part of your design. If you are going to use CAN, you need to understand it, which means reading the relevant documentation.

Spearson is right but for the wrong reason. A differential CAN bus as you likely have (you didn't say what interface chip you are using, but probably you have a standard differential CAN bus as driven by something like a MCP2551 at each node) requires a resistance between the lines. This is because the recessive state is signalled by the two lines passively pulled together, and the dominant state by them being actively pulled apart. The resistors between the lines in that sense are the equivalent of a pullup resistor on a open collector line. Without something pulling the lines together when nothing is driving the bus, the bus doesn't work.

The resistors also function as terminators as spearson pointed out. You generally use twisted pair for the two bus lines. This has a impedance of around 120 Ω. This type of differential CAN bus is defined to have 60 Ω between the lines as a pull-together so that it can be implemented with 120 Ω at each to terminate the bus and avoid reflections.