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

Only two SPI, usb, and sdmmc interfaces can be initialized, and the third one fails. (IDFGH-11567) #12688

Closed
3 tasks done
wishinlife opened this issue Nov 29, 2023 · 4 comments
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@wishinlife
Copy link

wishinlife commented Nov 29, 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.1.2

Espressif SoC revision.

ESP32-S3-N8R2

Operating System used.

Linux

How did you build your project?

VS Code IDE

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

None

Development Kit.

Custom board

Power Supply used.

USB

What is the expected behavior?

I need to use 2 spi ports (one to W5500 and one to WK2124), USB port (SIMCom A7670) and SDMMC (SDIO), a total of 4 devices, and these 4 devices will be used at the same time.

What is the actual behavior?

However, no matter what the initialization order of these 4 devices is, only the first 2 will be initialized successfully, and the later ones will report ESP_ERR_NOT_FOUND errors.

Steps to reproduce.

  1. Initialization SDMMC(SDIO)
  2. Initialization USB(4G)
  3. vTaskDelay(pdMS_TO_TICKS(10 * 1000));
  4. Initialization W5500(SPI)
    ...

Debug Logs.

--- esp-idf-monitor 1.3.3 on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ash slave_ota part�ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x2b (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3978,len:0x18f8
load:0x403c9700,len:0x4
load:0x403c9704,len:0xc18
load:0x403cc700,len:0x2e60
entry 0x403c990c
W (22) boot.esp32s3: eFuse virtual mode is enabled. If Secure boot or Flash encryption is enabled then it does not provide any security. FOR TESTING ONLY!
W (29) efuse: [Virtual] Loading virtual efuse blocks from real efuses
I (48) boot: ESP-IDF v5.1.2 2nd stage bootloader
I (48) boot: compile time Nov 27 2023 21:07:14
I (49) boot: Multicore bootloader
I (52) boot: chip revision: v0.2
I (55) boot.esp32s3: Boot SPI Speed : 80MHz
I (60) boot.esp32s3: SPI Mode       : DIO
I (65) boot.esp32s3: SPI Flash Size : 8MB
I (70) boot: Enabling RNG early entropy source...
I (75) boot: Partition Table:
I (79) boot: ## Label            Usage          Type ST Offset   Length
I (86) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (93) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (101) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (108) boot:  3 factory          factory app      00 00 00010000 00200000
I (116) boot:  4 ota_0            OTA app          00 10 00210000 00200000
I (123) boot:  5 ota_1            OTA app          00 11 00410000 00200000
I (131) boot:  6 appdata          WiFi data        01 02 00610000 00100000
I (139) boot:  7 coredump         Unknown data     01 03 00710000 00010000
I (146) boot:  8 slave_ota        Unknown data     01 81 00720000 00084000
I (154) boot: End of partition table
I (158) boot: Defaulting to factory image
I (163) esp_image: segment 0: paddr=00010020 vaddr=3c0a0020 size=339d8h (211416) map
I (209) esp_image: segment 1: paddr=00043a00 vaddr=3fc9dd00 size=04248h ( 16968) load
I (213) esp_image: segment 2: paddr=00047c50 vaddr=40374000 size=083c8h ( 33736) load
I (222) esp_image: segment 3: paddr=00050020 vaddr=42000020 size=9f2a0h (651936) map
I (340) esp_image: segment 4: paddr=000ef2c8 vaddr=4037c3c8 size=11900h ( 71936) load
I (367) boot: Loaded app from partition at offset 0x10000
I (367) boot: Disabling RNG early entropy source...
I (378) cpu_start: Multicore app
I (379) esp_psram: Found 2MB PSRAM device
I (379) esp_psram: Speed: 80MHz
I (380) cpu_start: Pro cpu up.
I (383) cpu_start: Starting app cpu, entry point is 0x403759a8
0x403759a8: call_start_cpu1 at /home/user/esp/esp-idf/components/esp_system/port/cpu_start.c:157

I (0) cpu_start: App cpu up.
I (620) esp_psram: SPI SRAM memory test OK
I (629) cpu_start: Pro cpu start user code
I (629) cpu_start: cpu freq: 240000000 Hz
I (629) cpu_start: Application information:
I (632) cpu_start: Project name:     IoT-Station
I (637) cpu_start: App version:      2.0.0
I (642) cpu_start: Compile time:     Nov 29 2023 10:52:26
I (648) cpu_start: ELF file SHA256:  d607767f5ae0a5d3...
I (654) cpu_start: ESP-IDF:          v5.1.2
I (659) cpu_start: Min chip rev:     v0.0
I (664) cpu_start: Max chip rev:     v0.99 
I (669) cpu_start: Chip rev:         v0.2
I (673) heap_init: Initializing. RAM available for dynamic allocation:
I (681) heap_init: At 3FCA4EF0 len 00044820 (274 KiB): DRAM
I (687) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (694) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (700) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (706) esp_psram: Adding pool of 2048K of PSRAM memory to heap allocator
I (714) spi_flash: detected chip: gd
I (718) spi_flash: flash io: dio
W (722) cpu_start: eFuse virtual mode is enabled. If Secure boot or Flash encryption is enabled then it does not provide any security. FOR TESTING ONLY!
W (736) efuse: [Virtual] Loading virtual efuse blocks from real efuses
I (743) sleep: Configure to isolate all GPIO pins in sleep state
I (750) sleep: Enable automatic switching of GPIO sleep configuration
I (757) coexist: coex firmware version: b6d5e8c
I (762) coexist: coexist rom version e7ae62f
I (768) app_start: Starting scheduler on CPU0
I (772) app_start: Starting scheduler on CPU1
I (772) main_task: Started on CPU0
I (782) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (792) main_task: Calling app_main()
I (792) [Main]: IoT-Station app_main starting
I (802) [Main]: SHA-256 for the partition table: : 992f8063bb66f8d52dd980c43fe230ad9264c36d768ac7be31c83259e92bba43
I (812) [Main]: SHA-256 for bootloader: : 9419022c210c4f46b4a0bff849dcec93cd69fe648833d019d545de775134b5fc
I (897) [Main]: SHA-256 for current firmware: : 4fb7ee4c2d64214aaddef81e9eb25bab874aad40dd67ab48fc546687567028fd
I (922) [SD2068]: SD2068 check success
I (922) [SD2068]: SD2068 time reliable.
tv_sec: 1701259537
HW RTC time: 2023-11-29 12:05:37
I (922) [SD2068]: System current time : Wed Nov 29 12:05:37 2023
I (927) [blink]: Configured to run staus LED.
I (937) gpio: GPIO[48]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1147) [SDMMC]: Initializing SD card
I (1147) [SDMMC]: Using SDMMC peripheral
I (1147) [SDMMC]: Mounting filesystem
I (1147) gpio: GPIO[42]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1157) gpio: GPIO[40]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1167) gpio: GPIO[4]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1177) gpio: GPIO[5]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1187) gpio: GPIO[41]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1192) gpio: GPIO[39]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1252) gpio: GPIO[39]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1252) [SDMMC]: SDMMC filesystem mounted
Name: MK004A�
Type: MMC
Speed: 22.86 MHz (limit: 26.00 MHz), DDR
Size: 3700MB
CSD: ver=3, sector_size=512, capacity=7577600 read_bl_len=9
EXT CSD: bus_width=4
I (1272) [SDMMC]: SPIFlash slave_ota partition mounted
I (1277) [NVS_APP]: Model Restart counter = 594
I (1292) [NVS_APP]: System config not found, saved init data(size: 480).
I (1292) [SD2068]: Set timezone to UTC-08:00.
I (1292) [Main]: Version: 2.0.0, Compile time: Nov 29 2023 10:52:26, idf_ver: v5.1.2
W (1302) [Main]: System power on, reset reason code of cpu 0: 0x01.
W (1307) [Main]: System power on, reset reason code of cpu 1: 0x01.
I (1312) GPS_EMBED: Start gps on UART 2.
I (1317) uart: queue free spaces: 10
I (1322) GPS_EMBED: GPS uart_event_task start.
I (1327) GPS_EMBED: Start gps success on UART 2.
I (1332) temperature_sensor: Range [-10°C ~ 80°C], error < 1°C
I (1342) [Common]: Chip Temperature value 39.10 ℃
Temperature value 39.10 °C
I (1347) [4GModem]: ====================================
I (1352) [4GModem]:      ESP 4G Cat.1 Wi-Fi Router
I (1357) [4GModem]: ====================================
I (1367) modem_board: iot_usbh_modem, version: 0.2.1
I (1372) modem_board: Force reset modem board....
I (1377) gpio: GPIO[6]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1387) modem_board: Resetting modem using io=6, level=0
I (1592) modem_board: Waiting for modem initialize ready
I (6592) USB_HCDC: iot_usbh_cdc, version: 0.2.1
I (6592) IOT_USBH: iot_usbh, version: 0.2.1
I (6622) IOT_USBH: USB Port=1 init succeed, fifo strategy=0
I (6622) IOT_USBH: usb port start succeed
I (6622) IOT_USBH: USB Processing Start
I (6622) USB_HCDC: usbh cdc driver install succeed
I (6622) IOT_USBH: Waiting USB Connection
I (6632) USB_HCDC: Waiting CDC Device Connection
I (6632) IOT_USBH: Port power: ON Succeed
I (6622) USB_HCDC: CDC task start
I (8737) IOT_USBH: line 131 PORT_EVENT_CONNECTION
I (8837) IOT_USBH: Resetting Port
I (8897) IOT_USBH: Port reset succeed
I (8897) IOT_USBH: Getting Port Speed
I (8897) IOT_USBH: USB Speed: full-speed
I (8897) IOT_USBH: Pipe init succeed, addr: 00
I (8907) IOT_USBH: Set Device Addr = 1
I (8907) IOT_USBH: Set Device Addr Done
I (8912) IOT_USBH: get device desc
I (8917) IOT_USBH: get device desc, actual_num_bytes:26
*** Device descriptor ***
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0xef
bDeviceSubClass 0x2
bDeviceProtocol 0x1
bMaxPacketSize0 64
idVendor 0x1e0e
idProduct 0x9011
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerialNumber 3
bNumConfigurations 1
I (8947) IOT_USBH: get short config desc
I (8952) IOT_USBH: get config desc, actual_num_bytes:16
I (8957) IOT_USBH: get full config desc
I (8962) IOT_USBH: get full config desc, actual_num_bytes:204
*** Configuration descriptor ***
bLength 9
bDescriptorType 2
wTotalLength 196
bNumInterfaces 5
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
bMaxPower 500mA
*** Interface Association Descriptor ***
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 0xe0
bFunctionSubClass 0x1
bFunctionProtocol 0x3
iFunction 5
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 0
        bAlternateSetting 0
        bNumEndpoints 1
        bInterfaceClass 0xe0
        bInterfaceSubClass 0x1
        bInterfaceProtocol 0x3
        iInterface 5
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x87   EP 7 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 64
                bInterval 16
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 1
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xa
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 5
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x83   EP 3 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0xc    EP 12 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 2
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x82   EP 2 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0xb    EP 11 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 4
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 11
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x89   EP 9 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 64
                bInterval 16
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x86   EP 6 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0xf    EP 15 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 5
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 11
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x88   EP 8 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 64
                bInterval 16
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x81   EP 1 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0xa    EP 10 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
I (9242) IOT_USBH: Set Device Configuration = 1
I (9252) IOT_USBH: Set Device Configuration Done
I (9257) IOT_USBH: Pipe init succeed, addr: 81
I (9262) IOT_USBH: Pipe init succeed, addr: 0A
I (9267) USB_HCDC: CDC Device Connected
I (9272) esp-modem: --------- Modem PreDefined Info ------------------
I (9277) esp-modem: Model: A7600C1
I (9282) esp-modem: Modem itf: IN Addr:0x81, OUT Addr:0x0A
I (9287) esp-modem: ----------------------------------------------------
I (9297) gpio: GPIO[6]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (9307) modem_board: DTE reconnect, reconnecting ...

