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

ESP_SR: Core panic when loading Hi,ESP wakenet model #10689

Open
1 task done
Spartan859 opened this issue Dec 6, 2024 · 1 comment
Open
1 task done

ESP_SR: Core panic when loading Hi,ESP wakenet model #10689

Spartan859 opened this issue Dec 6, 2024 · 1 comment
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@Spartan859
Copy link

Board

ESP32-S3

Device Description

ESP32-S3-WROOM-1

Hardware Configuration

#define INMP441_WS 5
#define INMP441_BCLK 4
#define INMP441_DIN 6

Version

latest master (checkout manually)

IDE Name

VSCode

Operating System

Windows 11

Flash frequency

80MHz

PSRAM enabled

yes

Upload speed

460800

Description

The board raise panicHandler when performing ESP_SR.begin -> sr_start -> esp_srmodel_init -> srmodel_mmap_init -> srmodel_load -> get_model_info.

After hours of tracking, this happens when loading wn9_hiesp. It seems that accessing the MODEL_INFO part of it caused the panic. Maybe "data" in "get_model_info" is a nullptr?

Sketch

// #include "my_spiffs.h"
#include <Arduino.h>
#include "ESP_I2S.h"
#include "ESP_SR.h"

#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
#include "esp32-hal-log.h"
#define TAG ""
#else
#include "esp_log.h"
static const char *TAG = "main";
#endif

#define INMP441_WS 5
#define INMP441_BCLK 4
#define INMP441_DIN 6

I2SClass i2s;

enum
{
    SR_CMD_HELLO,
};
static const sr_cmd_t sr_commands[] = {
    {0, "Turn on the light", "TkN nN jc LiT"},
};

void onSrEvent(sr_event_t event, int command_id, int phrase_id)
{
    switch (event)
    {
    case SR_EVENT_WAKEWORD:
        Serial.println("WakeWord Detected!");
        break;
    case SR_EVENT_WAKEWORD_CHANNEL:
        Serial.printf("WakeWord Channel %d Verified!\n", command_id);
        ESP_SR.setMode(SR_MODE_COMMAND); // Switch to Command detection
        break;
    case SR_EVENT_TIMEOUT:
        Serial.println("Timeout Detected!");
        ESP_SR.setMode(SR_MODE_WAKEWORD); // Switch back to WakeWord detection
        break;
    case SR_EVENT_COMMAND:
        Serial.printf("Command %d Detected! %s\n", command_id, sr_commands[phrase_id].str);
        switch (command_id)
        {
        case SR_CMD_HELLO:
            Serial.println("Hello, world!");
            break;
        default:
            Serial.println("Unknown Command!");
            break;
        }
        ESP_SR.setMode(SR_MODE_COMMAND); // Allow for more commands to be given, before timeout
        // ESP_SR.setMode(SR_MODE_WAKEWORD); // Switch back to WakeWord detection
        break;
    default:
        Serial.println("Unknown Event!");
        break;
    }
}

void setup(void)
{
    ESP_LOGE(TAG, "Hello, world!");
    Serial.begin(115200);
    // Serial.printf("ijWDSNNQASDJLAKSJDSAKJD");
    // bsp_spiffs_mount();
    i2s.setPins(INMP441_BCLK, INMP441_WS, -1, INMP441_DIN);
    i2s.setTimeout(1000);
    i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO);

    ESP_SR.onEvent(onSrEvent);
    ESP_SR.begin(i2s, sr_commands, sizeof(sr_commands) / sizeof(sr_cmd_t), SR_CHANNELS_STEREO, SR_MODE_WAKEWORD);
}

void loop()
{
    // Serial.println("Hello, world!");
    // printf("Hello, world!\n");
    // delay(1000);
}

Debug Message

I (31) boot: ESP-IDF v5.1.4 2nd stage bootloader
I (31) boot: compile time Dec  6 2024 13:40:48
I (31) boot: Multicore bootloader
I (34) boot: chip revision: v0.2
I (38) qio_mode: Enabling default flash chip QIO
I (43) boot.esp32s3: Boot SPI Speed : 80MHz
I (48) boot.esp32s3: SPI Mode       : QIO
I (53) boot.esp32s3: SPI Flash Size : 16MB
W (58) boot.esp32s3: PRO CPU has been reset by WDT.
W (63) boot.esp32s3: APP CPU has been reset by WDT.
I (69) boot: Enabling RNG early entropy source...
I (74) boot: Partition Table:
I (78) boot: ## Label            Usage          Type ST Offset   Length
I (85) boot:  0 nvs              WiFi data        01 02 00009000 00005000
I (93) boot:  1 otadata          OTA data         01 00 0000e000 00002000
I (100) boot:  2 app0             OTA app          00 10 00010000 00300000
I (108) boot:  3 app1             OTA app          00 11 00310000 00300000
I (115) boot:  4 spiffs           Unknown data     01 82 00610000 00700000
I (123) boot:  5 model            Unknown data     01 82 00d10000 002e0000
I (130) boot:  6 coredump         Unknown data     01 03 00ff0000 00010000
I (138) boot: End of partition table
I (142) esp_image: segment 0: paddr=00010020 vaddr=3c080020 size=b2cd8h (732376) map
I (262) esp_image: segment 1: paddr=000c2d00 vaddr=3fc96400 size=057c8h ( 22472) load
I (266) esp_image: segment 2: paddr=000c84d0 vaddr=40374000 size=07b48h ( 31560) load
I (274) esp_image: segment 3: paddr=000d0020 vaddr=42000020 size=76754h (485204) map
I (349) esp_image: segment 4: paddr=0014677c vaddr=4037bb48 size=0a810h ( 43024) load
I (366) boot: Loaded app from partition at offset 0x10000
I (366) boot: Disabling RNG early entropy source...
I (377) cpu_start: Multicore app
I (378) octal_psram: vendor id    : 0x0d (AP)
I (378) octal_psram: dev id       : 0x02 (generation 3)
I (381) octal_psram: density      : 0x03 (64 Mbit)
I (387) octal_psram: good-die     : 0x01 (Pass)
I (392) octal_psram: Latency      : 0x01 (Fixed)
I (397) octal_psram: VCC          : 0x01 (3V)
I (402) octal_psram: SRF          : 0x01 (Fast Refresh)
I (408) octal_psram: BurstType    : 0x01 (Hybrid Wrap)
I (414) octal_psram: BurstLen     : 0x01 (32 Byte)
I (419) octal_psram: Readlatency  : 0x02 (10 cycles@Fixed)
I (425) octal_psram: DriveStrength: 0x00 (1/1)
I (431) MSPI Timing: PSRAM timing tuning index: 5
I (436) esp_psram: Found 8MB PSRAM device
I (441) esp_psram: Speed: 80MHz
I (445) cpu_start: Pro cpu up.
I (448) cpu_start: Starting app cpu, entry point is 0x40375740
0x40375740: call_start_cpu1 at C:/Users/qianj/esp/v5.1.4/esp-idf/components/esp_system/port/cpu_start.c:159

I (0) cpu_start: App cpu up.
I (907) esp_psram: SPI SRAM memory test OK
I (916) cpu_start: Pro cpu start user code
I (916) cpu_start: cpu freq: 240000000 Hz
I (916) cpu_start: Application information:
I (919) cpu_start: Project name:     dokoDrawer_esp32
I (925) cpu_start: App version:      50edeac-dirty
I (930) cpu_start: Compile time:     Dec  6 2024 14:09:41
I (936) cpu_start: ELF file SHA256:  b480f69c7616a4c0...
I (942) cpu_start: ESP-IDF:          v5.1.4
I (947) cpu_start: Min chip rev:     v0.0
I (952) cpu_start: Max chip rev:     v0.99 
I (957) cpu_start: Chip rev:         v0.2
I (961) heap_init: Initializing. RAM available for dynamic allocation:
I (969) heap_init: At 3FC9D448 len 0004C2C8 (304 KiB): DRAM
I (975) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (981) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (988) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (994) esp_psram: Adding pool of 8192K of PSRAM memory to heap allocator
I (1002) spi_flash: detected chip: boya
I (1006) spi_flash: flash io: qio
[  1010][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x4200e820
0x4200e820: _uartDetachBus_RX at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:153

[  1033][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x4200e7ec
0x4200e7ec: _uartDetachBus_TX at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:160

[  1046][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200e7b8
0x4200e7b8: _uartDetachBus_CTS at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:167

[  1058][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x4200e784
0x4200e784: _uartDetachBus_RTS at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:174

[  1070][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x4200e820
0x4200e820: _uartDetachBus_RX at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:153

[  1082][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x4200e7ec
0x4200e7ec: _uartDetachBus_TX at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:160

[  1095][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200e7b8
0x4200e7b8: _uartDetachBus_CTS at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:167

[  1107][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x4200e784
0x4200e784: _uartDetachBus_RTS at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:174

[  1119][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x4200e820
0x4200e820: _uartDetachBus_RX at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:153

[  1131][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x4200e7ec
0x4200e7ec: _uartDetachBus_TX at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:160

[  1144][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200e7b8
0x4200e7b8: _uartDetachBus_CTS at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:167

[  1156][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x4200e784
0x4200e784: _uartDetachBus_RTS at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/cores/esp32/esp32-hal-uart.c:174

I (1168) sleep: Configure to isolate all GPIO pins in sleep state
I (1169) sleep: Enable automatic switching of GPIO sleep configuration
I (1171) esp_core_dump_uart: Init core dump to UART
I (1177) coexist: coex firmware version: d96c1e51f
I (1182) coexist: coexist rom version e7ae62f
I (1187) app_start: Starting scheduler on CPU0
I (1192) app_start: Starting scheduler on CPU1
I (1192) main_task: Started on CPU0
I (1202) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (1210) main_task: Calling app_main()
I (1220) main_task: Returned from app_main()
[  1221][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 44 successfully set to type UART_RX (2) with bus 0x3fc96794       
[  1243][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 43 successfully set to type UART_TX (3) with bus 0x3fc96794       
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-S3
  Package           : 0
  Revision          : 2
  Cores             : 2
  CPU Frequency     : 240 MHz
  XTAL Frequency    : 40 MHz
  Features Bitfield : 0x00000012
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : No
  BT Low Energy     : Yes
  IEEE 802.15.4     : No
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   408003 B ( 398.4 KB)
  Free Bytes        :   340295 B ( 332.3 KB)
  Allocated Bytes   :    63056 B (  61.6 KB)
  Minimum Free Bytes:   335807 B ( 327.9 KB)
  Largest Free Block:   241664 B ( 236.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         : 16777216 B (16 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 80 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  3072.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x00310000, size:  3072.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00610000, size:  7168.0 KB, type: DATA, subtype: SPIFFS
              model : addr: 0x00D10000, size:  2944.0 KB, type: DATA, subtype: SPIFFS
           coredump : addr: 0x00FF0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Dec  6 2024 14:12:55
  ESP-IDF Version   : v5.1.4
  Arduino Version   : 3.0.4
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32S3_DEV
  Arduino Variant   : esp32s3
  Arduino Runs Core : 1
  Arduino Events on : 1
  CDC On Boot       : 0
============ Before Setup End ============
E (1559) main: Hello, world!
[  1560][V][esp32-hal-uart.c:408] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(44) txPin(43)
[  1573][V][esp32-hal-uart.c:497] uartBegin(): UART0 not installed. Starting installation
�[  1582][V][esp32-hal-uart.c:560] uartBegin(): UART0 initialization done.
[  1590][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type I2S_STD_BCLK (13) successfully set to 0x420107c4
0x420107c4: I2SClass::i2sDetachBus(void*) at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/libraries/ESP_I2S/src/ESP_I2S.cpp:229

[  1603][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type I2S_STD_WS (14) successfully set to 0x420107c4
0x420107c4: I2SClass::i2sDetachBus(void*) at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/libraries/ESP_I2S/src/ESP_I2S.cpp:229

[  1615][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type I2S_STD_DIN (16) successfully set to 0x420107c4
0x420107c4: I2SClass::i2sDetachBus(void*) at C:/Users/qianj/esp/v5.1.4/esp-idf/components/arduino-esp32/libraries/ESP_I2S/src/ESP_I2S.cpp:229

[  1629][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 4 successfully set to type I2S_STD_BCLK (13) with bus 0x3fc9cc30  
[  1641][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 5 successfully set to type I2S_STD_WS (14) with bus 0x3fc9cc30    
[  1653][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 6 successfully set to type I2S_STD_DIN (16) with bus 0x3fc9cc30   
[  1665][D][esp32-hal-sr.c:338] sr_start(): init model
I (1670) MODEL_LOADER: The storage free size is 23296 KB
I (1671) MODEL_LOADER: The partition size is 2944 KB
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x42003f5b
0x42003f5b: panic_handler at C:/Users/qianj/esp/v5.1.4/esp-idf/components/esp_system/port/panic_handler.c:145 (discriminator 3)

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@Spartan859 Spartan859 added the Status: Awaiting triage Issue is waiting for triage label Dec 6, 2024
@Spartan859
Copy link
Author

Solved after switching to mn5q8 model. Can you support multinet7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

1 participant