arduino-CAN
arduino-CAN copied to clipboard
[ESP32] Sender gets stuck if the receiver is powered down
Hi @timurrrr, I came here as suggested by jojo-A. In fact, https://github.com/sandeepmistry/arduino-CAN/issues/116 seems dead. I have an issue with the repo. Probably you have suggestion on how to fix or debug it.
Using sender and receiver examples everything works. However, If I cut the power from receiver, sender get stuck. If I energize it again, no more packages are sent.
It seems that it get stucked at https://github.com/timurrrr/arduino-CAN/blob/9d0be8ab01b6f2a21a10483914c48663fe4faf3a/src/ESP32SJA1000.cpp#L207
Since it is handling registers, I'm not sure how to fix it.
Hi @thalesmaoa, thanks for reporting the issue in a way that should make it easy for me to reproduce. I personally haven't done much with ESP32 yet, but was thinking about doing a project with it this summer. If I get to it, that's definitely something I'd want to look into. Can't promise anything yet though.
When I had a similar issue with MCP2515, what I did was:
- For local diagnostic only, add some `Serial.print("xyz = "); Serial.println(xyz);" lines to see what's going on inside the code
- Carefully read the datasheet
- Compare what the datasheet says vs what the code does vs what values you observe
I found many semi-obvious mistakes in
MCP2515.cppthis way...
Will be happy to review a pull request if you find a solution yourself!
Tagging @magnusthome and @jawillis in case either of them experienced anything similar, and figured out a workaround.
AFAIK and I might be wrong, but if a sender expecting acks doesn't see any response from the bus in a certain time frame (like 10-15 seconds, not sure exactly) it will presume there is something wrong with the bus and set itself in a bus error state. Again, don't trust me on this, it was quite a long time since I read the specs. But worth checking up?
I used a JTAG to check the problem. It get stuck in the loop. I will deep dive into the datasheet to check it. Mean while, I will also check https://github.com/pierremolinaro/acan-esp32 . Thanks
Similar issue here. Did you find any other library that works?
https://github.com/pierremolinaro/acan-esp32
However, I haven't tested it as I wanted.