Using the ESP32 and the Can driver by Thomas Barth i have a little problem
Sometimes my ESP32 states that the CAN bus is off
When i try to esp_restart() and initialise the Can Driver again it says everything is alright but the ESP32 is not connected on my CAN-Bus
i can't write any frames or read frames from my other devices connected to the CAN-Bus
Is there a solution that if the ESP32 registers that the CAN bus is off, that a reset will take place and connect to the CAN-Bus again?
Regards,
Timon
Can Bus off
Re: Can Bus off
Hello,
I've used the driver since 3 month and it works well. No issues. No bus off at all. You should check for correct baudrate, CAN-Bus connections and all your other stuff.
Mark
I've used the driver since 3 month and it works well. No issues. No bus off at all. You should check for correct baudrate, CAN-Bus connections and all your other stuff.
Mark
Re: Can Bus off
Hi,
I'm facing similar problems with bus-off.
Only workaround I have found till now is to read TX error counter an if it exceed half of max value, then start CPU based bus-off recovery before it actually enter real bus-off.
In attachment there is my modified CAN.c - try it and let me know if it works for you.
I'm facing similar problems with bus-off.
Only workaround I have found till now is to read TX error counter an if it exceed half of max value, then start CPU based bus-off recovery before it actually enter real bus-off.
In attachment there is my modified CAN.c - try it and let me know if it works for you.
- Attachments
-
- CAN.c
- (8.62 KiB) Downloaded 1176 times
Re: Can Bus off
Thanks to this CAN.c modified and shared by Spintec (big thank you!), I moved 1 step forward.
At least now my CAN sniffer Win10 tool (PEAK CANsniffer USB compact) is able to writte to my ESP32:
- ESP32 + CJMCU-230 (SN65HVD230, 3.3v)
- 500kbit/s with Standard 11b
- 3 PDO's sent every 5000ms, 1000ms and 10ms => ESP32 reception is very stable.
- Michael Wagner CAN library ESP32CAN version 0.0.1 url=https://github.com/miwagner/ESP32-Arduino-CAN
- Original CAN.C is replaced by the modified one from Spintec
- (PlatformIO Visual Studio Code as programming tool. Wonderfull tool!!!)
But my CANsniffer does not receive what is sent by ESP32:
- CANerror detected by my CANsniffer
- BUSHEAVY detected. Bus error: one of the error counters of the CAN controller reached the "heavy" limit (at least 96 error points).
Possible causes: the hardware is not connected correctly to the CAN bus, or an incorrect bit rate was selected.
- Very stange, only 4 bytes are reveived and no CAN-ID !?!
ESP32 Serial Monitor: all PDO's are well received and it does send every 1000ms.
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on COM10 115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
129150ms PDO sent
130152ms PDO sent
131154ms PDO sent
131510ms New standard frame from 0x0000012B, DLC 8, Data 0x0F 0x00 0x03 0x84 0x00 0x00 0x00 0xFF ms
132155ms PDO sent
133157ms PDO sent
134159ms PDO sent
135161ms PDO sent
136163ms PDO sent
136510ms New standard frame from 0x0000012B, DLC 8, Data 0x0F 0x00 0x03 0x84 0x00 0x00 0x00 0xFF ms
137164ms PDO sent
138166ms PDO sent
139168ms PDO sent
140170ms PDO sent
141172ms PDO sent
141510ms New standard frame from 0x0000012B, DLC 8, Data 0x0F 0x00 0x03 0x84 0x00 0x00 0x00 0xFF ms
142173ms PDO sent
143175ms PDO sent
CAN sniffer log: Tx are all fine but very strange Rx with only 4 byte. But DLC is well entered with 8!
471) 598842.4 Error 0002 4 01 17 80 00
472) 598936.3 Warng FFFFFFFF 4 00 00 00 08 BUSHEAVY
473) 598976.3 Tx 0029 8 0F 00 0F 00 00 00 00 66
474) 599842.2 Warng FFFFFFFF 4 00 00 00 18 BUSHEAVY BUSOFF
475) 599842.3 Error 0002 4 01 18 80 00
476) 599842.3 Error 0002 4 01 17 80 00
477) 599842.5 Error 0002 4 01 17 80 00
478) 599842.7 Error 0002 4 01 17 80 00
479) 599843.0 Error 0002 4 01 17 80 00
480) 599843.3 Error 0002 4 01 17 80 00
481) 599843.5 Error 0002 4 01 17 80 00
482) 599843.8 Error 0002 4 01 17 80 00
483) 599844.0 Error 0002 4 01 17 80 00
484) 599844.3 Error 0002 4 01 17 80 00
485) 599844.5 Error 0002 4 01 17 80 00
486) 599844.8 Error 0002 4 01 17 80 00
487) 599977.1 Tx 0029 8 0F 00 0F 00 00 00 00 66
488) 599984.9 Warng FFFFFFFF 4 00 00 00 08 BUSHEAVY
489) 600844.1 Error 0002 4 01 18 80 00
490) 600844.3 Error 0002 4 01 17 80 00
491) 600844.5 Error 0002 4 01 17 80 00
492) 600844.8 Error 0002 4 01 17 80 00
493) 600845.0 Error 0002 4 01 17 80 00
494) 600845.3 Error 0002 4 01 17 80 00
495) 600845.5 Error 0002 4 01 17 80 00
496) 600845.8 Error 0002 4 01 17 80 00
497) 600846.0 Error 0002 4 01 17 80 00
498) 600846.3 Error 0002 4 01 17 80 00
499) 600846.6 Error 0002 4 01 17 80 00
500) 600846.8 Error 0002 4 01 17 80 00
501) 600976.6 Tx 0029 8 0F 00 0F 00 00 00 00 66
502) 601321.3 Tx 012B 8 0F 00 03 84 00 00 00 FF
503) 601845.1 Error 0002 4 01 18 09 00
504) 601845.1 Error 0008 4 01 13 09 00
505) 601845.2 Error 0002 4 01 18 12 00
506) 601845.3 Error 0008 4 01 13 12 00
507) 601845.4 Error 0002 4 01 18 1B 00
508) 601845.4 Error 0008 4 01 13 1B 00
509) 601845.5 Error 0002 4 01 18 24 00
510) 601845.7 Error 0002 4 01 18 2D 00
511) 601845.7 Error 0008 4 01 13 2D 00
512) 601845.8 Error 0002 4 01 18 36 00
513) 601845.8 Error 0008 4 01 13 36 00
514) 601846.0 Error 0002 4 01 18 3F 00
515) 601846.1 Error 0002 4 01 18 48 00
516) 601846.1 Error 0008 4 01 13 48 00
517) 601846.3 Error 0002 4 01 18 51 00
518) 601846.3 Error 0008 4 01 13 51 00
519) 601846.4 Error 0002 4 01 18 5A 00
520) 601846.6 Error 0002 4 01 18 63 00
521) 601846.6 Error 0008 4 01 13 63 00
522) 601846.7 Error 0002 4 01 18 64 00
523) 602081.9 Warng FFFFFFFF 4 00 00 00 08 BUSHEAVY
524) 602847.1 Error 0002 4 01 18 6D 00
525) 602847.1 Error 0008 4 01 13 6D 00
526) 602847.2 Error 0002 4 01 18 76 00
At least now my CAN sniffer Win10 tool (PEAK CANsniffer USB compact) is able to writte to my ESP32:
- ESP32 + CJMCU-230 (SN65HVD230, 3.3v)
- 500kbit/s with Standard 11b
- 3 PDO's sent every 5000ms, 1000ms and 10ms => ESP32 reception is very stable.
- Michael Wagner CAN library ESP32CAN version 0.0.1 url=https://github.com/miwagner/ESP32-Arduino-CAN
- Original CAN.C is replaced by the modified one from Spintec
- (PlatformIO Visual Studio Code as programming tool. Wonderfull tool!!!)
But my CANsniffer does not receive what is sent by ESP32:
- CANerror detected by my CANsniffer
- BUSHEAVY detected. Bus error: one of the error counters of the CAN controller reached the "heavy" limit (at least 96 error points).
Possible causes: the hardware is not connected correctly to the CAN bus, or an incorrect bit rate was selected.
- Very stange, only 4 bytes are reveived and no CAN-ID !?!
ESP32 Serial Monitor: all PDO's are well received and it does send every 1000ms.
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on COM10 115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
129150ms PDO sent
130152ms PDO sent
131154ms PDO sent
131510ms New standard frame from 0x0000012B, DLC 8, Data 0x0F 0x00 0x03 0x84 0x00 0x00 0x00 0xFF ms
132155ms PDO sent
133157ms PDO sent
134159ms PDO sent
135161ms PDO sent
136163ms PDO sent
136510ms New standard frame from 0x0000012B, DLC 8, Data 0x0F 0x00 0x03 0x84 0x00 0x00 0x00 0xFF ms
137164ms PDO sent
138166ms PDO sent
139168ms PDO sent
140170ms PDO sent
141172ms PDO sent
141510ms New standard frame from 0x0000012B, DLC 8, Data 0x0F 0x00 0x03 0x84 0x00 0x00 0x00 0xFF ms
142173ms PDO sent
143175ms PDO sent
CAN sniffer log: Tx are all fine but very strange Rx with only 4 byte. But DLC is well entered with 8!
471) 598842.4 Error 0002 4 01 17 80 00
472) 598936.3 Warng FFFFFFFF 4 00 00 00 08 BUSHEAVY
473) 598976.3 Tx 0029 8 0F 00 0F 00 00 00 00 66
474) 599842.2 Warng FFFFFFFF 4 00 00 00 18 BUSHEAVY BUSOFF
475) 599842.3 Error 0002 4 01 18 80 00
476) 599842.3 Error 0002 4 01 17 80 00
477) 599842.5 Error 0002 4 01 17 80 00
478) 599842.7 Error 0002 4 01 17 80 00
479) 599843.0 Error 0002 4 01 17 80 00
480) 599843.3 Error 0002 4 01 17 80 00
481) 599843.5 Error 0002 4 01 17 80 00
482) 599843.8 Error 0002 4 01 17 80 00
483) 599844.0 Error 0002 4 01 17 80 00
484) 599844.3 Error 0002 4 01 17 80 00
485) 599844.5 Error 0002 4 01 17 80 00
486) 599844.8 Error 0002 4 01 17 80 00
487) 599977.1 Tx 0029 8 0F 00 0F 00 00 00 00 66
488) 599984.9 Warng FFFFFFFF 4 00 00 00 08 BUSHEAVY
489) 600844.1 Error 0002 4 01 18 80 00
490) 600844.3 Error 0002 4 01 17 80 00
491) 600844.5 Error 0002 4 01 17 80 00
492) 600844.8 Error 0002 4 01 17 80 00
493) 600845.0 Error 0002 4 01 17 80 00
494) 600845.3 Error 0002 4 01 17 80 00
495) 600845.5 Error 0002 4 01 17 80 00
496) 600845.8 Error 0002 4 01 17 80 00
497) 600846.0 Error 0002 4 01 17 80 00
498) 600846.3 Error 0002 4 01 17 80 00
499) 600846.6 Error 0002 4 01 17 80 00
500) 600846.8 Error 0002 4 01 17 80 00
501) 600976.6 Tx 0029 8 0F 00 0F 00 00 00 00 66
502) 601321.3 Tx 012B 8 0F 00 03 84 00 00 00 FF
503) 601845.1 Error 0002 4 01 18 09 00
504) 601845.1 Error 0008 4 01 13 09 00
505) 601845.2 Error 0002 4 01 18 12 00
506) 601845.3 Error 0008 4 01 13 12 00
507) 601845.4 Error 0002 4 01 18 1B 00
508) 601845.4 Error 0008 4 01 13 1B 00
509) 601845.5 Error 0002 4 01 18 24 00
510) 601845.7 Error 0002 4 01 18 2D 00
511) 601845.7 Error 0008 4 01 13 2D 00
512) 601845.8 Error 0002 4 01 18 36 00
513) 601845.8 Error 0008 4 01 13 36 00
514) 601846.0 Error 0002 4 01 18 3F 00
515) 601846.1 Error 0002 4 01 18 48 00
516) 601846.1 Error 0008 4 01 13 48 00
517) 601846.3 Error 0002 4 01 18 51 00
518) 601846.3 Error 0008 4 01 13 51 00
519) 601846.4 Error 0002 4 01 18 5A 00
520) 601846.6 Error 0002 4 01 18 63 00
521) 601846.6 Error 0008 4 01 13 63 00
522) 601846.7 Error 0002 4 01 18 64 00
523) 602081.9 Warng FFFFFFFF 4 00 00 00 08 BUSHEAVY
524) 602847.1 Error 0002 4 01 18 6D 00
525) 602847.1 Error 0008 4 01 13 6D 00
526) 602847.2 Error 0002 4 01 18 76 00
Who is online
Users browsing this forum: No registered users and 407 guests