I (9307) USB_HCDC: rx0 flush -15 = 15
I (10312) modem_board: reconnect after 5s...
I (11312) modem_board: reconnect after 4s...
E (11392) w5500.mac: esp_eth_mac_new_w5500(768): adding device to SPI host #2 failed
E (11392) esp_eth: esp_eth_driver_install(189): can't set eth->mac or eth->phy to null
ESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x42010318
0x42010318: W5500_init at /home/user/esp-projects/IoT-Station-ESP32-S3-New/build/../main/src/Sys/w5500.c:159 (discriminator 1)

file: "../main/src/Sys/w5500.c" line 159
func: W5500_init
expression: esp_eth_driver_install(&eth_config_spi, &eth_handle_spi[i])

abort() was called at PC 0x40383d73 on core 0
0x40383d73: _esp_error_check_failed at /home/user/esp/esp-idf/components/esp_system/esp_err.c:50



Backtrace: 0x40375f3e:0x3fca8890 0x40383d7d:0x3fca88b0 0x4038ba3a:0x3fca88d0 0x40383d73:0x3fca8940 0x42010318:0x3fca8970 0x4200b511:0x3fca8ad0 0x4209e8f7:0x3fca8ba0 0x40386b11:0x3fca8bd0
0x40375f3e: panic_abort at /home/user/esp/esp-idf/components/esp_system/panic.c:452

0x40383d7d: esp_system_abort at /home/user/esp/esp-idf/components/esp_system/port/esp_system_chip.c:84

0x4038ba3a: abort at /home/user/esp/esp-idf/components/newlib/abort.c:38

0x40383d73: _esp_error_check_failed at /home/user/esp/esp-idf/components/esp_system/esp_err.c:50

0x42010318: W5500_init at /home/user/esp-projects/IoT-Station-ESP32-S3-New/build/../main/src/Sys/w5500.c:159 (discriminator 1)

0x4200b511: app_main at /home/user/esp-projects/IoT-Station-ESP32-S3-New/build/../main/main.c:430

0x4209e8f7: main_task at /home/user/esp/esp-idf/components/freertos/app_startup.c:208 (discriminator 13)

0x40386b11: vPortTaskWrapper at /home/user/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162





ELF file SHA256: d607767f5ae0a5d3

CPU halted.

More Information.

No response

@wishinlife wishinlife added the Type: Bug bugs in IDF label Nov 29, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 29, 2023
@github-actions github-actions bot changed the title SPI、usb、sdmmc接口只能初始化成功2个,第三个会失败 SPI、usb、sdmmc接口只能初始化成功2个,第三个会失败 (IDFGH-11567) Nov 29, 2023
@wishinlife wishinlife changed the title SPI、usb、sdmmc接口只能初始化成功2个,第三个会失败 (IDFGH-11567) Only two SPI, usb, and sdmmc interfaces can be initialized, and the third one fails. (IDFGH-11567) Nov 29, 2023
@wishinlife
Copy link
Author

wishinlife commented Nov 29, 2023

1、初始化了2个SPI后(或1个SDMMC和1个SPI),初始化2个UART,第二个UART失败,只是初始化1个SPI后(或一个SDMMC),2个UART可以成功:
E (1328) uart: uart_driver_install(1614): Could not allocate an interrupt for UART
E (1338) GPS: GPS uart port driver install error: 261(ESP_ERR_NOT_FOUND).

2、先初始化SDMMC(1个),后初始化SPI(2个),再初始化UART(2个),前3个可以成功(SDMMC+2个SPI),两个UART都失败:
E (1454) uart: uart_driver_install(1614): Could not allocate an interrupt for UART
E (1464) [RS485]: Uart port driver install error: 261(ESP_ERR_NOT_FOUND).
I (1469) uart: ALREADY NULL
I (1474) [GPS]: Start gps on UART 2.
I (1479) uart: queue free spaces: 10
E (1484) uart: uart_driver_install(1614): Could not allocate an interrupt for UART
E (1489) [GPS]: GPS uart port driver install error: 261(ESP_ERR_NOT_FOUND).

3、先初始化SDMMC(1个),后初始化UART(2个),最后初始化SPI(2个),前3个可以成功(SDMMC+2个UART),后面SPI失败:
E (1329) w5500.mac: esp_eth_mac_new_w5500(768): adding device to SPI host #2 failed
E (1339) esp_eth: esp_eth_driver_install(189): can't set eth->mac or eth->phy to null
ESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x4200ffe0
0x4200ffe0: W5500_init at /home/user/esp-projects/IoT-Station-ESP32-S3-New/build/../main/src/Sys/w5500.c:159 (discriminator 1)

file: "../main/src/Sys/w5500.c" line 159
func: W5500_init
expression: esp_eth_driver_install(&eth_config_spi, &eth_handle_spi[i])

abort() was called at PC 0x40383b1f on core 0
0x40383b1f: _esp_error_check_failed at /home/user/esp/esp-idf/components/esp_system/esp_err.c:50

4、先初始化SDMMC(1个),后初始化SPI(2个),再初始化USB,最后初始化UART(2个),最前3个可以成功(SDMMC+2个SPI),后面USB和UART失败:
I (1519) uart: queue free spaces: 10
E (1524) uart: uart_driver_install(1614): Could not allocate an interrupt for UART
E (1534) [RS485]: Uart port driver install error: 261(ESP_ERR_NOT_FOUND).
I (1539) uart: ALREADY NULL
I (1544) [GPS]: Start gps on UART 2.
I (1549) uart: queue free spaces: 10
E (1554) uart: uart_driver_install(1614): Could not allocate an interrupt for UART
E (1559) [GPS]: GPS uart port driver install error: 261(ESP_ERR_NOT_FOUND).
I (1564) uart: ALREADY NULL
I (1569) [Ftp]: ftp_task start
I (1574) [Ftp]: ftp_user:[hdsolar] ftp_pass:[password]
I (1719) modem_board: Waiting for modem initialize ready
I (6719) USB_HCDC: iot_usbh_cdc, version: 0.2.1
I (6719) IOT_USBH: iot_usbh, version: 0.2.1
E (6719) IOT_USBH: ../managed_components/espressif__iot_usbh/iot_usbh.c:352 (iot_usbh_port_init):HCD Install failed
E (6729) USB_HCDC: ../managed_components/espressif__iot_usbh_cdc/iot_usbh_cdc.c:554 (usbh_cdc_driver_install):usb port init failed
E (6739) esp-modem-dte: esp_modem_dte_new(466): usb driver install failed

以上测试在初始化第一个设备前还初始化了一个I2C的RTC,如果我把RTC初始化注释了,重新运行第4个程序,则第一个UART可以正常初始化,从以上情况基本可以看出前4个设备驱动可以正常初始化,之后的就会失败,我需要用到1个I2C、2个SPI、3个UART(其中一个作为刷程序和日志输出)、1个SDMMC、1个USB,共8个设备,如果刷程序和日志输出的也算成功的话,那也就是idf只可以初始化5个设备。我还使用到了蓝牙,但不管蓝牙是先初始化还是后初始化都不受影响。

