collin80/esp32_can

Compilation error with Arduino Due (missing headers)

Closed this issue · 1 comments

Hello,

I am trying to run a piece of code originally written for EVTV's CANDue (http://media3.evtv.me/Model3Battery102.zip), that uses this library . However I do not have it and instead rely on an Arduino Due with a CAN shield. The shield is connected via the SPI header and uses the MCP2515 and MCP2551 (should work when I use CAN1?). The Due uses the SAM3X Cortex-M3.

When I try to upload this sketch with esp32_can, I get some issues when including some of the required FreeRTOS headers:

Arduino: 1.8.12 (Windows 10), TD: 1.51, Board: "Arduino Due (Programming Port)"

In file included from C:\Users\User\Documents\Arduino\libraries\esp32_can-master\src/esp32_can.h:1:0,

                  from C:\Users\User\Projects\Model3Battery102\Model3Battery102.ino:8:

C:\Users\User\Documents\Arduino\libraries\esp32_can-master\src/esp32_can_builtin.h:36:31: fatal error: freertos/FreeRTOS.h: No such file or directory

 #include "freertos/FreeRTOS.h"

compilation terminated.

exit status 1
Error compiling for board Arduino Due (Programming Port).`

I figured this error is related with the Arduino environment lacking the required FreeRTOS components, which I thought to have resolved with the "Boards Manager" and adding the Arduino SAM Boards.

Should the library work when I try to use it this way? and am I missing anything obvious?

The Due and the ESP32 are completely different chips that use completely different libraries. You can't use the esp32_can code on a Due. The Due itself has two built-in CAN modules. All you need to add are the transceivers (the MCP2551 is one, or an SN65HVD232) If you use the built-in CAN on the Due then you can use the due_can library from my repo here. As luck would have it, I kept the API basically the same between due_can and esp32_can so merely switching libraries from esp32_can to due_can should get you a long way toward a functional program.