Closed wishinlife closed 4 months ago
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(ð_config_spi, ð_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个设备。我还使用到了蓝牙,但不管蓝牙是先初始化还是后初始化都不受影响。
Please check out this section: https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-reference/system/intr_alloc.html#id7
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设备工作正常,中断也正常,这是有什么冲突吗?应该如何解决呢?
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?
Answers checklist.
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.
Debug Logs.
More Information.
No response