Skip to content

Reliable lightweight CanBus library with built-in watchdog aiming to support integrated CAN driver inside ESP32 microcontroller dedicated to devices operating 24/7.

License

Notifications You must be signed in to change notification settings

cziter15/lw_can

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightweight ESP32 CAN Library

Library to support ESP32 built-in CAN controller.

This project is at experimental stage!

Introduction

When I developed the code for the heating boiler monitoring module (PelletMon) I used several different CAN libraries.

Most of them are linked below, but each of them has disadvantages.

  • The most extensive is esp32_can, but it has a few redundant tasks running in the background. Nevertheless, I took a lot of inspiration from it - for example, the idea for an automatic watchdog.
  • As for ESP32-Arduino-CAN, this library is very simple. It inspired me in the context of the code architecture itself.
  • The last linked library is the basis of most implementations available on the web. In short, it contains all the commands we need to give the SJA1000 module.
  • ... of course, I also used the original TWAI driver from ESP-IDF, but here the most disturbing was its instability - for example, a fatal error in twai_initiate_recovery().

All these issues led me to create my own solution - lw_can - which is lightweight CAN bus library for ESP32.

Features

  • TWAI-like interface known from ESP-IDF (methods like lw_can_install, lw_can_transmit etc)
  • Error counters (arbitration lost, bus error, overrun, passive etc)
  • Watchdog (will reset peripheral in case of error - this is "smart reset" avoiding reset loop - however this is not CAN standard compliant).
  • Various bus speed support (BRP settings available)

Based on

About

Reliable lightweight CanBus library with built-in watchdog aiming to support integrated CAN driver inside ESP32 microcontroller dedicated to devices operating 24/7.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages