After disabling the line “codec_support_enabled: false” the delay is almost gone. Don’t know what happened yet…
Did you flash the code I provided using a data cable?
Switching from Arduino to ESP-IDF requires flashing using a data cable
That is interesting. My ESP is carefully packed in a box, so I only use WIFI to flash it. It did succeed flashing with esp-idf by using wifi, and moreover: it works now as expected, with about 1 sec of delay, so I will leave it for now. Thanks a lot for all your help!
Hi, aldo I have problems with my old setup. So I bought the same stuf @gdschut en @lijiazhiren did, but unfornunaly, after creating the installation .bin file and flash on my esp32-s3, the esp-module get in a error loop.
[12:44:16]SPIWP:0xee
[12:44:16]mode:DIO, clock div:1
[12:44:16]load:0x3fce2820,len:0x1564
[12:44:16]load:0x403c8700,len:0x4
[12:44:16]load:0x403c8704,len:0xc80
[12:44:16]load:0x403cb700,len:0x2ee0
[12:44:16]entry 0x403c890c
[12:44:16]ESP-ROM:esp32s3-20210327
[12:44:16]Build:Mar 27 2021
[12:44:16]rst:0xc (RTC_SW_CPU_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
[12:44:16]Saved PC:0x40376abd
I restored the esp-module and retried it serveral times. Also used chatgpt to get information to restore, but no results. Any idea what is going wrong?
I don’t know what code you used, so I can’t give you any advice.
I always start with esphome with a new device with only a very basic yaml using a cable, to only see if uploading and running works, check the log. After this test I upload the complete functional sketch over wifi. Otherwise you never know if your code or the device is the problem.
@lijiazhiren used your yaml-code.
@gdschut Good suggestion! I started with a new device and started with the following basic yaml:
esphome:
name: ESPmediaplayer
friendly_name: ESPmediaplayer
esp32:
board: esp32-s3-devkitc-1
flash_size: 16MB
cpu_frequency: 240MHZ
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "qg+NsW2U1mTeyYUo3KLRMHF7MT0gB2qLnTprjdo7S+w="
ota:
- platform: esphome
password: "92d45a56ad920dc4f5a5d35aad80d90f"
wifi:
networks:
- hidden: true
ssid: !secret wifi_ssid_z
password: !secret wifi_password_z
# fast_connect: on
- ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32S3R16N8 Fallback Hotspot"
password: "qn7JJ5RmDGw1"
That was ok, and the esp32-s3 module gave no error.
I added the following:
psram:
mode: octal
speed: 80MHz
and that gives the problem; the module get in a error loop.
The logging after installing the yaml with psram:
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
- framework-espidf @ 3.50402.0 (5.4.2)
- tool-cmake @ 3.30.2
- tool-esp-rom-elfs @ 2024.10.11
- tool-esptoolpy @ 5.0.2
- tool-mklittlefs @ 3.2.0
- tool-ninja @ 1.13.1
- tool-scons @ 4.40801.0 (4.8.1)
- toolchain-xtensa-esp-elf @ 14.2.0+20241119
..........
..........
Linking .pioenvs/espmediaplayer/firmware.elf
usage: esp_idf_size [-h] [--format {table,text,tree,csv,json2,raw,dot}]
[--archives] [--archive-dependencies] [--dep-symbols]
[--dep-reverse] [--archive-details ARCHIVE_NAME] [--files]
[--diff MAP_FILE] [--no-abbrev] [--unify] [--show-unused]
[--show-unchanged] [--use-flash-size] [--lto] [-d]
[-o OUTPUT_FILE] [-s COLUMN] [-F PATTERN] [--sort-diff]
[--sort-reverse] [-q] [--no-color] [--force-terminal]
[--doc]
MAP_FILE
esp_idf_size: error: unrecognized arguments: --ng
Warning: esp-idf-size exited with code 2
RAM: [= ] 11.2% (used 36604 bytes from 327680 bytes)
Flash: [= ] 10.4% (used 848510 bytes from 8126464 bytes)
Building .pioenvs/espmediaplayer/firmware.bin
Warning: DEPRECATED: 'esptool.py' is deprecated. Please use 'esptool' instead. The '.py' suffix will be removed in a future major release.
Creating ESP32S3 image...
Successfully created ESP32S3 image.
merge_factory_bin([".pioenvs/espmediaplayer/firmware.bin"], [".pioenvs/espmediaplayer/firmware.elf"])
Info: bootloader.bin not found - skipping
Info: partition-table.bin not found - skipping
Info: ota_data_initial.bin not found - skipping
Info: espmediaplayer.bin not found - skipping
Using FLASH_EXTRA_IMAGES from PlatformIO environment
Merging binaries into /data/build/espmediaplayer/.pioenvs/espmediaplayer/firmware.factory.bin
Merging binaries with esptool
SHA digest in image updated.
Wrote 0xdf410 bytes to file '/data/build/espmediaplayer/.pioenvs/espmediaplayer/firmware.factory.bin', ready to flash to offset 0x0.
Successfully created /data/build/espmediaplayer/.pioenvs/espmediaplayer/firmware.factory.bin
esp32_copy_ota_bin([".pioenvs/espmediaplayer/firmware.bin"], [".pioenvs/espmediaplayer/firmware.elf"])
Copied firmware to /data/build/espmediaplayer/.pioenvs/espmediaplayer/firmware.ota.bin
======================== [SUCCESS] Took 328.39 seconds ========================
INFO Successfully compiled program.
INFO Connecting to 192.168.1.252 port 3232...
INFO Connected to 192.168.1.252
INFO Uploading /data/build/espmediaplayer/.pioenvs/espmediaplayer/firmware.bin (848912 bytes)
Uploading: [============================================================] 100% Done...
INFO Upload took 3.61 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.1.252 using esphome API
INFO Successfully resolved espmediaplayer @ 192.168.1.252 in 0.000s
WARNING Can't connect to ESPHome API for espmediaplayer @ 192.168.1.252: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.252', port=6053))]: [Errno 113] Connect call failed ('192.168.1.252', 6053) (SocketAPIError)
INFO Trying to connect to espmediaplayer @ 192.168.1.252 in the background
INFO Successfully resolved espmediaplayer @ 192.168.1.252 in 0.000s
INFO Successfully resolved espmediaplayer @ 192.168.1.252 in 0.000s
INFO Successfully resolved espmediaplayer @ 192.168.1.252 in 0.000s
It looks succesfull, but the module was disconnected, flashing green led and no longer reachable.
So, without the code psram the module keep running. Is this code necessary?
The device I bought have the specs 8MB PSRAM: https://a.aliexpress.com/_EHsVWEw
Are there other modules connected to this board?
Try uninstalling them.
The default PSRAM uses GPIO16 and GPIO17.
No other modules are connected. Is the code this psram necessary to add to the yaml file?
Okay, I remember I also got an error the first time I flashed the firmware.
I know why it happened, but I’m sorry I don’t know how to describe it.
My solution was to flash Voice PE using this link: Home Assistant Voice PE
Finally, I used OTA to flash my own configuration based on that.
My description might be a little confusing, but English isn’t my first language, so I can’t explain it more clearly.
@lijiazhiren I flashed Voice PE on my ESP32 module, but also now my module get in a loop…
skipper79 What board are you using now and what components are you attaching / hoping to run with it.
Voice PE is not going to help without the correct hardware connected, yes it will probably (almost certainly) compile but the code is just going to be wrong for your needs, if you just want a media player, this is what i use on my esp32 s3 n2r8. Just change the psram and connection settings and it should work.
# Speaker
# LRC GPIO11 pk
# BLC GPIO9 ye
# Dout GPIO7 vi
substitutions:
name: wireless
friendly_name: Wireless
i2s_lrclk: GPIO11
i2s_bclk: GPIO09
spk: GPIO07
ledpin: GPIO6
esphome:
name: ${name}
friendly_name: ${friendly_name}
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "stuff"
ota:
- platform: esphome
password: "more stuff"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wireless Fallback Hotspot"
password: "imacVVJF12gO"
psram:
mode: quad
speed: 80MHz
captive_portal:
i2s_audio:
- id: i2s_output
i2s_lrclk_pin:
number: ${i2s_lrclk}
i2s_bclk_pin:
number: ${i2s_bclk}
speaker:
- platform: i2s_audio
id: output_speaker
i2s_dout_pin:
number: ${spk}
dac_type: external
bits_per_sample: 32bit
channel: mono
buffer_duration: 60ms
media_player:
- platform: speaker
name: "player"
id: media_out
announcement_pipeline:
speaker: output_speaker
format: WAV # FLAC is the least processor intensive codec
num_channels: 1 # Stereo audio is unnecessary for announcements
sample_rate: 48000
codec_support_enabled: false
buffer_size: 6000
on_pause:
- logger.log: "Playback paused!"
on_idle:
- logger.log: "Playback finished!"
switch:
- platform: restart
name: "${name} Reboot"
id: reboot_media_player_lab_reboot
sensor:
- platform: wifi_signal
name: "${name} WiFi Signal Sensor"
update_interval: 60s
light:
- platform: esp32_rmt_led_strip
rgb_order: RGB
pin: ${ledpin}
num_leds: 2
chipset: WS2812
name: "${name} LED"
id: led
disabled_by_default: false
#entity_category: diagnostic
icon: mdi:led-on
default_transition_length: 0s
effects:
- pulse:
name: "Slow Pulse"
transition_length: 250ms
update_interval: 250ms
min_brightness: 20%
max_brightness: 100%
- pulse:
name: "Fast Pulse"
transition_length: 100ms
update_interval: 100ms
min_brightness: 20%
max_brightness: 100%
I bought a ESP32-S3 N16R8 (HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash).
I changed the psram-code to ‘mode: quad’. That solved the problem for now, but I don’t know mode = quad is uselly for a N16R8…
For the n16r8 it should be set to octal
I know, but this is the case. Add the following to the code gives the problem of error loop:
psram:
mode: octal
speed: 80MHz
Maybe it is a hardware problem?
It should be a hardware problem
Take a picture and maybe I can see something.
I checked chatGPT again. Is this true, because @lijiazhiren, I saw you used a esp32s3r16n8…
Picture of my ESP32S3: [quote=“skipper79, post:64, topic:633129, full:true”]
It should be a hardware problem
Take a picture and maybe I can see something.
[/quote]
If ‘quad mode’ works correctly, there’s a high probability that the hardware’s PSRAM is faulty. Then, use ‘quad mode’. This setting will reduce performance slightly, but the impact isn’t significant.
For those needing TOSLINK support:

