Supported Targets ESP32 ESP32-C2 ESP32-C3 ESP32-S2 ESP32-S3

ESP-IDF 4.x

Yes

?

?

?

?

ESP-IDF 5.x

Yes

?

YES

?

?

NMEA2000_esp32 library for ESP32xx boards using twai driver

Driver component for NMEA2000 library for ESP32 Boards.

To use this library, you will also need NMEA2000 library.

The library defines as default Tx pin to GPIO 16 and Rx pint to GPIO 4. You can change these with defines:

#define ESP32_CAN_TX_PIN GPIO_NUM_5
#define ESP32_CAN_RX_PIN GPIO_NUM_4

before including NMEA2000_CAN.h or NMEA2000_esp32xx.h

A working example can be found at NMEA2000-windesp32xx-idf library

Some tweaks to sdkconfig that are recommended:

CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC=y
CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=y
CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y
CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y
CONFIG_FREERTOS_HZ=1000

Changes

  • 2023-06-08 - Jaume Clarens "jiauka"

    • First release, WIP, only tested in RX

  • 2023-06-09 - Jaume Clarens "jiauka"

    • V0.1 working on both ESP32 and ESP32c3

  • 2023-06-10 - Jaume Clarens "jiauka"

    • V0.2 code cleanup

  • 2024-03-25 - Paul Abbott "phatpaul"

  • 2024-10-25 - Paul Abbott "phatpaul"

License

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Thanks

This is based on the work of:

  • Timo Lappalainen "ttlappalainen"

  • Jaume Clarens "jiauka"

  • Andreas Vogel "wellenvogel"