Skip to content
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

TWAI/CAN and chip version - wroom-32 vs wroom-32E aka V3 #7723

Closed
1 task done
handmade0octopus opened this issue Jan 16, 2023 · 2 comments
Closed
1 task done

TWAI/CAN and chip version - wroom-32 vs wroom-32E aka V3 #7723

handmade0octopus opened this issue Jan 16, 2023 · 2 comments
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@handmade0octopus
Copy link

handmade0octopus commented Jan 16, 2023

Board

Not board specific

Device Description

Noticed issue between two types of wroom-32U and wroom-32UE - the UE one apparently being version V3 https://www.espressif.com/en/news/ESP32_FIA_Analysis

Hardware Configuration

Tested on 3x different boards, tried swapping transreceivers (SN65HVD231 and SN65HVD230), seems to be common culprit among all of them.

Version

platformio one

IDE Name

PlatformIO 5.2.0

Operating System

Windows 10

Flash frequency

80

PSRAM enabled

no

Upload speed

921600

Description

Ok so basically I am using this CAN library

Everything worked fine untill I got new boards with 32UE (extra E) which seems to be version V3. I read it requires new build setting in idf for it to work, there were some changes to IDF TWAI but not sure what.

Anyway tested with oscilloscope, on CAN, with 120 terminal resistor. Culprit is the same - 32U version works with same flash, none of my 32UE boards work with that.

I though its trans receiver but after swapping it - it's the same, only 32U version works.

Is there any quick-dirty workaround for this issue?

Thanks.

Sketch

Not sketch specific but library uses which I hope didn't change in new version?

#define MODULE_CAN   ((volatile CAN_Module_t    *)0x3ff6b000)

Debug Message

None

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@handmade0octopus handmade0octopus added the Status: Awaiting triage Issue is waiting for triage label Jan 16, 2023
@igrr
Copy link
Member

igrr commented Jan 16, 2023

There is an open feature request for the library you are using to support ESP32 revision 3: ThomasBarth/ESP32-CAN-Driver#28.

You can try to implement that feature yourself, referring to this commit of the IDF CAN driver: espressif/esp-idf@820fd64

Alternatively, you can use IDF APIs described here: https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/peripherals/twai.html — they already work on ESP32 revision 3.

@handmade0octopus
Copy link
Author

handmade0octopus commented Jan 16, 2023

Thank you!

@igrr any idea how to get revision 3 specified in #defines for IDF api?

For this library fix is very simple, in CAN_init() you just need to add single line after this:

    //enable all interrupts
    MODULE_CAN->IER.U = 0xff;
    MODULE_CAN->IER.B.WUIE = 0; // add this line
    

You are golden bro!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

2 participants