If your CAN bus is faulty, use this "CAN-Bus Troubleshooting Guide" with some tips on what to check and verify to find the fault or damaged device.
1) If you are developing a device and testing to send data to CAN, remember that your device must have a device that receives the data. The CAN frame contains an ACK bit, the sender of the message sends this bit in the recessive state, however the receivers " pull down" this bit to the dominant level and the sender checks this, i.e. sends the recessive and checks that it reads the dominant. So if your device sends a message and no one acknowledges it, an error occurs.
Similarly, if you have only one data receiver, you must not set it to listen only (CAN controller ) or silent mode (CAN transceiver). In this mode, the sender will also not receive an acknowledgement. By the way, this is a common mistake when connecting to an FMS gateway. Listen only mode is not set here for this reason, instead of connecting directly to, for example, a motor CAN.
2) Check that all devices on the CAN have the same speed. If you are developing them, it is possible to find various register setting calculators for bitrate on the internet. These registers not only set the bitrate, but also the position of the sample point. This is usually set at 75 to 87.5%. Multiple sampling is used at lower speeds where there is enough Tq. It is likely that for conventional CAN controllers at 1Mbit it will not be appropriate to set multiple sampling.
An excellent setup calculator is for example at http://www.bittiming.can-wiki.info/ .
4) Avoid star topology of CAN, topology should be continuous with maximum stub length up to 0.5 meters.
5) If you can, disable the communication between devices (but they are still on) and measure the voltage between CAN H and GND, as well as between CAN L and GND. If the voltage is less than about 2V, you can assume that one of the wires is broken.
This way you can check with a multimeter which wire is CAN H and which is CAN L, if you don't know the pinout and don't have an oscilloscope. The assumption is that there is some communication running on the CAN. For high speed CAN, you can measure a voltage between 2.5 and 3.5V on CAN H. In the case of CAN L, you measure a voltage between 1.5 and 2.5V. The actual values depend on the nature of the communication, especially the bus load.
Note that for 3V3 transceivers, they are slightly smaller at the dominant level and the voltage difference with respect to the recessive state is not symmetrical. The recessive state is 2.3V for 3V3 exciters.
6) On a switched off CAN device disconnected from CAN and without terminating resistor, measure the resistance between CAN H and GND and likewise between CAN L and GND. If the measured value is low, the transceiver is probably damaged. The measured value will be in the order of units to tens of mega ohms depending on the CAN bus used transceiver. If you do not measure anything, it does not mean a broken connection or other fault, only the multimeter may not be able to measure this value. Therefore, compare the value with another piece of the same device or measure the voltage level on the CAN wires after switching on the device, for example. It is also possible to measure the resistance between CAN H and CAN L in this off state, it should have a value in the order of tens of kilo ohms. A value of less than 10 kilo ohms may indicate damage to the CAN exciter.
7) If the CAN wiring is shielded, remember that the shielding is only connected on one side. If both ends are connected, current may flow through the wires causing inductive and capacitive coupling to transmit interference to the CAN wires.
8) Separate the CAN conductors spatially from the power conductors. Be careful especially of the coil connections between the power and CAN exciters.
9) In case of large EMI, a termination called Split Termination or Biased Split Termination can help instead of a conventional termination resistor.
10) If a device is not working, are you sure that it is not another version of CAN? For example, low speed, CAN has different signal levels.
11) Very sporadic errors on CAN can also cause high bus load. It is advisable to operate the CAN network at a load of max 60-70 percent. It's not that more data "won't fit", but that it may not be sent in time, other data gets priority and then an error is signaled because the receiver did not receive the data with the required period. Then it is necessary to switch to a higher communication speed, if for example the length of the CAN bus allows it, or for some data to reduce the data sending period so that the load decreases.
12) Before starting development, study the errata of the CAN controller used. For example, the MCP 2510 external controller has many errors and in particular the synchronization error that occurs when the CAN load is low is very annoying. Its partial elimination is possible with precision crystal units, but even so it is not completely eliminated.
13) Beware of the supplier, did he really deliver what he was supposed to? We happened to order TJA1055T transceivers. From an unnamed supplier the goods arrived, the marking on the bag was correct. However, the device did not work after assembly. At a first look, the exciter seemed to be correct. But it was a mistake, on the case we overlooked the marking "/3" at the end, it means that without pull up resistor the transceiver will not work.....
14) A customer purchased CAN devices from us a long time ago and operated them at 10kb speed. After a long time he ordered another one and it didn't work. Where is the fault? The new CAN transceivers contain a timeout function that prevents, for example, the MCU from sending a dominant level to the bus when it fails (freezes). See TJA1051 documentation:
7.2.1 TXD dominant time-out functionA 'TXD dominant time-out' timer is started when pin TXD is set LOW. If the LOW state on pin TXD persists for longer than tto(dom)TXD, the transmitter is disabled, releasing the bus lines to recessive state. This function prevents a hardware and/or software application failure from driving the bus lines to a permanent dominant state (blocking all network communications). The TXD dominant time-out timer is reset when pin TXD is set HIGH. The TXD dominant time-out time also defines the minimum possible bit rate of 20 kbit/s.
The problem was that the original device used the PCA82C250 transceiver X years ago, the newly manufactured one used the TJA1051. However, the original PCA82C250 controller could do no such thing, the 10kb rate worked fine.
PCA82C250 | TJA1051 |
15) If you use a low speed CAN bus (fault-tolerant CAN), the bus is able to work even if one of the CANH/CANL wires is broken or if there is a short circuit to ground or to the voltage (Vcc or battery). Since CAN then does not work differentially but as a single wire, it is more susceptible to interference. Transceivers are usually equipped with an ERR output to indicate this situation. It is advisable to monitor or check the status of this output.