Xinyuan-LilyGO / T-CAN485

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to change IER parameter of CAN controller?

ajaykoppisetty opened this issue · comments

I got the chip with v3. In the read me file, it was mentioned to update the IER parameter for v3 for CAN bus to work. How and where to change it? Please help.

by hans from https://www.cnx-software.com/2021/12/20/ttgo-t-can485-an-esp32-board-with-rs485-can-bus-interfaces/
Just to save someone else 3 hours of googling trying to figure out what this cryptic instruction actually means:

Depending on the ESP32 chip, the CAN controller register IER parameter needs to be changed. If it is a V3 version chip, you can use 0xEF, otherwise, use 0xFF.

You can change the value from 0xef to 0xff on line 229 of the file CAN.c in the ESP32-Arduino-CAN library:

MODULE_CAN->IER.U = 0xef; //ESP32 V3 0XEF ESP32 NOT V3 0XFF

Do note it is set to 0xef by default, so if you have a V3 ESP32 you do not need to change anything.