@igrr
Copy link
Member

igrr commented Nov 29, 2023

@wishinlife
Copy link
Author

wishinlife commented Nov 30, 2023

Please check out this section: https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-reference/system/intr_alloc.html#id7

你好,按照这个说明,我把不同的设备分别加载在两个CPU上,确实驱动加载不再报错了,但也有新的问题,出现了3种情况:
1、没有两个CPU都没有启用UART,有个RGB LED灯使用esp_timer来切换显示,内部通过SemaphoreHandle_t加锁来修改显示频率和颜色,会报如下错误:
Guru Meditation Error: Core 0 panic'ed (LoadStoreAlignment). Exception was unhandled.

Core 0 register dump:
PC : 0x4038125b PS : 0x00060833 A0 : 0x80387070 A1 : 0x3fca8110
0x4038125b: xt_utils_compare_and_set at /home/user /esp/esp-idf/components/xtensa/include/xt_utils.h:215
(inlined by) esp_cpu_compare_and_set at /home/user /esp/esp-idf/components/esp_hw_support/cpu.c:442

A2 : 0x3731368d A3 : 0xb33fffff A4 : 0x0000cdcd A5 : 0x3fca9ae0
A6 : 0x00060023 A7 : 0x00000003 A8 : 0xfb31368d A9 : 0x01ffffff
A10 : 0x00060a23 A11 : 0x00000000 A12 : 0x3fca28a4 A13 : 0x3fca28a4
A14 : 0x3fca28a4 A15 : 0x60023000 SAR : 0x00000015 EXCCAUSE: 0x00000009
EXCVADDR: 0x3731368d LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0xffffffff
0x40056f5c: memcpy in ROM

0x40056f72: memcpy in ROM

Backtrace: 0x40381258:0x3fca8110 0x4038706d:0x3fca8130 0x40384774:0x3fca8160 0x4200dce3:0x3fca81a0 0x42008b3e:0x3fca81c0 0x42008b91:0x3fca81f0 0x40386f05:0x3fca8210
0x40381258: xt_utils_compare_and_set at /home/user /esp/esp-idf/components/xtensa/include/xt_utils.h:215
(inlined by) esp_cpu_compare_and_set at /home/user /esp/esp-idf/components/esp_hw_support/cpu.c:442

0x4038706d: spinlock_acquire at /home/user /esp/esp-idf/components/esp_hw_support/include/spinlock.h:103
(inlined by) xPortEnterCriticalTimeout at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:501

0x40384774: vPortEnterCritical at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:575
(inlined by) xQueueSemaphoreTake at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:1671

0x4200dce3: led_timer_cb at /home/user /esp-projects/IoT-Station-ESP32-S3-New/build/../main/src/Sys/blink.c:28

0x42008b3e: timer_process_alarm at /home/user /esp/esp-idf/components/esp_timer/src/esp_timer.c:451

0x42008b91: timer_task at /home/user /esp/esp-idf/components/esp_timer/src/esp_timer.c:477 (discriminator 1)

0x40386f05: vPortTaskWrapper at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

2、在Core1上启动UART(有数据传入),并使用QueueHandle_t接收uart数据,报如下错误
Guru Meditation Error: Core 1 panic'ed (LoadStoreAlignment). Exception was unhandled.

Core 1 register dump:
PC : 0x4038125b PS : 0x00060833 A0 : 0x80387070 A1 : 0x3fcbd330
0x4038125b: xt_utils_compare_and_set at /home/user /esp/esp-idf/components/xtensa/include/xt_utils.h:215
(inlined by) esp_cpu_compare_and_set at /home/user /esp/esp-idf/components/esp_hw_support/cpu.c:442

