mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-26 12:50:30 +00:00
uart: Provide support for esp32c2 and esp32h2
UART examples, unit test, and programming guide are all updated.
This commit is contained in:
@@ -17,30 +17,30 @@ monitoring. The external interface should have 3.3V outputs. You may use e.g. 3.
|
||||
Connect the external serial interface to the board as follows.
|
||||
|
||||
```
|
||||
---------------------------------------------------------------------------------------
|
||||
| Target chip Interface | #define | Default ESP Pin | External UART Pin |
|
||||
| ----------------------|------------------|----------------------|--------------------
|
||||
| Transmit Data (TxD) | EXAMPLE_UART_TXD | GPIO4 | RxD |
|
||||
| Receive Data (RxD) | EXAMPLE_UART_RXD | GPIO5 | TxD |
|
||||
| Ground | n/a | GND | GND |
|
||||
---------------------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------------------
|
||||
| Target chip Interface | Kconfig Option | Default ESP Pin | External UART Pin |
|
||||
| ----------------------|--------------------|----------------------|--------------------
|
||||
| Transmit Data (TxD) | EXAMPLE_UART_TXD | GPIO4 | RxD |
|
||||
| Receive Data (RxD) | EXAMPLE_UART_RXD | GPIO5 | TxD |
|
||||
| Ground | n/a | GND | GND |
|
||||
-----------------------------------------------------------------------------------------
|
||||
```
|
||||
Note: Some GPIOs can not be used with certain chips because they are reserved for internal use. Please refer to UART documentation for selected target.
|
||||
|
||||
Optionally, you can set-up and use a serial interface that has RTS and CTS signals in order to verify that the
|
||||
hardware control flow works. Connect the extra signals according to the following table, configure both extra pins in
|
||||
the example code by replacing existing `UART_PIN_NO_CHANGE` macros with the appropriate pin numbers and configure
|
||||
UART1 driver to use the hardware flow control by setting `.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS` and adding
|
||||
`.rx_flow_ctrl_thresh = 122`.
|
||||
the example code `uart_echo_example_main.c` by replacing existing `UART_PIN_NO_CHANGE` macros with the appropriate pin
|
||||
numbers and configure UART1 driver to use the hardware flow control by setting `.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS`
|
||||
and adding `.rx_flow_ctrl_thresh = 122` to the `uart_config` structure.
|
||||
|
||||
```
|
||||
--------------------------------------------------------------------------------------
|
||||
| Target chip Interface | #define | Default ESP Pin | External UART Pin |
|
||||
| ----------------------|-----------------|----------------------|--------------------
|
||||
| Transmit Data (TxD) | ECHO_TEST_RTS | GPIO18 | CTS |
|
||||
| Receive Data (RxD) | ECHO_TEST_CTS | GPIO19 | RTS |
|
||||
| Ground | n/a | GND | GND |
|
||||
--------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------
|
||||
| Target chip Interface | Macro | External UART Pin |
|
||||
| ----------------------|-----------------|--------------------
|
||||
| Transmit Data (TxD) | ECHO_TEST_RTS | CTS |
|
||||
| Receive Data (RxD) | ECHO_TEST_CTS | RTS |
|
||||
| Ground | n/a | GND |
|
||||
---------------------------------------------------------------
|
||||
```
|
||||
|
||||
### Configure the project
|
||||
|
||||
@@ -4,8 +4,8 @@ menu "Echo Example Configuration"
|
||||
int "UART port number"
|
||||
range 0 2 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S3
|
||||
default 2 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S3
|
||||
range 0 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
|
||||
default 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
|
||||
range 0 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2
|
||||
default 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2
|
||||
help
|
||||
UART communication port number for the example.
|
||||
See UART documentation for available port numbers.
|
||||
@@ -19,10 +19,12 @@ menu "Echo Example Configuration"
|
||||
|
||||
config EXAMPLE_UART_RXD
|
||||
int "UART RXD pin number"
|
||||
range 0 34 if IDF_TARGET_ESP32
|
||||
range 0 46 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
|
||||
range 0 39 if IDF_TARGET_ESP32
|
||||
range 0 46 if IDF_TARGET_ESP32S2
|
||||
range 0 19 if IDF_TARGET_ESP32C3
|
||||
range 0 47 if IDF_TARGET_ESP32S3
|
||||
range 0 48 if IDF_TARGET_ESP32S3
|
||||
range 0 18 if IDF_TARGET_ESP32C2
|
||||
range 0 25 if IDF_TARGET_ESP32H2
|
||||
default 5
|
||||
help
|
||||
GPIO number for UART RX pin. See UART documentation for more information
|
||||
@@ -30,10 +32,12 @@ menu "Echo Example Configuration"
|
||||
|
||||
config EXAMPLE_UART_TXD
|
||||
int "UART TXD pin number"
|
||||
range 0 34 if IDF_TARGET_ESP32
|
||||
range 0 46 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
|
||||
range 0 33 if IDF_TARGET_ESP32
|
||||
range 0 45 if IDF_TARGET_ESP32S2
|
||||
range 0 19 if IDF_TARGET_ESP32C3
|
||||
range 0 47 if IDF_TARGET_ESP32S3
|
||||
range 0 48 if IDF_TARGET_ESP32S3
|
||||
range 0 18 if IDF_TARGET_ESP32C2
|
||||
range 0 25 if IDF_TARGET_ESP32H2
|
||||
default 4
|
||||
help
|
||||
GPIO number for UART TX pin. See UART documentation for more information
|
||||
|
||||
Reference in New Issue
Block a user