From f64cf7c5a6204562d0db464621e68455942542cd Mon Sep 17 00:00:00 2001 From: Jaroslav Burian Date: Mon, 9 Dec 2024 10:59:29 +0100 Subject: [PATCH] fix: Update USB reset sequence This commit fixes the USB reset sequence for the ESP32 USB CDC ACM port. loader_port_reset_target() function kept the target in reset state so it was not be possible to use it standalone. This commit also makes the entering the bootloader to go through state where BOOT and RESET are both set. --- port/esp32_usb_cdc_acm_port.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/port/esp32_usb_cdc_acm_port.c b/port/esp32_usb_cdc_acm_port.c index 0b06b63..5df1e4b 100644 --- a/port/esp32_usb_cdc_acm_port.c +++ b/port/esp32_usb_cdc_acm_port.c @@ -88,6 +88,7 @@ static void usb_serial_jtag_reset_target(void) xStreamBufferReset(s_rx_stream_buffer); cdc_acm_host_set_control_line_state(s_acm_device, false, true); loader_port_delay_ms(SERIAL_FLASHER_RESET_HOLD_TIME_MS); + cdc_acm_host_set_control_line_state(s_acm_device, false, false); } static void usb_serial_jtag_enter_booloader(void) @@ -96,10 +97,10 @@ static void usb_serial_jtag_enter_booloader(void) loader_port_delay_ms(SERIAL_FLASHER_BOOT_HOLD_TIME_MS); + cdc_acm_host_set_control_line_state(s_acm_device, true, true); usb_serial_jtag_reset_target(); } - static void usb_serial_converter_reset_target(void) { xStreamBufferReset(s_rx_stream_buffer);