M5Stack M5Go Audio

I have been trying to make audio work (mic + speaker) on the M5Go module (m5-docs ) but without any luck.

With the media_player, when I send audio from HA to it it makes a noise and reboots (crashes).
With the voice_assistant it gives an audio error at the first time and crashes at the second time.

Maybe I am messing up the i2s pins?
Has anyone tried it?

Simplified yaml:

esphome:
  name: m5go
  build_path: ./.build/m5go

esp32:
  board: m5stack-core-esp32

logger:

api:
  encryption:
    key: !secret 'apiencryptionkey'

ota:
  password: !secret 'apipass'

wifi:
  reboot_timeout: 15min
  networks:
  - ssid: !secret 'ssid'
    password: !secret 'wifipass'
    priority: 0.0
  - ssid: !secret 'ssid_paps'
    password: !secret 'wifipass_paps'
    priority: 0.0
  - ssid: !secret 'ssid_paps2'
    password: !secret 'wifipass_paps'
    priority: 0.0

sensor:

status_led:
  pin: 
    number: GPIO13
    #inverted: true

i2c:
  sda: 21
  scl: 22
  scan: true
  frequency: 200kHz

spi:
  clk_pin: 18
  mosi_pin: 23
  miso_pin: 19
  
binary_sensor:
  - platform: gpio
    id: M5_BtnA
    pin:
      number: 39
      inverted: true
    on_press:
      - voice_assistant.start:
    on_release:
      - voice_assistant.stop:
  - platform: gpio
    id: M5_BtnB
    pin:
      number: 38
      inverted: true
    on_click:
      then:
        - light.toggle: back_light
  - platform: gpio
    id: M5_BtnC
    pin:
      number: 37
      inverted: true

# GPIO pin of the display backlight
output:
  - platform: ledc
    pin: 32
    id: gpio_32_backlight_pwm

light:
  - platform: monochromatic
    output: gpio_32_backlight_pwm
    name: "Display Backlight"
    id: back_light
    restore_mode: ALWAYS_ON

i2s_audio:
  i2s_lrclk_pin: GPIO13
  i2s_bclk_pin: GPIO12
  #i2s_mclk_pin: GPIO0

microphone:
  - platform: i2s_audio
    id: internal_mic
    adc_type: internal
    adc_pin: GPIO34

speaker:
  - platform: i2s_audio
    id: internal_speaker
    dac_type: internal
    mode: right

#media_player:
#  - platform: i2s_audio
#    name: ESPHome I2S Media Player
#    dac_type: internal
#    mode: right

voice_assistant:
  microphone: internal_mic
  speaker: internal_speaker

Full logs. Error after the first voice_assistant.start and then crash after the second time:

[00:44:16][I][logger:262]: Log initialized
[00:44:16][C][ota:469]: There have been 1 suspected unsuccessful boot attempts.
[00:44:16][D][esp32.preferences:114]: Saving 1 preferences to flash...
[00:44:16][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[00:44:16][I][app:029]: Running through setup()...
[00:44:16][I][i2c.arduino:183]: Performing I2C bus recovery
[00:44:16][C][spi:023]: Setting up SPI bus...
[00:44:16][D][binary_sensor:034]: 'M5_BtnC': Sending initial state OFF
[00:44:16][D][ledc.output:051]: Calculating resolution bit-depth for frequency 1000.000000
[00:44:16][D][ledc.output:056]: Resolution calculated as 16
[00:44:16][C][esp32_rmt_led_strip:019]: Setting up ESP32 LED Strip...
[00:44:16][D][binary_sensor:034]: 'M5_BtnA': Sending initial state OFF
[00:44:16][D][binary_sensor:034]: 'M5_BtnB': Sending initial state OFF
[00:44:16][C][light:035]: Setting up light 'Display Backlight'...
[00:44:16][D][light:036]: 'Display Backlight' Setting:
[00:44:16][D][light:041]:   Color mode: 
[00:44:16][D][light:047]:   State: ON
[00:44:16][D][light:085]:   Transition length: 1.0s
[00:44:16][C][light:035]: Setting up light 'Side lights'...
[00:44:16][D][light:036]: 'Side lights' Setting:
[00:44:16][D][light:041]:   Color mode: RGB
[00:44:16][D][light:085]:   Transition length: 1.0s
[00:44:16][C][i2s_audio:024]: Setting up I2S Audio...
[00:44:16][C][i2s_audio.microphone:018]: Setting up I2S Audio Microphone...
[00:44:16][C][wifi:038]: Setting up WiFi...
[00:44:16][C][wifi:048]: Starting WiFi...
[00:44:16][C][wifi:049]:   Local MAC: [REDACTED]
[00:44:16][D][wifi:425]: Starting scan...
[00:44:22][D][wifi:440]: Found networks:
[00:44:22][I][wifi:484]: - '[REDACTED]' ([REDACTED]) β–‚β–„β–†β–ˆ
[00:44:22][D][wifi:485]:     Channel: 1
[00:44:22][D][wifi:486]:     RSSI: -66 dB
[00:44:22][I][wifi:274]: WiFi Connecting to '[REDACTED]'...
[00:44:25][I][wifi:557]: WiFi Connected!
[00:44:25][C][wifi:379]:   Local MAC: [REDACTED]
[00:44:25][C][wifi:380]:   SSID: '[REDACTED]'
[00:44:25][C][wifi:381]:   IP Address: 192.168.1.98
[00:44:25][C][wifi:383]:   BSSID: [REDACTED]
[00:44:25][C][wifi:384]:   Hostname: 'm5go'
[00:44:25][C][wifi:386]:   Signal strength: -62 dB β–‚β–„β–†β–ˆ
[00:44:25][C][wifi:390]:   Channel: 1
[00:44:25][C][wifi:391]:   Subnet: 255.255.255.0
[00:44:25][C][wifi:392]:   Gateway: 192.168.1.254
[00:44:25][C][wifi:393]:   DNS1: 192.168.1.254
[00:44:25][C][wifi:394]:   DNS2: 0.0.0.0
[00:44:25][C][ota:093]: Over-The-Air Updates:
[00:44:25][C][ota:094]:   Address: m5go.local:3232
[00:44:25][C][ota:097]:   Using Password.
[00:44:25][C][api:025]: Setting up Home Assistant API server...
[00:44:25][C][voice_assistant:017]: Setting up Voice Assistant...
[00:44:25][C][i2s_audio.speaker:019]: Setting up I2S Audio Speaker...
[00:44:25][I][app:062]: setup() finished successfully!
[00:44:25][I][app:102]: ESPHome version 2023.6.2 compiled on Jun 30 2023, 00:40:27
[00:44:25][C][wifi:543]: WiFi:
[00:44:25][C][wifi:379]:   Local MAC: [REDACTED]
[00:44:25][C][wifi:380]:   SSID: '[REDACTED]'
[00:44:25][C][wifi:381]:   IP Address: 192.168.1.98
[00:44:25][C][wifi:383]:   BSSID: [REDACTED]
[00:44:25][C][wifi:384]:   Hostname: 'm5go'
[00:44:25][C][wifi:386]:   Signal strength: -61 dB β–‚β–„β–†β–ˆ
[00:44:25][C][wifi:390]:   Channel: 1
[00:44:25][C][wifi:391]:   Subnet: 255.255.255.0
[00:44:25][C][wifi:392]:   Gateway: 192.168.1.254
[00:44:25][C][wifi:393]:   DNS1: 192.168.1.254
[00:44:25][C][wifi:394]:   DNS2: 0.0.0.0
[00:44:25][C][logger:301]: Logger:
[00:44:25][C][logger:302]:   Level: DEBUG
[00:44:25][C][logger:303]:   Log Baud Rate: 115200
[00:44:25][C][logger:305]:   Hardware UART: UART0
[00:44:25][C][i2c.arduino:053]: I2C Bus:
[00:44:25][C][i2c.arduino:054]:   SDA Pin: GPIO21
[00:44:25][C][i2c.arduino:055]:   SCL Pin: GPIO22
[00:44:25][C][i2c.arduino:056]:   Frequency: 200000 Hz
[00:44:25][C][i2c.arduino:059]:   Recovery: bus successfully recovered
[00:44:25][I][i2c.arduino:069]: Results from i2c bus scan:
[00:44:25][I][i2c.arduino:075]: Found i2c device at address 0x68
[00:44:25][I][i2c.arduino:075]: Found i2c device at address 0x75
[00:44:25][C][spi:125]: SPI bus:
[00:44:25][C][spi:126]:   CLK Pin: GPIO18
[00:44:25][C][spi:127]:   MISO Pin: GPIO19
[00:44:25][C][spi:128]:   MOSI Pin: GPIO23
[00:44:25][C][spi:130]:   Using HW SPI: YES
[00:44:25][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'M5_BtnC'
[00:44:25][C][gpio.binary_sensor:016]:   Pin: GPIO37
[00:44:25][C][ledc.output:160]: LEDC Output:
[00:44:25][C][ledc.output:161]:   Pin GPIO32
[00:44:25][C][ledc.output:162]:   LEDC Channel: 0
[00:44:25][C][ledc.output:163]:   PWM Frequency: 1000.0 Hz
[00:44:25][C][ledc.output:164]:   Bit depth: 16
[00:44:25][C][esp32_rmt_led_strip:171]: ESP32 RMT LED Strip:
[00:44:25][C][esp32_rmt_led_strip:172]:   Pin: 15
[00:44:25][C][esp32_rmt_led_strip:173]:   Channel: 1
[00:44:25][C][esp32_rmt_led_strip:198]:   RGB Order: GRB
[00:44:25][C][esp32_rmt_led_strip:199]:   Max refresh rate: 0
[00:44:25][C][esp32_rmt_led_strip:200]:   Number of LEDs: 10
[00:44:25][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'M5_BtnA'
[00:44:25][C][gpio.binary_sensor:016]:   Pin: GPIO39
[00:44:25][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'M5_BtnB'
[00:44:25][C][gpio.binary_sensor:016]:   Pin: GPIO38
[00:44:25][C][light:103]: Light 'Display Backlight'
[00:44:25][C][light:105]:   Default Transition Length: 1.0s
[00:44:25][C][light:106]:   Gamma Correct: 2.80
[00:44:25][C][light:103]: Light 'Side lights'
[00:44:25][C][light:105]:   Default Transition Length: 1.0s
[00:44:25][C][light:106]:   Gamma Correct: 2.80
[00:44:25][C][mdns:108]: mDNS:
[00:44:25][C][mdns:109]:   Hostname: m5go
[00:44:25][C][ota:093]: Over-The-Air Updates:
[00:44:25][C][ota:094]:   Address: m5go.local:3232
[00:44:25][C][ota:097]:   Using Password.
[00:44:25][C][api:138]: API Server:
[00:44:25][C][api:139]:   Address: m5go.local:6053
[00:44:25][C][api:141]:   Using noise encryption: YES
[00:44:27][D][api:102]: Accepted [REDACTED]
[00:44:28][D][api.connection:1030]: Home Assistant 2023.6.3 ([REDACTED]): Connected successfully
[00:44:30][D][binary_sensor:036]: 'M5_BtnA': Sending state ON
[00:44:30][D][voice_assistant:132]: Requesting start...
[00:44:30][D][voice_assistant:111]: Starting...
[00:44:30][D][voice_assistant:154]: Assist Pipeline running
[00:44:32][D][binary_sensor:036]: 'M5_BtnA': Sending state OFF
[00:44:32][D][voice_assistant:144]: Signaling stop...
[00:44:32][E][voice_assistant:231]: Error: stt-stream-failed - speech-to-text failed
[00:44:32][D][voice_assistant:144]: Signaling stop...
[00:46:02][D][binary_sensor:036]: 'M5_BtnA': Sending state ON
[00:46:02][D][voice_assistant:132]: Requesting start...
[00:46:02][D][voice_assistant:111]: Starting...
[00:46:07]E (114935) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[00:46:07]E (114935) task_wdt:  - loopTask (CPU 1)
[00:46:07]E (114935) task_wdt: Tasks currently running:
[00:46:07]E (114935) task_wdt: CPU 0: IDLE
[00:46:07]E (114935) task_wdt: CPU 1: IDLE
[00:46:07]E (114935) task_wdt: Aborting.
[00:46:07]
[00:46:07]abort() was called at PC 0x400fd1bc on core 0
[00:46:07]
[00:46:07]
[00:46:07]Backtrace:0x4008433d:0x3ffbeadc |<-CORRUPTED
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x4008433d: panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
[00:46:07]
[00:46:07]
[00:46:07]
[00:46:07]
[00:46:07]ELF file SHA256: 0000000000000000
[00:46:07]
[00:46:07]Rebooting...
[00:46:07]ets Jul 29 2019 12:21:46
[00:46:07]
[00:46:07]rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
[00:46:07]configsip: 0, SPIWP:0xee
[00:46:07]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[00:46:07]mode:DIO, clock div:1
[00:46:07]load:0x3fff0030,len:1344
[00:46:07]load:0x40078000,len:13864
[00:46:07]load:0x40080400,len:3608
[00:46:07]entry 0x400805f0

No yaml

No logs

No help possible

Fair enough. I’ve updated the first post now.

As indicated here I2S GPIO pins? | M5Stack Community the early versions of the Core units use PWM and not I2S for the speaker. I’ve got the speaker working in ESPHome on a Fire unit with the following config, but it’s limited to playing tones:

output:
  - platform: ledc
    pin: 25
    id: core_speaker
rtttl:
  output: core_speaker
  id: rtttl_speaker

See also Reddit - Dive into anything

1 Like