ADC1 can not sampling in I2S scanning mode when enable WiFi.
Posted: Tue Dec 12, 2017 3:29 pm
As stated in the "ESP32 Technical Reference Manual", in the "27.3.5 DIG SAR ADC Controllers" can perform high-speed scanning by pattern table. Unfortunately this example:i2s_adc_dac does not work in master branch, gets audio to ADC1 but I2S writing empty data in DMA.
I success to start the ADC1 I2S/DMA scan in the master branch of esp-idf, but if several conditions are fulfilled:
when WIFI is turned on when the esp_wifi_set_mode() function is called, the previously running scan of ADC1/I2S/DMA is stopped, data in DMA does not change anymore, although I2S interrupts still arrive.
I think that the WiFi driver knocks down the settings of the DIG SAR ADC1 controller, but this is beyond my visibility.
We ask the guys from the Espressif please help solve this bug!
I success to start the ADC1 I2S/DMA scan in the master branch of esp-idf, but if several conditions are fulfilled:
- firstly, you need to change the power mode on the ADC_FORCE_ENABLE in the function adc_power_on(). I suggest for the function adc_power_on() the power mode to pass as argument so that when it is called from i2s_param_config (), the controller should be powered on permanently.
- secondly, turn off the I2S controller reset in the function i2s_stop(), you can remove it:
but since this affects the solution of the "bugfix/i2s_bck_polariy" I just deleted the function i2s_stop() here:
Code: Select all
I2S [i2s_num] -> conf.tx_reset = 1; I2S [i2s_num] -> conf.tx_reset = 0; I2S [i2s_num] -> conf.rx_reset = 1; I2S [i2s_num] -> conf.rx_reset = 0;
because i2s_stop() is called later from the function i2s_set_clk(). Apparently the repeated discharge here is superfluous and hinders the work.Code: Select all
--- i2s.orig.c 2017-12-11 15:32:56.000000000 +0200 +++ i2s.c 2017-12-11 15:33:24.526230939 +0200 @@ -1043,7 +1043,6 @@ ESP_LOGE(I2S_TAG, "Register I2S Interrupt error"); return err; } - i2s_stop(i2s_num); err = i2s_param_config(i2s_num, i2s_config); if (err != ESP_OK) { i2s_driver_uninstall(i2s_num);
when WIFI is turned on when the esp_wifi_set_mode() function is called, the previously running scan of ADC1/I2S/DMA is stopped, data in DMA does not change anymore, although I2S interrupts still arrive.
I think that the WiFi driver knocks down the settings of the DIG SAR ADC1 controller, but this is beyond my visibility.
We ask the guys from the Espressif please help solve this bug!