Having trouble using esp-idf CAN driver in PlatformIO

I am having trouble with the “driver/can.h” include, from esp-idf, when i run the “build” command, in PlatformIO. Actually, PlatformIO doesn’t have the CAN driver, built by ThomasBarth, and utilized by esp-idf itself, in their libraries, at “C:\Users\USER.platformio\packages\framework-espidf\components\driver”. Somehow, some files are missing, like “can.c”, “can.h” and other ones, related to those ones.

Is anyone having the same ploblem?

You’re correct, platform-espressif32 is supposed to have ESP-IDF 3.1.3 in which this file does exist, but it’s not downloaded in the framework-espidf directory. This was already noticed here: ESP32-IDF and CAN (Control Area Network) modules · Issue #159 · platformio/platform-espressif32 · GitHub

1 Like

Thank you for the reply.

I have been trying to update and include this driver manually for two days, but PlatformIO seems to always replace the files over and over again by the older ones. I was trying this:

  1. download the latest esp-idf;
  2. replace the downloaded files in “C:\Users\USER.platformio\packages\framework-espidf”;
  3. do the “build” command.
  4. Unfortunatelly, never worked.

It seems, every time PlatformIO runs the “Rebuild IntelliSense Index” command, it overwrites all the “IncludePaths” and files i have updated manually.

Do you see it here ?

Nope. I see it here → “esp-idf/components/driver/include/driver at master · espressif/esp-idf · GitHub”.

  1. It is the “can.h” file in “driver/include/driver”,
  2. and the “can.c” file in “driver” only.
  3. And another files that are importante to the CAN driver itself.

Funny it’s really not in these tags or in the release from 15 days ago but in the current development branch since July 2018… Maybe because there were recent bugfixes to it? History for components/driver/can.c - espressif/esp-idf · GitHub

Better ask ESP-IDF here why it’s not included in the release

For sure, it’s funny. But that’s not a PlatformIO include issue, instead of ESP-IDF issue? Sorry, but i’m a little lost here :sweat_smile:

It’s an ESP-IDF issue. PIO clones the release tags from ESP-IDF. The CAN driver files were not included in the 3.1.3 release that the latest platform-espressif32 uses -> ask ESP-IDF why

1 Like

Okay. Thank you a lot for the fast support! =)

Why doesn’t PlatformIO clones the latest (master) version of ESP-IDF?

Because of a policy to not support unstable betas. Development branch would even be bleeding edge.

1 Like