Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port/esp32: Add CAN(TWAI) driver. #12331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IhorNehrutsa
Copy link
Contributor

@IhorNehrutsa IhorNehrutsa commented Aug 29, 2023

This pull request is based on ESP32: CAN(TWAI) driver #7381

Consistent with the docs\machine_CAN: Add CAN docs. #12330

Will consistent with the New machine.CAN driver #12337

@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Merging #12331 (c604a8c) into master (1dedb65) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #12331   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         158      158           
  Lines       20900    20900           
=======================================
  Hits        20563    20563           
  Misses        337      337           

@projectgus
Copy link
Contributor

As mentioned on the linked PR, this work is much appreciated and we're keen to have esp32 CAN driver support. Implementing a common machine.CAN API will take some time, the new plan for this work is in #12337.

@IhorNehrutsa I hope you're keen to keep this PR open and it can be adapted it to the new API once that's available.

@straga
Copy link

straga commented Nov 8, 2023

esp-idf 5.02
["esp32", "esp32", "1.22.0-preview", "v1.22.0-preview.132.g958c6d917.dirty on 2023-11-08", "with PSRAM"]
Work with some code change.

>>> dev = CAN(0, extframe=False, tx=4, rx=5, mode=CAN.NORMAL, baudrate=500000, auto_restart=False)
>>> dev.recv()
(857, False, False, b'\x00\x00\x00\x00\x03\x00\x00\x00')
>>> dev.recv()
(857, False, False, b'\x00\x00\x00\x00\x03\x00\x00\x00')
>>> dev.recv()
(853, False, False, b'_\x00d\x00')
>>> dev.recv()
(857, False, False, b'\x00\x00\x00\x00\x03\x00\x00\x00')
>>> dev.recv()
(857, False, False, b'\x00\x00\x00\x00\x03\x00\x00\x00')
>>> dev.recv()
(857, False, False, b'\x00\x00\x00\x00\x03\x00\x00\x00')
>>> dev.recv()
(862, False, False, b'hi\x89i\x00\x00  ')
>>> dev.recv()
(857, False, False, b'\x00\x00\x00\x00\x03\x00\x00\x00')

@winnie-xzh
Copy link

@straga Can you share your code changes? This PR may not be completed so quickly.

@straga
Copy link

straga commented Dec 27, 2023

@winnie-xzh
I am use user_modules for CAN, draft version, but work for me. Not need more touch micropython core code.
https://github.com/straga/micropython-esp32-twai

@projectgus
Copy link
Contributor

This is an automated heads-up that we've just merged a Pull Request
that removes the STATIC macro from MicroPython's C API.

See #13763

A search suggests this PR might apply the STATIC macro to some C code. If it
does, then next time you rebase the PR (or merge from master) then you should
please replace all the STATIC keywords with static.

Although this is an automated message, feel free to @-reply to me directly if
you have any questions about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants