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.. 🙁