arduino-CAN icon indicating copy to clipboard operation
arduino-CAN copied to clipboard

[ESP32] Sender gets stuck if the receiver is powered down

Open thalesmaoa opened this issue 2 years ago • 5 comments

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.

thalesmaoa avatar May 30 '23 16:05 thalesmaoa

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:

  1. For local diagnostic only, add some `Serial.print("xyz = "); Serial.println(xyz);" lines to see what's going on inside the code
  2. Carefully read the datasheet
  3. Compare what the datasheet says vs what the code does vs what values you observe I found many semi-obvious mistakes in MCP2515.cpp this 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.

timurrrr avatar May 31 '23 06:05 timurrrr

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?

MagnusThome avatar May 31 '23 07:05 MagnusThome

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

thalesmaoa avatar May 31 '23 22:05 thalesmaoa

Similar issue here. Did you find any other library that works?

virgilm avatar Jun 24 '23 04:06 virgilm

https://github.com/pierremolinaro/acan-esp32

However, I haven't tested it as I wanted.

thalesmaoa avatar Jun 24 '23 19:06 thalesmaoa