-
Notifications
You must be signed in to change notification settings - Fork 8.4k
drivers: serial: uart_sam0: Add RS485 transceiver GPIO support #98524
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
base: main
Are you sure you want to change the base?
Conversation
|
Hello @rlevano77, and thank you very much for your first pull request to the Zephyr project! |
|
Hi @rlevano77 , This "Merge remote-tracking branch 'upstream/main" is not acceptable in Zephyr code base. You need to rebase on top of main only your commits. This the merge commit, compliance checks and the tests so we can start review your PR. |
|
Hi @nandojve I have rebased my commit on top of main and removed the merge commit. |
nandojve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rlevano77 ,
Interesting work! Do you think it is possible to have a test ?
How do you suggest to validate code ?
|
Hi @nandojve,
The conditional compilation ensures zero flash and RAM overhead when RS485 GPIOs are not configured in the device tree. |
|
Hi @rlevano77 , Overall changes seems to be OK! Now,
I'll ask you to commit in the PR exactly what you need to do. I mean, which is the shield and share any overlay that you create. BTW, make sure CI is happy : ) |
Add de-gpios and re-gpios properties to support RS485 transceiver control. These optional GPIOs control Driver Enable (DE) and Receiver Enable (RE) pins for half-duplex RS485 communication. Signed-off-by: Ricardo Levano <rlevano77@gmail.com>
|
Hi @nandojve , |
Add optional RS485 transceiver control using de-gpios and re-gpios device tree properties. The implementation includes: - Conditional compilation using DT_ANY_INST_HAS_PROP_STATUS_OKAY - Helper functions for DE/RE GPIO control - Integration with UART poll_out and interrupt handlers - Runtime configuration validation for RS485 flow control - Zero flash/RAM overhead when GPIOs not configured Testing: Verified on SAME54 Xpro board with RS485 transceiver using Zephyr's samples/drivers/uart/echo_bot. Setup included RS-485 breakout board and USB-RS485 adapter. Tested with and without RS485 support. Signed-off-by: Ricardo Levano <rlevano77@gmail.com>
Add a sample application demonstrating RS485 transceiver control using the SAM0 UART driver. The sample shows how to: - Configure UART in RS485 mode at runtime - Use de-gpios and re-gpios for transceiver control - Implement echo bot with interrupt-driven RX and polling TX The sample includes complete documentation and overlay for SAME54 Xplained Pro board using SERCOM0 with DE/RE control on PA22. Hardware tested: - SAME54 Xplained Pro board - SparkFun RS-485 Transceiver Breakout - DTECH USB-to-RS485 converter Signed-off-by: Ricardo Levano <rlevano77@gmail.com>
|
@nandojve |
|
nandojve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well done!



Add RS485 half-duplex communication support to the SAM0 UART driver
through optional GPIO-controlled transceiver enable pins.
Changes:
de-gpiosandre-gpiosproperties to device tree binding forcontrolling RS485 transceiver Driver Enable and Receiver Enable pins
operations
The implementation handles transceivers with separate or tied DE/RE pins
(specify only de-gpios when tied together). GPIO polarity is configurable
via device tree flags (GPIO_ACTIVE_HIGH/LOW).
Tested on: same54_xpro board