-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ESP32 S2 mini Lolin / Wemos car canbus #8199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please set the Log output to Verbose and run the application. You can report here the serial console output. |
The documentation about TWAI for IDF 4.4 (used with Arduino Core 4.4) is here: |
There is information about TWAI peripheral in the S2 TRM in the chapter 29: |
A few projects that use Canbus with ESP32... it may help. https://github.com/MagnusThome/RejsaCAN-ESP32 Related issues: |
I don't have such hardware... sorry for not helping further. |
Hi SuGlider |
This is the case with your mentioned issue #3921 |
if you run the TWAI example, does it output CAN frames to Serial? Or what does it output? You will have to change the Bitrate to fit: (i made this example and here is my working setup with a SN65HVD230 : #7430 (comment) |
any updates @Strangistra? |
/Hello everyone. I will come back to give you news of my investigations concerning this subject. I then made the following connection: I defined the RX and TX pins in the "pins_arduino.h" file located in the following path C:\Users\XXXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\variants\lolin_s2_mini
I then downloaded the original code of the ESP32 from canbus namely the example "ESP32 TWAI receive example" available in the ESP32 examples:
After testing the code on the car... miraculously I received the frames from the canbus. Conclusion : the configuration of the outputs of the RX and TX pins works well on the ESP32 S2 mini Lolin board See you soon for new experiences |
Board
ESP32 S2 mini Lolin / Wemos
Device Description
A mini wifi cards based on ESP32-S2FN4R2.

Hardware Configuration
In order to recover the canbus signal with an ESP32, it is advisable to use a transceiver of the type SN65HVD230 Can Board Connecting MCUs 1 to be placed at the level of the TX and RX pins of the board
Version
v2.0.8
IDE Name
IDE Arduino
Operating System
Windows 10
Flash frequency
40
PSRAM enabled
yes
Upload speed
115200
Description
Good morning
I am trying to retrieve information from the comfort canbus in 125kbit from a car using an ESP32 LOLIN S2 MINI + SN65HVD230 transceiver
Here is what I have already done:
I managed to read data from the car and find the correct frame id from canbus which I should use in my code. But the problem is that I managed this with a CANBed board from Seeed Studio CAN bus development kit for Arduino (ATmega32U4 with MCP2515 and MCP2551)
This board is based on an ATmega32U4 with the Arduino Leonardo bootloader coupled to an MCP2515 CAN bus controller and MCP2551 CAN bus transceiver
I used this code to retrieve the AC information I needed and it works perfectly
In order to recover the canbus signal from the car, it is advisable to use a trancreicever of the SN65HVD230 Can Board Connecting MCUs type to be placed at the level of the TX and RX pins of the card
So I bought the necessary components and made this assembly:

I then loaded the code for ESP32 which allows to process the canbus signal renamed TWAI
It obviously didn't work
By putting a delay of 5000 ms at the start of void setup() I have the initialization messages which go up correctly:
--- Driver installed
--- Driver started
--- CAN Alerts reconfigured
Then I have the error message "Failed to receive message" which loops
I don't understand what is not working. I don't know if it's a software or hardware issue.
Sketch
Debug Message
Other Steps to Reproduce
I carried out other tests by now defining in input TX = 39 and RX = 37 as defined in my original code.
Here is the wiring used. Connecting the TX pin to the RX pin

Conclusion, it also works so the TX / RX serial link pins are well configurable.
Another remark noted, obviously the serial link does not work on the TX and RX pins if the baud exceeds 100,000. So with a baud of 115,200 it does not work.
Last observation, the definition of the RX / TX pins in the pins_arduino.h file does not change anything in this code. The definition of pins in the "SoftwareSerial" object takes precedence over the definition of pins in the pins_arduino.h file
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: