snapclient
snapclient copied to clipboard
Can't take semaphore on ESP32-S2
As mentioned in my last issue, I decided to go back to WiFi connection. I found that the Wemos ESP32-S2 mini really suits my need, with a small footprint, type-C port and two screw holes. I paired the board with a MAX98357A to test it out.
Firstly I have to specify the chip using idf.py set-target esp32s2
. After that I configured everything including PSRAM (the S2 chip contains 4MB of flash and 2MB of PSRAM). Here is the full configuration:
When compiling, it compains in boards_pins_config.c
that I2S_NUM_1
cannot be found. I have to make the following change for it to work:
After compiling and flashing, everything seems fine. The connection is successful and the audio is playing through the client. However, after a random amount of time (no longer than 10 minutes), the client would crash and the current audio frame will be played indefinitely. If I check the serial log output, I can see the following being printed out constantly:
[0;32mI (334122) dspProc: Set volume to 0.030000[0m
[0;33mW (366932) PLAYER: RESYNCING HARD 2: age -99us, latency 947715411563us, free 2106647, largest block 2031616, 0, rssi: -50[0m
[0;32mI (367092) PLAYER: initial sync age: 12us, chunk duration: 20000us[0m
[0;33mW (531542) PLAYER: RESYNCING HARD 2: age -109us, latency 947715405177us, free 2106627, largest block 2031616, 0, rssi: -52[0m
[0;32mI (531702) PLAYER: initial sync age: 10us, chunk duration: 20000us[0m
[0;33mW (604722) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604722) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604732) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604732) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604742) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604752) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604762) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604762) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604772) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604782) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604782) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604792) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604802) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604812) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604812) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604822) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604832) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604842) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604842) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604852) PLAYER: latency_buffer_full: can't take semaphore[0m
[0;33mW (604862) PLAYER: latency_buffer_full: can't take semaphore[0m
I have ruled out the power supply issue of the board (applied 3.3V directly through the pin, bypassing the onboard LDO). I have tried to increase and decrease chunk_ms
and buffer
in server configuration, but seems like it does not have a significant influence on the issue. I have also fiddled around the settings about PSRAM, also no avail (however if I turn off PSRAM, audio board would fail to initialize due to out of memory, so I assume it's working). I also added log to the return value of xSemaphoreGive(latencyBufSemaphoreHandle)
to see if anything does not release the semaphore, but they returns true every time. At this point I am really not sure what is causing the semaphore to stuck.