Arduino-STM32-CAN icon indicating copy to clipboard operation
Arduino-STM32-CAN copied to clipboard

Unable to communicate STM32f103 vs ESP32 via CAN BUS

Open thangduc131199 opened this issue 1 year ago • 2 comments

I have 1 circuit STM32F103 Blue Pill and ESP32, 2 SN65HVD23x CAN Transceiver, I changed the resistor to 120 ohm -> 150 ohm but still cannot communicate via CAN bus. For STM32 I use the HAL library, and for ESP32 I use the CAN library https://github.com/sandeepmistry/arduino-CAN. Hope you can give me some suggestions to solve the problem. Thanks PXL_20231228_032903166

thangduc131199 avatar Dec 28 '23 03:12 thangduc131199

I had an unexpected discovery. When I set the Bitrate of ESP32 to 1000kbs and STM32 to 500kbs, the two circuits can communicate with each other via CAN bus. However, checking that there are still incorrect messages and the CAN controler sends them again (I sent the message at 10hz and only received it at 3hz).

thangduc131199 avatar Dec 28 '23 04:12 thangduc131199

In ESP32 whose chip version is Rev2 or higher, the role of register bits related to CAN communication has been changed to mean "halve the communication speed". This is to support slower bitrates below 25K. This fuature can be controlled by CONFIG_ESP32_REV_MIN. This fuature is enabled when CONFIG_ESP32_REV_MIN >= 2.

cpu_start-2

See below for details.

https://www.esp32.com/viewtopic.php?t=15581


I added a note about ESP32 bitrate to the README.

nopnop2002 avatar Dec 28 '23 05:12 nopnop2002