Hello,
We have a very peculiar problem that we are not able to solve.
We have a custom ESP32 board with the ESP32 wrover module. We are using the arduino framework along with platformio as a build system.
I mention the platformio only to provide complete information, it is really the same as a regular arduino esp32 installation.
The firmware does some job, makes a couple of https requests.. sleeps for a minute.. Wakes up and repeats the process ad infinitum.
If for any number of foreseeable reasons, the esp32 is unable to continue the job then the firmware calls the ESP.restart() to reboot the processor. And the peripherals we use are I2c, UART and I2S for various sensors.
The issues we are seeing is this. The firmware during one of these forced reboots stalls at the I2s_driver_install function invocation.
It is always at the same place irrespective of the prototype board we are using. To diagnose the firmware further we tried the same firmware on the ESP32-dev-kit and tried stepping the code in gdb to verify the source of the problem. No surprise, we are able to step through the code till the i2s_driver_install and the processor soon stalls and the debug session breaks.
This happens roughly about 30-40% of the time.. A manual reboot usually fixes the problem. But we would like to identify why this happens and what we can do to fix it.
I can post the relevant parts of the firmware if required.
Is there anything we can do to further isolate the issue and fix it ? Has anyone else faced a similar issue with the I2s device?
Thank you in advance for any help!!
ESP32 I2s stalling processor
Re: ESP32 I2s stalling processor
bump!!!
Any suggestions on how to fix the I2s stalling issue?
Any help on how to isolate the root cause will be equally helpful!!
Thanks in advance!
Any suggestions on how to fix the I2s stalling issue?
Any help on how to isolate the root cause will be equally helpful!!
Thanks in advance!
-
- Posts: 826
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32 I2s stalling processor
I think if you post your i2s_config definition, you will be more likely to get a response.
Re: ESP32 I2s stalling processor
Can you try calling periph_module_reset(PERIPH_I2S0_MODULE); before i2s_driver_install? Or PERIPH_I2S1_MODULE if you are using I2S1.
The declaration of this function is in "driver/periph_ctrl.h".
The declaration of this function is in "driver/periph_ctrl.h".
Re: ESP32 I2s stalling processor
My apologies for not being able to respond earlier. I was sick and did not get to a PC.
@Ibernstone.
You are right. I am sorry. I should have posted atleast the basic configuration. Please find the configuration below.
@ESP_igrr
Please find the existing configuration below. Thank you for the suggestions. I will try the patch and get back here.
FWIW we are trying to use the ESP32 with a ICS 43432 I2s microphone.
The firmware stalls at the i2s_driver_install line, always..
That is to say, the firmware does not stall everytime on power up, but whenever the firmware stalls, it can be traced back to this particular line.
Thank you again for the help guys!!
@Ibernstone.
You are right. I am sorry. I should have posted atleast the basic configuration. Please find the configuration below.
@ESP_igrr
Please find the existing configuration below. Thank you for the suggestions. I will try the patch and get back here.
Code: Select all
boolean setup_microphone(void) {
i2s_config_t i2s_config;
static const int bytes = 1024*1000;
i2s_config.mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_RX);
i2s_config.sample_rate = 16000;
//i2s_config.bits_per_sample = I2S_BITS_PER_SAMPLE_24BIT;
i2s_config.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT;
i2s_config.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT; // left on the earlier version
i2s_config.communication_format = (i2s_comm_format_t) (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB| I2S_DATA_ENABLE_DELAY);
i2s_config.dma_buf_count = BUF_COUNT;
i2s_config.dma_buf_len = BUF_COUNT * 4;
i2s_config.intr_alloc_flags = ESP_INTR_FLAG_LEVEL3;
i2s_pin_config_t pin_config;
pin_config.bck_io_num = 27;
pin_config.ws_io_num = 2;
pin_config.data_out_num = I2S_PIN_NO_CHANGE;
pin_config.data_in_num = 36;
// i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config, int queue_size, void *i2s_queue)
i2s_driver_install((i2s_port_t)I2S_NUM_0, &i2s_config, 0, NULL);
i2s_set_pin((i2s_port_t)I2S_NUM_0, &pin_config);
i2s_stop(I2S_NUM_0);
return i2s_start(I2S_NUM_0) == ESP_OK;
}
The firmware stalls at the i2s_driver_install line, always..
That is to say, the firmware does not stall everytime on power up, but whenever the firmware stalls, it can be traced back to this particular line.
Thank you again for the help guys!!
Re: ESP32 I2s stalling processor
No improvement I m afraid, The code still stalls at exactly the same place. I have tried calling the periph_module_reset before the i2s_driver_install. It still works for sometime and then stalls.
Any further suggestions on how I can narrow down the problem and help you fine folks, help me..
Thanks again in advance!!
Any further suggestions on how I can narrow down the problem and help you fine folks, help me..
Thanks again in advance!!
Re: ESP32 I2s stalling processor
Hello,
have you found a solution for your problem?
I stumbled upon the same issue...
I bypassed it by initializing the audio pipe as the very first thing in the setup
but I can not realy explain why and I normaly want to know why my code does what it does.
have you found a solution for your problem?
I stumbled upon the same issue...
I bypassed it by initializing the audio pipe as the very first thing in the setup
but I can not realy explain why and I normaly want to know why my code does what it does.
Who is online
Users browsing this forum: No registered users and 109 guests