Skip to content

Modified library for ESP32 native TWAI driver #11

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

BWV999-MTL
Copy link

created two new files to go with the OdriveArduino library. TWAI_CAN_Class.h and ODriveESP32TWAI.hpp. They enable the use of the native TWAI drivers of the Arduino core for the ESP32. It enables the use of a simple transceiver like an SN65HVD230 instead of requiring an SPI interface.
The main sketch is updated to add the corresponding board-specific include and setting sections.
The indentation of the board specific settings was also modified to enable code folding in Arduino IDE 2.
Changed the Serial Begin to wait for communication to open but allow execution after a certain amount of time

created two new files to go with the OdriveArduino library. TWAI_CAN_Class.h and ODriveESP32TWAI.hpp. They enable the use of the native TWAI drivers of the Arduino core for the ESP32. It enables the use of a simple transceiver like an SN65HVD230 instead of requiring an SPI interface. Also the sine wave sketch is updated to add the corresponding board-specific include and setting sections.
@BWV999-MTL BWV999-MTL marked this pull request as ready for review February 8, 2025 00:35
As per suggestions in pull-request comments
Updated as per suggestions from pull request review
as per suggestions
updated as per suggestions
default node ID for default sketch
standard formatting
added this line back wich was deleted by accident in previous commit : twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT((gpio_num_t)TX_PIN, (gpio_num_t)RX_PIN, TWAI_MODE_NORMAL);
@BWV999-MTL BWV999-MTL requested a review from Wetmelon February 20, 2025 12:31
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Member

@samuelsadok samuelsadok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some additional clean-up is needed for this.

  • Please assimilate TWAI_CAN_Class.h into ODriveESP32TWAI.hpp. This looks like a glue layer on top of a glue layer, which adds unnecessary complexity. There should be no intermediate TWAIClass, instead for example sendMsg can assemble the packet and call twai_transmit() directly.
  • If possible, please add a PlatformIO compile target for an ESP32 board, so that this is tested in CI.
  • Please remove changes in SineWaveCAN.ino that are not directly related to ESP32 support. If you think there are some important unrelated changes in there, please put them into a separate PR.
  • Once finished, please rebase into 1-3 commits with a short descriptive commit message.

For a concise example, you can have a look at #12.

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

Successfully merging this pull request may close these issues.

4 participants