Skip to content

Commit 4bf90fb

Browse files
committed
Merge branch 'feat/usb_uart_bridge_support_p4' into 'master'
feat(usb_device): usb uart bridge supports esp32p4 Closes AEGHB-870 See merge request ae_group/esp-iot-solution!1360
2 parents 23dcb76 + c8d3917 commit 4bf90fb

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed

.gitlab/ci/build.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,7 @@ build_example_usb_device_usb_uart_bridge:
805805
extends:
806806
- .build_examples_template
807807
- .rules:build:example_usb_device_usb_uart_bridge
808-
parallel:
809-
matrix:
810-
- IMAGE: espressif/idf:release-v4.4
811-
- IMAGE: espressif/idf:release-v5.0
808+
- .build_idf_active_release_version
812809
variables:
813810
EXAMPLE_DIR: examples/usb/device/usb_uart_bridge
814811

examples/usb/device/usb_uart_bridge/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,20 @@ The example using `ESP32-S3-OTG` board by default, the IO configuration is as fo
4848
| 19 | USB D- | Fixed |
4949
| 46 | UART-RX | Link to target board TX |
5050
| 45 | UART-TX | Link to target board RX |
51-
| 26 | Boot(IO0) | Link to target board Boot(IO0) |
51+
| 26 | Boot | Link to target board Boot |
5252
| 3 | EN (RST) | Link to target board EN(RST) |
5353

54+
If you are using `ESP32-P4-Function-EV-Board` board, the IO configuration is as follows:
55+
56+
| ESP32-P4 IO | Function | Remark |
57+
| :---------: | :-------: | :----------------------------: |
58+
| pin 50 | USB D+ | Fixed |
59+
| pin 49 | USB D- | Fixed |
60+
| 27 | UART-RX | Link to target board TX |
61+
| 46 | UART-TX | Link to target board RX |
62+
| 6 | Boot | Link to target board Boot |
63+
| 5 | EN (RST) | Link to target board EN(RST) |
64+
5465
### Build and Flash
5566

5667
1. Make sure `ESP-IDF` is setup successfully
@@ -61,7 +72,7 @@ The example using `ESP32-S3-OTG` board by default, the IO configuration is as fo
6172
. $HOME/esp/esp-idf/export.sh
6273
```
6374

64-
3. Set ESP-IDF build target to `esp32s2` or `esp32s3`
75+
3. Set ESP-IDF build target to `esp32s2`, `esp32s3` or `esp32p4`
6576

6677
```bash
6778
idf.py set-target esp32s3

examples/usb/device/usb_uart_bridge/main/Kconfig.projbuild

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,45 @@ menu "USB UART Bridge Example"
55
default y
66
config BOARD_AUTODLD_EN_PIN
77
int "Auto download EN(RST) pin"
8-
default 3
8+
range 0 46 if IDF_TARGET_ESP32S2
9+
range 0 48 if IDF_TARGET_ESP32S3
10+
range 0 54 if IDF_TARGET_ESP32P4
11+
default 3 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
12+
default 5 if IDF_TARGET_ESP32P4
913
depends on UART_AUTO_DOWNLOAD
1014
config BOARD_AUTODLD_BOOT_PIN
1115
int "Auto download BOOT pin"
12-
default 26
16+
range 0 46 if IDF_TARGET_ESP32S2
17+
range 0 48 if IDF_TARGET_ESP32S3
18+
range 0 54 if IDF_TARGET_ESP32P4
19+
default 26 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
20+
default 6 if IDF_TARGET_ESP32P4
1321
depends on UART_AUTO_DOWNLOAD
1422
config BOARD_UART_TXD_PIN
1523
int "UART TXD pin"
16-
default 45
24+
range 0 46 if IDF_TARGET_ESP32S2
25+
range 0 48 if IDF_TARGET_ESP32S3
26+
range 0 54 if IDF_TARGET_ESP32P4
27+
default 45 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
28+
default 46 if IDF_TARGET_ESP32P4
1729
config BOARD_UART_RXD_PIN
1830
int "UART RXD pin"
19-
default 46
31+
range 0 46 if IDF_TARGET_ESP32S2
32+
range 0 48 if IDF_TARGET_ESP32S3
33+
range 0 54 if IDF_TARGET_ESP32P4
34+
default 46 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
35+
default 27 if IDF_TARGET_ESP32P4
2036
config UART_RX_BUF_SIZE
2137
int "UART RX buffer size (Bytes)"
22-
default 256
38+
default 256 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
39+
default 512 if IDF_TARGET_ESP32P4
2340
config UART_TX_BUF_SIZE
2441
int "UART TX buffer size (Bytes)"
2542
default 1024
2643
config USB_RX_BUF_SIZE
2744
int "USB RX buffer size (Bytes)"
28-
default 256
45+
default 256 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
46+
default 512 if IDF_TARGET_ESP32P4
2947
config USB_TX_BUF_SIZE
3048
int "USB TX buffer size (Bytes)"
3149
default 1024
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
targets:
22
- esp32s2
33
- esp32s3
4+
- esp32p4
45
dependencies:
56
espressif/esp_tinyusb:
6-
version: "~=1.3.1"
7+
version: "^1.7.0"
78
rules:
89
- if: "idf_version >=5.0"

examples/usb/device/usb_uart_bridge/main/usb_uart_bridge_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ static void board_uart_init(void)
7070
.parity = CFG_PARITY(s_parity_active),
7171
.stop_bits = CFG_STOP_BITS(s_stop_bits_active),
7272
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
73+
#if CONFIG_IDF_TARGET_ESP32P4
74+
.source_clk = UART_SCLK_DEFAULT,
75+
#else
7376
.source_clk = UART_SCLK_APB,
77+
#endif
7478
};
7579

7680
uart_driver_install(BOARD_UART_PORT, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, 0, NULL, 0);

0 commit comments

Comments
 (0)