I am using TJA1145. I configure it and put it in Normal mode. CAN TX and RX both work at nominal bitrate (say 500kbps).
The problem appears when I change the baudrate on the bus (for example, one device starts sending frames at 125kbps or 250kbps). Sometimes the TJA1145 still works after the bitrate comes back to 500kbps, but sometimes it just stops working completely (it does not receive any frames nor send any frames), but my code goes on. The same behavior appears when I introduce bad terminating resistance on the bus - the transceiver stops operating completely until power is reset.
I tried to determine the cause for this by reading the registers via SPI, but the transceiver doesn't show any signs of error. The registers state that everything is ok, TJA is in Normal mode and it is ready to transmit/receive frames (but in reality it's just frozen). This makes it impossible for the MCU to spot this error and reset the transceiver when needed. Enabling/disabling "error detection" functions of the TJA1145 doesn't seem to provide any information neither.
In my project I can't allow for this kind of behavior. I need the transceiver to keep sending and receiving frames after an error is resolved on the bus, and not to just freeze. I don't know how else I can troubleshoot this error. Has anybody been able to avoid this kind of behavior?
Hi Bartosz,
The issue you are encountering could be due to several factors related to error handling, recovery and the configuration of the device. A few suggestions and troubleshooting steps to help resolve the problem.
Error Counters:
Check the error counters in the CAN controller (not just the TJA1145). High error counts can indicate issues that need to be addressed, such as error frames caused by incorrect bitrates or termination.
Reset Mechanism:
Software Reset: Implement a mechanism to reset the TJA1145 transceiver from the MCU when such a freeze is detected. Since the transceiver registers show everything as normal, this might involve detecting the lack of CAN frame transmission or reception for a certain period.
Watchdog Timer: Use a watchdog timer to periodically reset the transceiver if no CAN activity is detected for a predefined duration.
Configuration Settings:
Automatic Recovery: Ensure that automatic bus-off recovery is enabled in your CAN controller configuration. This will allow the controller to attempt to re-enter normal operation after a bus-off condition.
Bit Timing Configuration: Double-check the bit timing configuration of your CAN controller to ensure it matches the requirements of the TJA1145 and your network. Incorrect configurations can lead to synchronization issues.
Power Supply and Grounding:
Ensure that the power supply to the TJA1145 is stable and that there is proper grounding. Power supply issues can sometimes cause unexpected behavior in transceivers.
CAN Bus Quality:
Ensure the physical layer of the CAN bus is properly implemented. This includes proper termination, correct cabling and avoiding long stubs. Poor physical layer implementation can lead to communication issues.
Isolation of Problem:
Try isolating the problem by simplifying the CAN network. Use only two nodes (the MCU with TJA1145 and one other device) and test if the problem persists. Gradually add devices back to identify if any specific device is causing the issue.
Diagnostic Tools:
Use a CAN analyzer tool to monitor the CAN bus traffic and identify any anomalies when the issue occurs. This can provide insights into whether there are specific error frames or patterns that lead to the transceiver freeze.
Hope it helps.
BR, Tomas