← index #5087PR #9532
Likely Duplicate · medium · value 0.363
QUERY · ISSUE

[ESP32] CAN bus and MOD bus master RTU.

openby beyonloopened 2019-09-09updated 2024-10-01
enhancementport-esp32

Hello.

  1. Are there support or plans to support CAN bus on ESP32? I see that there are a implementation for pyboard https://docs.micropython.org/en/latest/library/pyb.CAN.html - is that a similar implementation on the ESP32?

  2. And about the MOD bus master RTU on micropython?
    I think that, differently of CAN bus, MOD bus implementation is not a microcontroller dependent, just works over UART, is that correct?
    I not found a implementation for the modbus master RTU in micropython libs and so on, anyone know if are there a third lib for that?

Thank you so much.

CANDIDATE · PULL REQUEST

ports/esp32: CAN(TWAI) driver

closedby FeroxTLopened 2022-10-06updated 2023-09-05
port-esp32

Implemented CAN bus for esp32 controller.

This is based on https://github.com/micropython/micropython/pull/7381 and ports/stm32/pyb_can.c.

All TODOs were implemented and tested using both real devices and programming tests (loopback mode).

APIs between this two implementations (esp32 CAN and stm32 CAN) are made as close as possible.

Some misunderstandings:

  • Tests on real esp32 works only if Rx and Tx pins for CAN bus connected together (as pointed in docs for LOOPBACK_SILENT mode). I didn't find any examples of similar behaviour in another tests
  • The speed of CAN bus should be divided by two in NORMAL mode. So if you have 100k CAN bus the baudrate should be 50000. I think it is a bug in esp-idf -- esp-idf's arduino port works in the same way (should also divide boudrate by two)

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied