Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Problems with the library ACAN-ESP32.cpp for ESP32-S3 #13

Open
Kether180 opened this issue Mar 12, 2024 · 2 comments
Open

Problems with the library ACAN-ESP32.cpp for ESP32-S3 #13

Kether180 opened this issue Mar 12, 2024 · 2 comments

Comments

@Kether180
Copy link

I' having some issues trying to use the CAN library with my ESP32-S3. When I run the ino file it gives me these errors .

new bugs : C:\Users\gag_a\Documents\Arduino\libraries\ACAN_ESP32\src\ACAN_ESP32.cpp: In member function 'uint32_t ACAN_ESP32::begin(const ACAN_ESP32_Settings&, const ACAN_ESP32_Filter&)':
C:\Users\gag_a\Documents\Arduino\libraries\ACAN_ESP32\src\ACAN_ESP32.cpp:149:25: error: 'PERIPH_TWAI_MODULE' was not declared in this scope
periph_module_enable (PERIPH_TWAI_MODULE) ;
^~~~~~~~~~~~~~~~~~
C:\Users\gag_a\Documents\Arduino\libraries\ACAN_ESP32\src\ACAN_ESP32.cpp:149:3: error: 'periph_module_enable' was not declared in this scope
periph_module_enable (PERIPH_TWAI_MODULE) ;
^~~~~~~~~~~~~~~~~~~~
C:\Users\gag_a\Documents\Arduino\libraries\ACAN_ESP32\src\ACAN_ESP32.cpp:149:3: note: suggested alternative: 'dhcps_router_enabled'
periph_module_enable (PERIPH_TWAI_MODULE) ;
^~~~~~~~~~~~~~~~~~~~
dhcps_router_enabled
C:\Users\gag_a\Documents\Arduino\libraries\ACAN_ESP32\src\ACAN_ESP32.cpp:205:19: error: 'ETS_TWAI_INTR_SOURCE' was not declared in this scope
esp_intr_alloc (ETS_TWAI_INTR_SOURCE, 0, isr, this, & mInterruptHandler) ;
^~~~~~~~~~~~~~~~~~~~
C:\Users\gag_a\Documents\Arduino\libraries\ACAN_ESP32\src\ACAN_ESP32.cpp:205:19: note: suggested alternative: 'ETS_INTERNAL_SW0_INTR_SOURCE'
esp_intr_alloc (ETS_TWAI_INTR_SOURCE, 0, isr, this, & mInterruptHandler) ;
^~~~~~~~~~~~~~~~~~~~
ETS_INTERNAL_SW0_INTR_SOURCE

exit status 1
Compilation error: exit status 1

I tried to edit the downloaded library as a momentary fix but I was wondering if you have a long term fix solution .
These are the lines I had to commented so that the library could work ACAN-ESP32.cpp .

**// periph_module_enable(PERIPH_TWAI_MODULE);

// esp_intr_alloc(ETS_TWAI_INTR_SOURCE, 0, isr, this, &mInterruptHandler);**

Let me know if you have an updated solution that I can use.

Thanks

@Kether180
Copy link
Author

I can't run it with these 3 and I already checked your last updated and it is the one which Iam having troubles with, it seems they are not compatible with ESP32-S3

**periph_module_enable(PERIPH_TWAI_MODULE);

esp_intr_alloc(ETS_TWAI_INTR_SOURCE, 0, isr, this, &mInterruptHandler);**

#include <esp_private/periph_ctrl.h> .****

@Modellfan
Copy link
Contributor

This is not compatible anymore, because ESP32 S3 is using another version of the TWAI library:
#include "driver/twai.h"

I started to migrate to the new library, but for now just moved to another lib. This can be used as reference implementation:

https://github.com/handmade0octopus/ESP32-TWAI-CAN/tree/master
https://github.com/collin80/esp32_can

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants