Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memset in ROM exception when plug one ESP32-S3 in BOOT mode to another ESP32-S3 OTG (IDFGH-11111) #12283

Closed
3 tasks done
Bumanuu opened this issue Sep 21, 2023 · 3 comments
Closed
3 tasks done
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@Bumanuu
Copy link

Bumanuu commented Sep 21, 2023

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.2-dev-1890-g28167ea5a3

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

BPI-Leaf-S3

Power Supply used.

USB

What is the expected behavior?

Using esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp slightly modified example example.
This is normal behavior when I plug device with CP2102 Virtual COM Port chip in :
CP2102-VCP_.log

What is the actual behavior?

When plug another ESP32-S3 in BOOT mode to flashed with example above firmware first ESP32-S3 OTG port:
ESP32-S3-VCP.log

Linux detect those devices in BOOT mode as:

[17269.589717] usb 1-3.4: new full-speed USB device number 7 using xhci_hcd
[17269.711121] usb 1-3.4: New USB device found, idVendor=303a, idProduct=1001, bcdDevice= 1.01
[17269.711136] usb 1-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[17269.711143] usb 1-3.4: Product: USB JTAG/serial debug unit
[17269.711149] usb 1-3.4: Manufacturer: Espressif
[17269.711154] usb 1-3.4: SerialNumber: 48:27:E2:0D:7F:C4
[17269.713425] cdc_acm 1-3.4:1.0: ttyACM0: USB ACM device

Steps to reproduce.

  1. Move esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_ch34x_vcp folder to esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/components/espressif__usb_host_ch34x_vcp
  2. Modify esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/components/espressif__usb_host_ch34x_vcp/include/usb/vcp_ch34x.hpp like that:
//#define NANJING_QINHENG_MICROE_VID (0x1A86)
//#define CH340_PID                  (0x7522)
#define NANJING_QINHENG_MICROE_VID (0x303A)
#define CH340_PID                  (0x1001)
  1. Build and flash one ESP32-S3 (1) with esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp
  2. Plug in with USB cable another ESP32-S3 (2) in BOOT mode (BOOT button is pressed or pin 0 is connected to GND) to (1) ESP32-S3 USB-OTG socket.
  3. ESP32-S3 (1) is reporting about exception and rebooting cyclically.

Debug Logs.

bumanuu@bumanuux:~/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp$ /home/bumanuu/.espressif/python_env/idf5.2_py3.10_env/bin/python /home/bumanuu/DEV/GIT/esp-idf/tools/idf_monitor.py -p /dev/ttyACM0 -b 115200 --toolchain-prefix xtensa-esp32s3-elf- --target esp32s3 /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/build/cdc_acm_vcp.elf
--- idf_monitor on /dev/ttyACM0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3820,len:0x17a0
load:0x403c9700,len:0x4
load:0x403c9704,len:0xc08
load:0x403cc700,len:0x2f20
entry 0x403c990c
I (27) boot: ESP-IDF v5.2-dev-1890-g28167ea5a3-dirty 2nd stage bootloader
I (27) boot: compile time Sep 20 2023 12:45:20
I (28) boot: Multicore bootloader
I (32) boot: chip revision: v0.1
I (36) boot.esp32s3: Boot SPI Speed : 80MHz
I (41) boot.esp32s3: SPI Mode       : DIO
I (45) boot.esp32s3: SPI Flash Size : 2MB
I (50) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (59) boot: ## Label            Usage          Type ST Offset   Length
I (66) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (74) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (81) boot:  2 factory          factory app      00 00 00010000 00100000
I (89) boot: End of partition table
I (93) esp_image: segment 0: paddr=00010020 vaddr=3c030020 size=13b78h ( 80760) map
I (116) esp_image: segment 1: paddr=00023ba0 vaddr=3fc92700 size=029f0h ( 10736) load
I (119) esp_image: segment 2: paddr=00026598 vaddr=40374000 size=09a80h ( 39552) load
I (131) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=28154h (164180) map
I (160) esp_image: segment 4: paddr=0005817c vaddr=4037da80 size=04be8h ( 19432) load
I (171) boot: Loaded app from partition at offset 0x10000
I (171) boot: Disabling RNG early entropy source...
I (183) cpu_start: Multicore app
I (183) cpu_start: Pro cpu up.
I (183) cpu_start: Starting app cpu, entry point is 0x40375264
0x40375264: call_start_cpu1 at /home/bumanuu/DEV/GIT/esp-idf/components/esp_system/port/cpu_start.c:170

I (0) cpu_start: App cpu up.
I (201) cpu_start: Pro cpu start user code
I (201) cpu_start: cpu freq: 160000000 Hz
I (201) cpu_start: Application information:
I (204) cpu_start: Project name:     cdc_acm_vcp
I (210) cpu_start: App version:      v5.2-dev-1890-g28167ea5a3-dirty
I (217) cpu_start: Compile time:     Sep 20 2023 12:45:20
I (223) cpu_start: ELF file SHA256:  f494c561e...
I (228) cpu_start: ESP-IDF:          v5.2-dev-1890-g28167ea5a3-dirty
I (235) cpu_start: Min chip rev:     v0.0
I (240) cpu_start: Max chip rev:     v0.99 
I (245) cpu_start: Chip rev:         v0.1
I (249) heap_init: Initializing. RAM available for dynamic allocation:
I (257) heap_init: At 3FC959D0 len 00053D40 (335 KiB): DRAM
I (263) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (269) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (276) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (283) spi_flash: detected chip: gd
I (286) spi_flash: flash io: dio
W (290) spi_flash: Detected size(16384k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (304) sleep: Configure to isolate all GPIO pins in sleep state
I (310) sleep: Enable automatic switching of GPIO sleep configuration
I (317) app_start: Starting scheduler on CPU0
I (322) app_start: Starting scheduler on CPU1
I (322) main_task: Started on CPU0
I (332) main_task: Calling app_main()
I (332) VCP example: Installing USB Host
I (372) VCP example: Installing CDC-ACM driver
I (372) VCP example: Opening any VCP device...
I (5772) VCP example: Failed to open VCP device
I (5772) VCP example: Opening any VCP device...
I (11172) VCP example: Failed to open VCP device
I (11172) VCP example: Opening any VCP device...
I (11622) VCP example: USB: All devices freed
I (16572) VCP example: Failed to open VCP device
I (16572) VCP example: Opening any VCP device...
I (20952) VCP example: USB: All devices freed
I (21972) VCP example: Failed to open VCP device
I (21972) VCP example: Opening any VCP device...
I (27372) VCP example: Failed to open VCP device
I (27372) VCP example: Opening any VCP device...
I (32772) VCP example: Failed to open VCP device
I (32772) VCP example: Opening any VCP device...
I (38172) VCP example: Failed to open VCP device
I (38172) VCP example: Opening any VCP device...
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x4200ac4c  PS      : 0x00060d30  A0      : 0x8200b20e  A1      : 0x3fc99410  
0x4200ac4c: cdc_acm_transfers_allocate at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_cdc_acm/cdc_acm_host.c:625

A2      : 0x3fc9d394  A3      : 0x3fc9d890  A4      : 0x00000000  A5      : 0x00000200  
A6      : 0x00000000  A7      : 0x00000200  A8      : 0x4200a8dc  A9      : 0x3fc993f0  
0x4200a8dc: in_xfer_cb at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_cdc_acm/cdc_acm_host.c:1009

A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3fc9d3a0  A13     : 0x3fc9d7a8  
A14     : 0xb33fffff  A15     : 0xb33fffff  SAR     : 0x0000001b  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000002  LBEG    : 0x400570e8  LEND    : 0x400570f3  LCOUNT  : 0x00000000  
0x400570e8: memset in ROM

0x400570f3: memset in ROM



Backtrace: 0x4200ac49:0x3fc99410 0x4200b20b:0x3fc99470 0x42009bda:0x3fc994c0 0x42009391:0x3fc994e0 0x420093bd:0x3fc99500 0x4200a4be:0x3fc99520 0x42009969:0x3fc99590 0x4202790b:0x3fc99600 0x4037c55d:0x3fc99630
0x4200ac49: cdc_acm_transfers_allocate at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_cdc_acm/cdc_acm_host.c:624

0x4200b20b: cdc_acm_host_open_vendor_specific at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_cdc_acm/cdc_acm_host.c:859 (discriminator 6)

0x42009bda: CdcAcmDevice::open_vendor_specific(unsigned short, unsigned short, unsigned char, cdc_acm_host_device_config_t const*) at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_cdc_acm/include/usb/cdc_acm_host.h:317
 (inlined by) esp_usb::CH34x::CH34x(unsigned short, cdc_acm_host_device_config_t const*, unsigned char) at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/components/espressif__usb_host_ch34x_vcp/usb_host_ch34x_vcp.cpp:71

0x42009391: esp_usb::VCP::register_driver<esp_usb::CH34x>()::{lambda(unsigned short, cdc_acm_host_device_config_t const*, unsigned char)#1}::operator()(unsigned short, cdc_acm_host_device_config_t const*, unsigned char) const at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_vcp/include/usb/vcp.hpp:52

0x420093bd: esp_usb::VCP::register_driver<esp_usb::CH34x>()::{lambda(unsigned short, cdc_acm_host_device_config_t const*, unsigned char)#1}::_FUN(unsigned short, cdc_acm_host_device_config_t const*, unsigned char) at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_vcp/include/usb/vcp.hpp:51

0x4200a4be: esp_usb::VCP::open(cdc_acm_host_device_config_t const*, unsigned char) at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/managed_components/espressif__usb_host_vcp/usb_host_vcp.cpp:72

0x42009969: app_main at /home/bumanuu/DEV/GIT/esp-idf/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/cdc_acm_vcp_example_main.cpp:144

0x4202790b: main_task at /home/bumanuu/DEV/GIT/esp-idf/components/freertos/app_startup.c:217 (discriminator 13)

0x4037c55d: vPortTaskWrapper at /home/bumanuu/DEV/GIT/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162





ELF file SHA256: f494c561e

Rebooting...

More Information.

No response

@Bumanuu Bumanuu added the Type: Bug bugs in IDF label Sep 21, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 21, 2023
@github-actions github-actions bot changed the title memset in ROM exception when plug one ESP32-S3 in BOOT mode to another ESP32-S3 OTG memset in ROM exception when plug one ESP32-S3 in BOOT mode to another ESP32-S3 OTG (IDFGH-11111) Sep 21, 2023
@tore-espressif
Copy link
Collaborator

Hello @Bumanuu

I'll check the abort condition in cdc_acm_host component.

Meanwhile, the cdc_acm_vcp example is intended for CDC-like devices, that implement vendor specific class. Like the CP2102.

If you want to experiment with the original CDC-ACM driver, this example might work better for you https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/cdc/cdc_acm_host

@tore-espressif
Copy link
Collaborator

We released version 2.0.2 of usb_host_cdc_acm that will not crash on this condition.

However the device will not be opened. Please try the cdc_acm_host example. Modify VID and PID in the beginning of the main.c file, it should work OK with your USB device.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Nov 21, 2023
@tore-espressif
Copy link
Collaborator

Please feel free to reopen if the problem persists

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants