espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.43k stars 7.38k forks source link

ESP_SR Basic.ino sketch doesn't work. #8988

Closed RobertMorton56 closed 7 months ago

RobertMorton56 commented 10 months ago

Board

ESP32-S3-BOX-Lite

Device Description

ESP32-S3-BOX-Lite stock, with no tweaks

Hardware Configuration

As per ESP32-S3-BOX-Lite defaults. No other devices attached apart from UART for debugging. UART connected to G43 and G44 as per defaults.

Version

latest master (checkout manually)

IDE Name

arduino-cli

Operating System

linux LTS kernel

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

921600

Description

Everything compiles, and uploads fine. When viewing the debug serial output I keep getting:

E (73) AFE_SR: ERROR: Please select wake words!

I assumed the model would be uploaded to SPIFFS etc with this example. Is this not the case? My goal is to just get the Basic.ino sketch running.

Thanks

Sketch

As it is in master.

Debug Message

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x40379dc2
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x508
load:0x403c9700,len:0x4
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29d8
entry 0x403c9880
E (73) AFE_SR: ERROR: Please select wake words!

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Other Steps to Reproduce

No response

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

SuGlider commented 10 months ago

@me-no-dev PTAL. Thanks.

me-no-dev commented 10 months ago

First please enable core debug from the board menu to level "debug" or "verbose". It will print a lot of things. Then make sure that you have selected the appropriate partition scheme, else model would not be downloaded.

Also, even when you get all that to compile fine, the box-lite also requires yo to properly setup and init the audio DAC and ADC controllers. We will have all that covered soonish through a BSP Library, but we are not there yet.

RobertMorton56 commented 10 months ago

Ah OK. Got you. Is there an recommended partitions.csv I can start with?

Rather than waste people's time maybe I'll wait for the library release? Soonish like a month? Longer?

I reckon there's not much left to get this sketch up and running on the box-lite with the current code as is. Thanks for the reply, looking forward to trying this hardware out with this core.

me-no-dev commented 10 months ago

Select the ESP32-S3 dev module, enable OPI PSRAM and select ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) partition from the menu. This will set you up to get the proper partitions and model. Let me know if that does not work

RobertMorton56 commented 10 months ago

Yep, that partition scheme worked - however I stuck with the esp32s3box. The ESP32-S3 dev module just loops these logs:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cdad5
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x508
load:0x403c9700,len:0x4
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29d8
entry 0x403c9880

Compiling for the esp32s3box gives:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0xb (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x508
load:0x403c9700,len:0x4
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29d8
entry 0x403c9880
[   156][I][esp32-hal-psram.c:92] psramInit(): PSRAM enabled
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-S3
  Package           : 0
  Revision          : 1
  Cores             : 2
  Frequency         : 240 MHz
  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        :   386740 B ( 377.7 KB)
  Free Bytes        :   357944 B ( 349.6 KB)
  Allocated Bytes   :    23908 B (  23.3 KB)
  Minimum Free Bytes:   352896 B ( 344.6 KB)
  Largest Free Block:   319476 B ( 312.0 KB)
------------------------------------------
SPIRAM Memory Info:
------------------------------------------
  Total Size        :  8388608 B (8192.0 KB)
  Free Bytes        :  8386296 B (8189.7 KB)
  Allocated Bytes   :        0 B (   0.0 KB)
  Minimum Free Bytes:  8386296 B (8189.7 KB)
  Largest Free Block:  8257524 B (8064.0 KB)
  Bus Mode          : OPI
------------------------------------------
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 13 2023 14:24:40
  Compile Host OS   : linux
  ESP-IDF Version   : v5.1.2-185-g3662303f31-dirty
  Arduino Version   : 3.0.0
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32_S3_BOX
  Arduino Variant   : esp32s3box
  Arduino FQBN      : esp32:esp32:esp32s3box:PartitionScheme=esp_sr_16,DebugLevel=debug
============ Before Setup End ============
[   552][I][esp32-hal-periman.c:135] perimanSetPinBus(): Pin 19 already has type USB_DM (45) with bus 0x3fc99334
[   553][I][esp32-hal-periman.c:135] perimanSetPinBus(): Pin 20 already has type USB_DP (46) with bus 0x3fc99334
[   562][D][esp32-hal-sr.c:340] sr_start(): init model
[   566][D][esp32-hal-sr.c:348] sr_start(): load wakenet 'wn9_hiesp'
MC Quantized wakenet9: wakeNet9_v1h24_hiesp_3_0.63_0.635, tigger:v3, mode:2, p:0, (Nov 17 2023 15:07:49)
[   691][D][esp32-hal-sr.c:353] sr_start(): load multinet 'mn5q8_en'
[   692][D][esp32-hal-sr.c:355] sr_start(): load model_data 'mn5q8_en'
Quantized8 Multinet5: MN5Q8_v2_english_8_0.9_0.90, beam search:v2, (Nov 17 2023 15:07:49)
[   916][I][esp32-hal-sr.c:361] sr_start(): add 7 commands
[   918][I][esp32-hal-sr.c:364] sr_start():   cmd[0] phrase[0]:'Turn on the light'
[   925][I][esp32-hal-sr.c:364] sr_start():   cmd[0] phrase[1]:'Switch on the light'
[   933][I][esp32-hal-sr.c:364] sr_start():   cmd[1] phrase[2]:'Turn off the light'
[   940][I][esp32-hal-sr.c:364] sr_start():   cmd[1] phrase[3]:'Switch off the light'
[   947][I][esp32-hal-sr.c:364] sr_start():   cmd[1] phrase[4]:'Go dark'
[   954][I][esp32-hal-sr.c:364] sr_start():   cmd[2] phrase[5]:'Start fan'
[   960][I][esp32-hal-sr.c:364] sr_start():   cmd[3] phrase[6]:'Stop fan'
[   968][D][esp32-hal-sr.c:376] sr_start(): start tasks
[   972][I][esp32-hal-sr.c:142] audio_feed_task(): audio_chunksize=1024, feed_channel=3
[   982][I][esp32-hal-sr.c:202] audio_detect_task(): ------------detect start------------
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   386740 B ( 377.7 KB)
  Free Bytes        :   286368 B ( 279.7 KB)
  Allocated Bytes   :    88340 B (  86.3 KB)
  Minimum Free Bytes:   283392 B ( 276.8 KB)
  Largest Free Block:   270324 B ( 264.0 KB)
------------------------------------------
SPIRAM Memory Info:
------------------------------------------
  Total Size        :  8388608 B (8192.0 KB)
  Free Bytes        :  5196340 B (5074.6 KB)
  Allocated Bytes   :  3183908 B (3109.3 KB)
  Minimum Free Bytes:  5196340 B (5074.6 KB)
  Largest Free Block:  5111796 B (4992.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------
     2 : I2S_STD_MCLK
    15 : I2S_STD_DIN
    16 : I2S_STD_DOUT
    17 : I2S_STD_BCLK
    19 : USB_DM
    20 : USB_DP
    40 : GPIO
    41 : GPIO
    43 : UART_TX[0]
    44 : UART_RX[0]
    47 : I2S_STD_WS
============ After Setup End =============

It doesn't respond to voice so I imagine the audio DAC and ADC controllers still need to be initialized as you suggested?

To note, I'm using arduino-cli so I used the following command to compile:

arduino-cli compile -v --warnings all --fqbn esp32:esp32:esp32s3box:PartitionScheme=esp_sr_16,DebugLevel=debug

I got the pin definitions from the schematic: 1702479430_selected

me-no-dev commented 10 months ago

Yes. all started fine, but you do need to init the DAC and ADC. We will soon have support for all that.

@lucasssvaz if you get it going, please post the drivers here, so that @RobertMorton56 can continue testing :)

lucasssvaz commented 9 months ago

I'm implementing some I2S examples in #9030. Maybe it will help

RobertMorton56 commented 9 months ago

Great, thanks for this. From a brief look at your example, the DAC is used. I assume I'll need to init the ADC too if I want to use the ESP32-box-lite's microphone?

Thanks again

lucasssvaz commented 9 months ago

Yeah, you will need to configure the ES7243E ADC to convert the analog signal from the Mic to I2S and, if you want to use the speaker, you'll need to also configure the ES8156 DAC to do the opposite (don't forget to enable the PA chip by driving the GPIO 46 high).

You can copy whatever configurations you need from the IDF implementation of the ES7243E and the ES8156.

RobertMorton56 commented 9 months ago

Great, I'll try that. Thanks!

RobertMorton56 commented 9 months ago

Tried that, it seems like the esp-adf is required. I did try and bring some of it into the Arduino space but it's getting messy. Might be better to wait till you guys have v3 ready. I assume you'll have es7234 and es8156 included in that release?

lucasssvaz commented 9 months ago

@RobertMorton56 What I meant is using the ES8388 driver as a base and getting the registers addresses and values from the ADF. You won't be able to use the exact commands that are used there but the codec registers and values will be the same.

VojtechBartoska commented 8 months ago

Hello @RobertMorton56, is this issue still valid or we can close it?

VojtechBartoska commented 7 months ago

Closing, if needed you can reopen.