arduino-CAN icon indicating copy to clipboard operation
arduino-CAN copied to clipboard

Solved: Fatal Error: esp_intr.h: No such file or directory

Open onlyvinod56 opened this issue 1 year ago • 8 comments
trafficstars

Use ESP32 board ver 2.0.11 in board manager. (Espressif Systems)

espressif

onlyvinod56 avatar Aug 23 '24 06:08 onlyvinod56

Same, help pls

bluecraank avatar Sep 10 '24 17:09 bluecraank

It seems to be a bug in V3 I came back to the latest V2 V2.0.17 and it works fine

Merange avatar Sep 25 '24 09:09 Merange

#150 pull request should fix this problem in v3

avlasic avatar Sep 27 '24 08:09 avlasic

This article describes the file has been remove: https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32/migration-guides/release-5.x/system.html

JayMcAnser avatar Oct 26 '24 11:10 JayMcAnser

Replace

#include "esp_intr.h"

with

#include "rom/gpio.h"

In src/ESP32SJA1000.cpp to get it running

drnet-at avatar Nov 10 '24 13:11 drnet-at

Hi all, i tried the CANSender.ino sketch. my setup is esp32-S3 dev module. the fix mentionned above compiles for a DOIT ESP32 DEVKIT V1, but i get the following errors for esp32-S3 dev module :

In file included from C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_reg.h:21, from C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:8: C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp: In member function 'virtual int ESP32SJA1000Class::begin(long int)': C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:57:29: error: 'DPORT_PERIP_RST_EN_REG' was not declared in this scope; did you mean 'SYSTEM_PERIP_RST_EN1_REG'? 57 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:67: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (*((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:87:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 87 | #define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask)))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:57:3: note: in expansion of macro 'DPORT_CLEAR_PERI_REG_MASK' 57 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:57:53: error: 'DPORT_CAN_RST' was not declared in this scope 57 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:88: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:87:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 87 | #define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask)))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:57:3: note: in expansion of macro 'DPORT_CLEAR_PERI_REG_MASK' 57 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:58:27: error: 'DPORT_PERIP_CLK_EN_REG' was not declared in this scope; did you mean 'SYSTEM_PERIP_CLK_EN1_REG'? 58 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:67: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:90:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 90 | #define DPORT_SET_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)|(mask))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:58:3: note: in expansion of macro 'DPORT_SET_PERI_REG_MASK' 58 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:58:51: error: 'DPORT_CAN_CLK_EN' was not declared in this scope 58 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:88: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:90:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 90 | #define DPORT_SET_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)|(mask))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:58:3: note: in expansion of macro 'DPORT_SET_PERI_REG_MASK' 58 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:62:26: error: 'CAN_RX_IDX' was not declared in this scope; did you mean 'TWAI_RX_IDX'? 62 | gpio_matrix_in(_rxPin, CAN_RX_IDX, 0); | ^~~~~~~~~~ | TWAI_RX_IDX C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:67:27: error: 'CAN_TX_IDX' was not declared in this scope; did you mean 'TWAI_TX_IDX'? 67 | gpio_matrix_out(_txPin, CAN_TX_IDX, 0, 0); | ^~~~~~~~~~ | TWAI_TX_IDX C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp: In member function 'virtual void ESP32SJA1000Class::end()': C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:172:27: error: 'DPORT_PERIP_RST_EN_REG' was not declared in this scope; did you mean 'SYSTEM_PERIP_RST_EN1_REG'? 172 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:67: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:90:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 90 | #define DPORT_SET_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)|(mask))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:172:3: note: in expansion of macro 'DPORT_SET_PERI_REG_MASK' 172 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:172:51: error: 'DPORT_CAN_RST' was not declared in this scope 172 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:88: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:90:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 90 | #define DPORT_SET_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)|(mask))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:172:3: note: in expansion of macro 'DPORT_SET_PERI_REG_MASK' 172 | DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_CAN_RST); | ^~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:173:29: error: 'DPORT_PERIP_CLK_EN_REG' was not declared in this scope; did you mean 'SYSTEM_PERIP_CLK_EN1_REG'? 173 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:67: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:87:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 87 | #define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask)))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:173:3: note: in expansion of macro 'DPORT_CLEAR_PERI_REG_MASK' 173 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:173:53: error: 'DPORT_CAN_CLK_EN' was not declared in this scope 173 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:77:88: note: in definition of macro '_DPORT_WRITE_PERI_REG' 77 | #define _DPORT_WRITE_PERI_REG(addr, val) (((volatile uint32_t )(addr))) = (uint32_t)(val) | ^~~ C:\Users\Public\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.3-cfea4f7c-v1\esp32s3/include/soc/esp32s3/include/soc/dport_access.h:87:46: note: in expansion of macro 'DPORT_WRITE_PERI_REG' 87 | #define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask)))) | ^~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:173:3: note: in expansion of macro 'DPORT_CLEAR_PERI_REG_MASK' 173 | DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_CAN_CLK_EN); | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp: In member function 'virtual void ESP32SJA1000Class::onReceive(void ()(int))': C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:284:20: error: 'ETS_CAN_INTR_SOURCE' was not declared in this scope 284 | esp_intr_alloc(ETS_CAN_INTR_SOURCE, 0, ESP32SJA1000Class::onInterrupt, this, &_intrHandle); | ^~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

I replicated the issue on several computers and fresh installs of Arduino IDE 2.3.2. Any ideas?

BWV999-MTL avatar Jan 23 '25 14:01 BWV999-MTL

The line

C:\Users\Public\Arduino15\libraries\CAN\src\ESP32SJA1000.cpp:57:29: error: 'DPORT_PERIP_RST_EN_REG' was not declared in this scope; did you mean 'SYSTEM_PERIP_RST_EN1_REG'?

Tells you everything you need to know: The macro DPORT_PERIP_RST_EN_REG is obviously not resolved in your version of the ESP32 for Arduino SDK. You need to either track it down (if it is now in another header file) and include it, or replace it by the macro which is valid for your SDK (if it was renamed).

Just a hail-mary-try: Replace all instances of macros with CAN in them by macros with TWAI replacing it. Or even better redefine the CAN versions from the TWAI versions - the complier will warn you, if you start breaking things.

drnet-at avatar Jan 23 '25 14:01 drnet-at

I had a look a at the technical reference manual for both esp32 and esp32 s3. I might be able to track down registers and migrate them in the library, but i could not find confirmation that the twai controller in the s3 version is still compatible with the SJA1000 as it was in esp 32. I might be in over my head with this. My end goal is to use the Odrive arduino library with an S3 and builtin TWAI (https://github.com/odriverobotics/ODriveArduino). instead of trying to migrate sandeepmistry's arduino-CAN library to esp32 S3, i might have a better chance of succes in implementing a IS_ESP32-S3_BUILTIN Board-specific includes that uses TWAI in Odrives library.

BWV999-MTL avatar Jan 24 '25 03:01 BWV999-MTL