ESP32 S3 CANIO Support
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- aw333
- Posts: 1
- Joined: Tue Jul 05, 2022 11:43 am
ESP32 S3 CANIO Support
I have been working with a variety of S3 and C3 boards, including the tinyS3, ESP32-S3-DevKitM-1-N8, and the Adafruit QT Py ESP32C3, all of which say to have canio built in and supported. When attempting to use canio on all of these boards there was no signal being sent from the tx and rx pins. I was successful in using canio with the feather m4 can board. I was wondering if canio works with S3 boards, or if a can transceiver is needed to even detect any sort of signal being sent.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: ESP32 S3 CANIO Support
We've never tried using an ESP32 for CAN, but you probably will need an external transceiver.
When microcontroller datasheets say 'CAN support', it means 'understands the message protocol' but not 'can be wired directly to the bus'.
When microcontroller datasheets say 'CAN support', it means 'understands the message protocol' but not 'can be wired directly to the bus'.
- jepler1
- Posts: 50
- Joined: Mon Oct 28, 2013 4:16 pm
Re: ESP32 S3 CANIO Support
In my work for Adafruit, I implemented canio and tested it on several ESP32-S2-based boards with external transceivers. However, I have never tested it on ESP32-S3 or other ESP-family microcontrollers. It is possible that, although the very same core code compiles for these other related microcontrollers, it doesn't in fact work at all.
As noted in another reply, an external transceiver is needed. Due to the structure & design of the CAN bus, a missing transceiver will be detected by the CAN peripheral as a non-working bus. If this is happening, then it should be reflected in the bus's "state" property. Finally, setting the "loopback" flag when constructing the bus object SHOULD instruct the peripheral to operate without paying attention to the signals coming back from the external transceiver, so it won't enter an error state even if there's no working bus transceiver connected. (however, in this state it also can't receive messages from other devices on a bus)
If it's within your abilities, I recommend trying a non-CircuitPython CAN bus program on your Espressif boards. This will help clarify whether it's a problem with CircuitPython or a problem with the physical bus. (Note that Espressif always refers to this kind of bus as TWAI for "two-wire automotive interface"). Try starting here for an esp-idf example that is specifically called out as working on ESP32-S3: https://github.com/espressif/esp-idf/bl ... /README.md
As noted in another reply, an external transceiver is needed. Due to the structure & design of the CAN bus, a missing transceiver will be detected by the CAN peripheral as a non-working bus. If this is happening, then it should be reflected in the bus's "state" property. Finally, setting the "loopback" flag when constructing the bus object SHOULD instruct the peripheral to operate without paying attention to the signals coming back from the external transceiver, so it won't enter an error state even if there's no working bus transceiver connected. (however, in this state it also can't receive messages from other devices on a bus)
If it's within your abilities, I recommend trying a non-CircuitPython CAN bus program on your Espressif boards. This will help clarify whether it's a problem with CircuitPython or a problem with the physical bus. (Note that Espressif always refers to this kind of bus as TWAI for "two-wire automotive interface"). Try starting here for an esp-idf example that is specifically called out as working on ESP32-S3: https://github.com/espressif/esp-idf/bl ... /README.md
Please be positive and constructive with your questions and comments.