CAN peripheral support
-
I use CAN bus networks often and having a ESP32 working with the built in CAN controller, which is much better than having an extra layer with a SPI controller, would make the Pycom modules much more valuable to me.
It looks like it is supported with the base Espressif firmware and drivers, just want to see it moved over to Pycom and micropython.
-
Hi,
A firmware with the CAN library has just been released and the documentation for it is available here: https://docs.pycom.io/chapter/firmwareapi/pycom/machine/CAN.html
-
CAN support will be available in the next firmware release which should be coming out in a few days, its just undergoing final testing.
-
That is very good news!
-
I have done some more testing with Daniel's latest library. I think the initial version will be released very soon, maybe within the week.
-
@travist Any update on CAN support?
-
I think after Daniel finishes up a couple more features and I can do initial testing it will likely be available as some sort of Beta, but that is more up to Daniel.
Transceivers are mostly transparent to CAN, so this is not really an issue. I would suggest just buying a common one, especially if you are running 500k or slower.
-
@travist Sounds great! Do you need any help testing? What transceiver do you use?
Johan
-
I have been working with Daniel, there should hopefully be a tested CAN implementation in the master branch of the repo in the not to distant future.
-
I found this project, anyone tried it? A step closer to CAN-support for Pycom-devices?
https://github.com/danicampora/pycom-micropython-can
Johan
-
The CAN driver part of Pumbaa works in the normal case for ESP32. Improved error handling is being implemented as I write.
Pumbaa does support the ESP32, but not the Pycom boards in particular. It's just a matter of creating a few files with pin mapping definitions, so can easily be added.
-
@TravisT
There is an option at build time (menuconfig) to change pins otherwise the default GPIO5 would conflict on the LoPy/Sipy (but work on the WiPy)However CAN is not officially supported yet, so far it's been a side project started in the ESP32.com community using some early information from Espressif.
-
The CAN peripheral is actually part of the microcontroller, so two specific pins have this as alternate functions. You would only require a transceiver to handle the differential pair.
It looks like it is IO4 and IO5 from the ESP32 chip.
CAN_device_t CAN_cfg = { .speed=CAN_SPEED_500KBPS, .tx_pin_id = GPIO_NUM_5, .rx_pin_id = GPIO_NUM_4, .rx_queue=NULL, };
I also posted this on the Micropython forums, and emailed one of the driver developers to ask for help.
https://forum.micropython.org/viewtopic.php?f=12&t=3336
-
This is quite interessting. Would one be able to use preexisting pins? I also work quite heavily (nearly exclusively) with CAN and this would be godsend. Also another reason to use the PyCom modules later in high quantity production.
-
A couple more resources
https://github.com/ThomasBarth/ESP32-CAN-Driver
https://www.tindie.com/products/microwavemont/esp32-can-can-board/This of course is also somewhat of a bump to the topic
-
Yeah, just passing the information on and hoping to get the Pycom team to implement it.
I did none of the actual hard work. But I use CAN heavily.
-
@TravisT
It looks promising :)
I am also interested.
-
Some added resources