-
Notifications
You must be signed in to change notification settings - Fork 18
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
Can't take semaphore on ESP32-S2 #97
Comments
|
Does this error only happen after server restart? |
Nope it's not decisive. It happens randomly and I can't find a pattern so far. |
The only place this function is called is in |
I have added some trace to the function, here is what it looks like: int32_t latency_buffer_full(bool *is_full, TickType_t wait, const char *entrance) {
if (!is_full) {
return -3;
}
if (latencyBufSemaphoreHandle == NULL) {
ESP_LOGE(TAG, "%s -> latency_buffer_full: latencyBufSemaphoreHandle == NULL", entrance);
return -2;
}
if (xSemaphoreTake(latencyBufSemaphoreHandle, wait) == pdFALSE) {
ESP_LOGW(TAG, "%s -> latency_buffer_full: can't take semaphore in %lu ticks", entrance, wait);
return -1;
}
*is_full = latencyBuffFull;
if(xSemaphoreGive(latencyBufSemaphoreHandle) == pdFALSE) {
ESP_LOGE(TAG, "%s -> latency_buffer_full: semaphore release FAILED", entrance);
return -4;
}
return 0;
} And here is the crash:
The strange thing is that the |
Okay I did more fiddling and found that |
I set this to 1000 in all sdkconfigs so this is probably your issue? |
Ahhhhh I think that might be the root of all evil. I have to |
When you have a working config would you PR this as a template? |
I made several changes of the FreeRTOS part to keep the same as the provided config. I let it play for around three hours, then muted and went to bed. This morning I unmuted and it immediately resumes playing, tested for another several hours without problem, all while occationally switching audio source. Here is the current configuration I am using: I have changed several PSRAM configurations that might affect stability. It may need further testing but I think at a glance it works without problem. On server I am using PCM/20ms/400ms, as FLAC seems to cause rare crackles or resyncs. |
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:sdkconfig.txt
When compiling, it compains in
boards_pins_config.c
thatI2S_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:
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
andbuffer
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 ofxSemaphoreGive(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.The text was updated successfully, but these errors were encountered: