[ESP8266] CAN library for Arduino

Recently I needed a CAN <-> WiFi router at work. As I didn’t want to use a several thousand euro hardware that sucks a few amps at 12V,
I decided to implement that using the ESP8266 and a CAN transceiver.

The current setup
The current setup
Sending CAN messages with the ESP8266, decoded with PicoScope.
Sending CAN messages with the ESP8266, decoded with PicoScope.

Well, it works quite stable, just a few things here and there. E.g. I cannot ACK messages as I am using I2S to sample the CAN Rx path.
Also the I2S seems not very stable and goes crazy every 20 minutes at 1.5 MHz sampling rate, so that I implemented a detection and restart procedure.

Here is a picture of the ISR execution time – it is quite stable at 725µs – 765µs

Tracing the ISR execution time using a GPIO. When the ISR is active, the signal is high.
Tracing the ISR execution time using a GPIO. When the ISR is active, the signal is high.

But aside of these minor issues, the ESP8266 is now ready for its use case – routing between WiFi and CAN :)

Here is the library: GitHub – g3gg0/esp8266can

Leave a Reply