tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

ESP32 Can Bus (TWAI)

Open MrNavaStar opened this issue 1 year ago • 3 comments

The esp32 has a built in can controller than can interface with a TJA1050 or similar to allow for communication via the CAN protocol. As far as I can tell, this feature is not implemented and I haven't found any libraries that do so either.

Could someone point me in the direction of where to get started implementing this feature? Should it be added as to this repo as a board specific feature, or as a driver?

Any help would be appreciated, thanks!

MrNavaStar avatar Sep 24 '24 01:09 MrNavaStar

This should be implemented in the machine package. To get an idea of how it is done, you can see the I2C PR here: https://github.com/tinygo-org/tinygo/pull/4259

aykevl avatar Sep 28 '24 13:09 aykevl

I have tiny go setup, but I'm getting errors about "device/esp" not being present. How do you get this working? I can't find the module anywhere in the project. I would suspect the device/esp directory would have an esp.go file like some of the other modules, but it does not have one.

MrNavaStar avatar Oct 03 '24 02:10 MrNavaStar

@aykevl ^^

MrNavaStar avatar Oct 04 '24 16:10 MrNavaStar

@MrNavaStar did you happen to install TinyGo from source? If so, you probably need to run

git submodule update --init
make gen-device

deadprogram avatar Dec 05 '24 11:12 deadprogram

Yeah I ended up figuring this out. I've currently been facing issues with neovim I believe. After generating devices, neovim seems to be unable to find many files that do exist, causing gopls to not work correctly.

I'll try this again with something like goland when I can get my free license when the next semester starts.

MrNavaStar avatar Dec 05 '24 22:12 MrNavaStar

OK thanks everyone. Now closing.

deadprogram avatar Dec 06 '24 10:12 deadprogram