Skip to content

feat(uart): improve example documentation#12745

Draft
SuGlider wants to merge 1 commit into
espressif:masterfrom
SuGlider:feat/uart_readme_files
Draft

feat(uart): improve example documentation#12745
SuGlider wants to merge 1 commit into
espressif:masterfrom
SuGlider:feat/uart_readme_files

Conversation

@SuGlider

@SuGlider SuGlider commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Description of Change

This pull request updates the documentation for several ESP32 Serial examples to clarify hardware requirements, usage instructions, and correct technical details. It also adds a new README for the RS485 Echo Demo. The main changes focus on improving accuracy, clarifying the use of internal loopback and IrDA/RS485 modes, and updating usage steps.

Documentation improvements and corrections:

  • Updated the baud rate detection range in BaudRateDetect_Demo/README.md to specify support for 300 to 230400 baud (previously claimed up to 921600), and revised the list of detectable baud rates accordingly.
  • Rewrote the usage instructions in BaudRateDetect_Demo/README.md to emphasize the need to send data during the detection window in setup(), clarified fallback behavior, and improved example scenarios.

Internal loopback and flow control clarification:

  • Updated HardwareFlowControl_Demo/README.md to clarify that internal loopback uses specific helper functions, corrected code line numbers, and improved descriptions of internal connections.

IrDA and RS485 hardware requirements:

  • Added explicit notes in IrdaMode_DualUART_Demo/README.md and IrdaMode_TwoBoard_Demo/README.md that IrDA mode requires separate TX and RX pins and does not support one-wire UART; also made minor corrections to example output.
  • Added a new README for RS485_Echo_Demo with wiring instructions, hardware requirements, and usage steps, emphasizing that one-wire mode is not compatible with RS485 and that separate TX/RX/RTS pins are required.

Test Scenarios

CI Only

Related links

None

@SuGlider SuGlider added this to the 3.3.0 milestone Jul 6, 2026
@SuGlider SuGlider self-assigned this Jul 6, 2026
@SuGlider SuGlider requested a review from a team as a code owner July 6, 2026 01:24
@SuGlider SuGlider added the Type: Documentation Issue pertains to Documentation of Arduino ESP32 label Jul 6, 2026
Copilot AI review requested due to automatic review settings July 6, 2026 01:24
@SuGlider SuGlider added Type: Example Issue is related to specific example. Area: UART Related to the UART peripheral or its functionality. labels Jul 6, 2026

@espressif-bot espressif-bot Jul 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Merge request must include a release note, or it needs to be processed first.

Details

Open

@SuGlider SuGlider marked this pull request as draft July 6, 2026 01:25
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 🎉 Good Job! All checks are passing!

👋 Hello SuGlider, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against c627314

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves end-user documentation for several ESP32 Serial examples, clarifying wiring/hardware requirements and refining usage instructions for baud-rate detection, IrDA mode, RS485 mode, and internal loopback/flow control behavior.

Changes:

  • Add a new README for the RS485_Echo_Demo example with pin requirements, wiring notes, and usage steps.
  • Update IrDA example READMEs to better describe hardware constraints and expected output.
  • Update flow-control and baud-detect READMEs to clarify internal-loopback behavior and user interaction during baud detection.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
libraries/ESP32/examples/Serial/RS485_Echo_Demo/README.md New README describing RS485 echo demo wiring/pins/usage.
libraries/ESP32/examples/Serial/IrdaMode_TwoBoard_Demo/README.md Adds IrDA hardware notes and adjusts example output snippet.
libraries/ESP32/examples/Serial/IrdaMode_DualUART_Demo/README.md Adds IrDA hardware note for the single-board dual-UART demo.
libraries/ESP32/examples/Serial/HardwareFlowControl_Demo/README.md Clarifies internal loopback helpers and updates referenced line numbers.
libraries/ESP32/examples/Serial/BaudRateDetect_Demo/README.md Updates baud-detect range/usage instructions and failure behavior description.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| TX | UART transmit to transceiver |
| RTS | Drives transceiver DE/~RE (direction) |

**One-wire mode (`enableOneWireMode`) is not compatible with RS485.** Do not use the same GPIO for RX and TX; use an external RS485 transceiver (e.g. MAX485) with distinct TX, RX, and direction control.
- **User selects mode** at startup via Serial Monitor (press 'T' or 'R')
- **Real hardware required**: IR LED on TX board, IR receiver on RX board

**Note:** IrDA requires **separate** TX and RX GPIO pins on each board. One-wire UART (`enableOneWireMode`) is **not** supported in IrDA mode.
- **UART2**: Configured in IrDA RX mode (receiver)
- **Internal loopback**: UART1 TX pin internally connected to UART2 RX pin via GPIO matrix

**Note:** IrDA requires **separate** TX and RX GPIO pins (IR LED vs receiver). One-wire UART (`enableOneWireMode`) is **not** supported in IrDA mode.
Comment on lines +45 to +47
The baud rate detection works over **300 to 230400 baud** (as noted in the sketch). The detected value is rounded to the nearest entry in the core’s internal baud-rate table used by `uartDetectBaudrate()`.

Examples of baud rates that can be detected include: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 74880, 115200, 230400, 256000, 460800, 921600, and others defined by the core.
Examples of baud rates that can be detected include: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 74880, 115200, and 230400.
Comment on lines 152 to 154
3. **`uart_internal_loopback(uartNum, rxPin)`** (when `USE_INTERNAL_MATRIX_PIN_LOOPBACK = 1`)
- Creates internal GPIO matrix connection for TX→RX loopback
- Creates internal TX→RX loopback (peripheral loopback on native IOMUX RX pins, or GPIO-matrix routing otherwise)
- No external wires needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: UART Related to the UART peripheral or its functionality. Type: Documentation Issue pertains to Documentation of Arduino ESP32 Type: Example Issue is related to specific example.

Projects

Development

Successfully merging this pull request may close these issues.

3 participants