Skip to content

Commit 947efcc

Browse files
committed
Merge branch 'fix/update_usb_uf2_bsp_version' into 'master'
fix(usb_uf2): fix ci warning caused by bsp version See merge request ae_group/esp-iot-solution!1382
2 parents 208347b + 1aecd03 commit 947efcc

File tree

6 files changed

+49
-27
lines changed

6 files changed

+49
-27
lines changed

examples/usb/device/usb_uf2_nvs/main/idf_component.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ dependencies:
33
esp_tinyuf2:
44
version: "*"
55
override_path: "../../../../../components/usb/esp_tinyuf2"
6-
espressif/esp32_s3_usb_otg:
7-
version: "^1.5.1"
8-
rules:
9-
- if: "target in [esp32s3]"

examples/usb/device/usb_uf2_nvs/main/usb_uf2_nvs_main.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
1+
/* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
22
*
33
* SPDX-License-Identifier: Apache-2.0
44
*/
@@ -9,15 +9,13 @@
99
#include "freertos/FreeRTOS.h"
1010
#include "freertos/task.h"
1111
#include "freertos/event_groups.h"
12+
#include "driver/gpio.h"
1213
#include "esp_log.h"
1314
#include "esp_system.h"
1415
#include "esp_wifi.h"
1516
#include "nvs.h"
1617
#include "nvs_flash.h"
1718
#include "esp_tinyuf2.h"
18-
#ifdef CONFIG_ESP32_S3_USB_OTG
19-
#include "bsp/esp-bsp.h"
20-
#endif
2119

2220
static const char *TAG = "uf2_nvs_example";
2321
#define EXAMPLE_ESP_MAXIMUM_RETRY 5
@@ -98,7 +96,15 @@ static void uf2_nvs_modified_cb()
9896
void app_main(void)
9997
{
10098
#ifdef CONFIG_ESP32_S3_USB_OTG
101-
bsp_usb_mode_select_device();
99+
const gpio_config_t io_config = {
100+
.pin_bit_mask = BIT64(GPIO_NUM_18),
101+
.mode = GPIO_MODE_OUTPUT,
102+
.pull_up_en = GPIO_PULLUP_DISABLE,
103+
.pull_down_en = GPIO_PULLDOWN_DISABLE,
104+
.intr_type = GPIO_INTR_DISABLE
105+
};
106+
ESP_ERROR_CHECK(gpio_config(&io_config));
107+
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_18, 0));
102108
#endif
103109
esp_err_t err = ESP_OK;
104110
const char *uf2_nvs_partition = "nvs";

examples/usb/device/usb_uf2_ota/main/idf_component.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ dependencies:
33
esp_tinyuf2:
44
version: "*"
55
override_path: "../../../../../components/usb/esp_tinyuf2"
6-
espressif/esp32_s3_usb_otg:
7-
version: "^1.5.1"
8-
rules:
9-
- if: "target in [esp32s3]"

examples/usb/device/usb_uf2_ota/main/usb_uf2_ota_main.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
1+
/* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
22
*
33
* SPDX-License-Identifier: Apache-2.0
44
*/
@@ -7,12 +7,10 @@
77
#include "sdkconfig.h"
88
#include "freertos/FreeRTOS.h"
99
#include "freertos/task.h"
10+
#include "driver/gpio.h"
1011
#include "esp_log.h"
1112
#include "esp_system.h"
1213
#include "esp_tinyuf2.h"
13-
#ifdef CONFIG_ESP32_S3_USB_OTG
14-
#include "bsp/esp-bsp.h"
15-
#endif
1614

1715
static const char *TAG = "uf2_ota_example";
1816

@@ -25,7 +23,15 @@ static void uf2_update_complete_cb()
2523
void app_main(void)
2624
{
2725
#ifdef CONFIG_ESP32_S3_USB_OTG
28-
bsp_usb_mode_select_device();
26+
const gpio_config_t io_config = {
27+
.pin_bit_mask = BIT64(GPIO_NUM_18),
28+
.mode = GPIO_MODE_OUTPUT,
29+
.pull_up_en = GPIO_PULLUP_DISABLE,
30+
.pull_down_en = GPIO_PULLDOWN_DISABLE,
31+
.intr_type = GPIO_INTR_DISABLE
32+
};
33+
ESP_ERROR_CHECK(gpio_config(&io_config));
34+
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_18, 0));
2935
#endif
3036
/* install UF2 OTA */
3137
tinyuf2_ota_config_t config = DEFAULT_TINYUF2_OTA_CONFIG();

examples/usb/host/usb_cdc_basic/main/idf_component.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ dependencies:
33
iot_usbh_cdc:
44
version: "^2.0.0"
55
override_path: "../../../../../components/usb/iot_usbh_cdc"
6-
espressif/esp32_s3_usb_otg:
7-
version: "^1.5.1"
8-
rules:
9-
- if: "target in [esp32s3]"

examples/usb/host/usb_cdc_basic/main/usb_cdc_basic_main.c

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
#include <string.h>
99
#include "freertos/FreeRTOS.h"
1010
#include "freertos/task.h"
11+
#include "driver/gpio.h"
1112
#include "esp_log.h"
1213
#include "iot_usbh_cdc.h"
13-
#ifdef CONFIG_ESP32_S3_USB_OTG
14-
#include "bsp/esp-bsp.h"
15-
#endif
1614

1715
static const char *TAG = "cdc_basic_demo";
1816

@@ -62,8 +60,32 @@ static void usb_disconnect_callback(usbh_cdc_handle_t cdc_handle, void *user_dat
6260
void app_main(void)
6361
{
6462
#ifdef CONFIG_ESP32_S3_USB_OTG
65-
bsp_usb_mode_select_host();
66-
bsp_usb_host_power_mode(BSP_USB_HOST_POWER_MODE_USB_DEV, true);
63+
// USB mode select host
64+
const gpio_config_t io_config = {
65+
.pin_bit_mask = BIT64(GPIO_NUM_18),
66+
.mode = GPIO_MODE_OUTPUT,
67+
.pull_up_en = GPIO_PULLUP_DISABLE,
68+
.pull_down_en = GPIO_PULLDOWN_DISABLE,
69+
.intr_type = GPIO_INTR_DISABLE
70+
};
71+
ESP_ERROR_CHECK(gpio_config(&io_config));
72+
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_18, 1));
73+
74+
// Set host usb dev power mode
75+
const gpio_config_t power_io_config = {
76+
.pin_bit_mask = BIT64(GPIO_NUM_17) | BIT64(GPIO_NUM_12) | BIT64(GPIO_NUM_13),
77+
.mode = GPIO_MODE_OUTPUT,
78+
.pull_up_en = GPIO_PULLUP_DISABLE,
79+
.pull_down_en = GPIO_PULLDOWN_DISABLE,
80+
.intr_type = GPIO_INTR_DISABLE
81+
};
82+
ESP_ERROR_CHECK(gpio_config(&power_io_config));
83+
84+
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Configure the limiter 500mA
85+
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_12, 0));
86+
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_13, 0)); // Turn power off
87+
vTaskDelay(pdMS_TO_TICKS(10));
88+
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_12, 1)); // Turn on usb dev power mode
6789
#endif
6890
/* install usbh cdc driver with skip_init_usb_host_driver */
6991
usbh_cdc_driver_config_t config = {

0 commit comments

Comments
 (0)