Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    CAN peripheral support

    Scheduled Pinned Locked Moved Enhancements
    cancanbusbusperipheralcontroller
    18 Posts 7 Posters 6.4k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      TravisT @livius
      last edited by

      @livius

      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.

      1 Reply Last reply Reply Quote 0
      • T Offline
        TravisT
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • R Offline
          redimo
          last edited by

          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.

          T 1 Reply Last reply Reply Quote 0
          • T Offline
            TravisT @redimo
            last edited by

            @redimo

            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

            J 1 Reply Last reply Reply Quote 0
            • J Offline
              jmarcelino @TravisT
              last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • E Offline
                eerimoq
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • J Offline
                  johand
                  last edited by

                  I found this project, anyone tried it? A step closer to CAN-support for Pycom-devices?

                  https://github.com/danicampora/pycom-micropython-can

                  Johan

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    TravisT
                    last edited by

                    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.

                    J 1 Reply Last reply Reply Quote 0
                    • J Offline
                      johand @TravisT
                      last edited by

                      @travist Sounds great! Do you need any help testing? What transceiver do you use?

                      Johan

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        TravisT
                        last edited by

                        @johand

                        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.

                        J 1 Reply Last reply Reply Quote 0
                        • J Offline
                          johand @TravisT
                          last edited by

                          @travist Any update on CAN support?

                          1 Reply Last reply Reply Quote 1
                          • T Offline
                            TravisT
                            last edited by

                            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.

                            J 1 Reply Last reply Reply Quote 1
                            • J Offline
                              johand @TravisT
                              last edited by

                              That is very good news!

                              1 Reply Last reply Reply Quote 0
                              • sebS Offline
                                seb
                                last edited by

                                CAN support will be available in the next firmware release which should be coming out in a few days, its just undergoing final testing.

                                1 Reply Last reply Reply Quote 1
                                • sebS Offline
                                  seb
                                  last edited by

                                  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

                                  1 Reply Last reply Reply Quote 1

                                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                  With your input, this post could be even better 💗

                                  Register Login
                                  • 1 / 1
                                  • First post
                                    Last post

                                  Pycom on Twitter

                                  Pycom