A2 : 0x7379735e A3 : 0xb33fffff A4 : 0x0000abab A5 : 0x00002463
A6 : 0x00000001 A7 : 0xb33fffff A8 : 0x3779735e A9 : 0x01ffffff
A10 : 0x0000000c A11 : 0xf4240000 A12 : 0x69db1000 A13 : 0xbafd0000
A14 : 0xb33fffff A15 : 0xb33fffff SAR : 0x0000000c EXCCAUSE: 0x00000009
EXCVADDR: 0x7379735e LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0xffffffff
0x400570e8: memset in ROM

0x400570f3: memset in ROM

Backtrace: 0x40381258:0x3fcbd330 0x4038706d:0x3fcbd350 0x40384677:0x3fcbd380 0x4200d577:0x3fcbd3c0 0x40386f05:0x3fcbd400
0x40381258: xt_utils_compare_and_set at /home/user /esp/esp-idf/components/xtensa/include/xt_utils.h:215
(inlined by) esp_cpu_compare_and_set at /home/user /esp/esp-idf/components/esp_hw_support/cpu.c:442

0x4038706d: spinlock_acquire at /home/user /esp/esp-idf/components/esp_hw_support/include/spinlock.h:103
(inlined by) xPortEnterCriticalTimeout at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:501

0x40384677: vPortEnterCritical at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:575
(inlined by) xQueueReceive at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:1493

0x4200d577: uart_event_task at /home/user /esp-projects/IoT-Station-ESP32-S3-New/build/../main/src/Sensor/gps_embed.c:189

0x40386f05: vPortTaskWrapper at /home/user /esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

3、在Core1上启动UART(无数据传入),并使用QueueHandle_t接收uart数据,会不停的重启,日志显示的是看门狗重置:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0x1b (SPI_FAST_FLASH_BOOT)
Saved PC:0x42003e7b
0x42003e7b: panic_handler at /home/user /esp/esp-idf/components/esp_system/port/panic_handler.c:145 (discriminator 3)

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3978,len:0x18f8
load:0x403c9700,len:0x4
load:0x403c9704,len:0xc18
load:0x403cc700,len:0x2e60
entry 0x403c990c
W (25) boot.esp32s3: eFuse virtual mode is enabled. If Secure boot or Flash encryption is enabled then it does not provide any security. FOR TESTING ONLY!
W (34) efuse: [Virtual] Loading virtual efuse blocks from real efuses
I (53) boot: ESP-IDF v5.1.2 2nd stage bootloader
I (53) boot: compile time Nov 30 2023 16:50:54
I (53) boot: Multicore bootloader
I (56) boot: chip revision: v0.2
I (60) boot.esp32s3: Boot SPI Speed : 80MHz
I (65) boot.esp32s3: SPI Mode : DIO
I (69) boot.esp32s3: SPI Flash Size : 8MB
W (74) boot.esp32s3: PRO CPU has been reset by WDT.
W (80) boot.esp32s3: APP CPU has been reset by WDT.
I (85) boot: Enabling RNG early entropy source...
以上第2、3切换CPU结果一样,
如果只加载少量的设备驱动,且都没有指定CPU,则是可以运行的。

以上程序是在cpu0上初始化了gpio_install_isr_service,在cpu1上有个spi设备使用到了gpio中断,如果把cpu1上的这个spi设备停用了也就没问题了,如果启用了这个spi设备,不启用UART则这个spi设备工作正常,中断也正常,这是有什么冲突吗?应该如何解决呢?

@wishinlife
Copy link
Author

Please check out this section: https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-reference/system/intr_alloc.html#id7

Thanks, I've fixed this issue, it's true that the interrupt on cpu0 has run out, the weird issue I'm having above is because xTaskCreate is non-thread-safe, the problem caused by both cpus creating the task.

But there is a strange problem, I now use cpu0 to create a subtask to run on cpu1, and then this task to load all the devices and run, it works well, but now cpu0 can't load a device, it can still load 3 before, why is this? Is there any way to see what task each interrupt on the cpu is occupied?

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Won't Do This will not be worked on and removed Status: Opened Issue is new labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants