esp32s3: expose canbus machine property and wire TWAI peripheral#147
Draft
haoruizhou wants to merge 1 commit into
Draft
esp32s3: expose canbus machine property and wire TWAI peripheral#147haoruizhou wants to merge 1 commit into
haoruizhou wants to merge 1 commit into
Conversation
The ESP32-S3 TWAI device (esp32s3_twai.c, inheriting esp32_twai.c) already implements a 'canbus' link property and calls can_sja_connect_to_bus() in its realize handler — but the machine (esp32s3.c) never exposed a corresponding property or set the link, leaving the TWAI peripheral permanently CAN-isolated. This patch wires the two together: - Add CanBusState *canbus field to Esp32s3MachineState - Expose it as a machine property via object_class_property_add_link - Set the TWAI 'canbus' link in machine_init before qdev_realize Usage: -object can-bus,id=canbus0 -object can-host-socketcan,id=can-host0,if=vcan0,canbus=canbus0 -machine esp32s3,canbus=canbus0 Tested with ESP32-S3 firmware on vcan0 (Linux virtual SocketCAN). Firmware CAN TX and RX confirmed working via candump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ESP32-S3 TWAI device (esp32s3_twai.c, inheriting esp32_twai.c) already implements a 'canbus' link property and calls can_sja_connect_to_bus() in its realize handler — but the machine (esp32s3.c) never exposed a corresponding property or set the link, leaving the TWAI peripheral permanently CAN-isolated.
This patch wires the two together:
Usage:
-object can-bus,id=canbus0 -object can-host-socketcan,id=can-host0,if=vcan0,canbus=canbus0 -machine esp32s3,canbus=canbus0
Tested with ESP32-S3 firmware on vcan0 (Linux virtual SocketCAN). Firmware CAN TX and RX confirmed working via candump.
Description
Related
Testing
Checklist
Before submitting a Pull Request, please ensure the following: