Reputation: 1
I am working on a CAN bus protocol with ESP32. I am using a library (https://github.com/sandeepmistry/arduino-CAN) in here. Also, I am using MCP2551 as a CAN transceiver so I can communicate with two ESP32 successfully. But when I connect a CAN bus analyzer on the CAN bus line, the ESP32 program breaks and it doesn't work. Moreover, when I send a message with STM32 board on the line, ESP32 does not receive the message. I think there is a problem about bit timing. The sample point is not 70%-80% so it doesn't work with another CAN bus node, but I don't know how to configure this setting in the library. What should I do?
My system is the receiver is ESP32, transmitter is CAN bus analyzer. ESP32 does not receive any message from analyzer or any device but it can communicate another ESP32 successfully.
Upvotes: 0
Views: 559
Reputation: 214495
Misc advice:
CAN bus analyzers are often set in passive mode where they don't ACK any incoming messages. That will not work if there is only one other node on the bus, the ESP32. In that case you either have to set the CAN analyzer to active so that it sends ACK, or add an additional node to the bus.
Which baudrate are you using and what do you see on the bus? Are there error frames? That is, sequences of 6 high or low bits with the expected baudrate. For example at 250kbps you will see pulses of 1/250k * 6 = 24us if there are error frames. Perhaps needless to say, an oscilloscope is mandatory equipment when working with embedded systems.
Apart from having the correct baudrate, bit timing and sample points could mess things up if you are using exotic settings. For most baudrates the recommended sample point is at 87.5% of a bit length. I don't understand what you mean with "the sample point is not 70%-80%"... well, what is it then, and how do you know that if you don't know how to configure the library?
Upvotes: 0