I2S with built-in ADC and Bluetooth

jjamjohnson
Posts: 9
Joined: Thu Nov 12, 2020 10:48 pm

I2S with built-in ADC and Bluetooth

Postby jjamjohnson » Fri Nov 20, 2020 12:06 am

Hello!

I have created an application for ESP32 that uses I2S to sample built-in ADC and it works great. I use following IIS configuration:

Code: Select all

    i2s_config_t i2s_config = {
        .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN | I2S_MODE_ADC_BUILT_IN),
        .sample_rate = sample_rate,
        .bits_per_sample = BPS,
        .communication_format = I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB,
        .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
        .intr_alloc_flags = 0,
        .dma_buf_count = 2,
        .dma_buf_len = 1024,
        .use_apll = 1,
    };
    i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
    i2s_set_adc_mode(ADC_UNIT_1, ADC1_CHANNEL_0);  
But once I initialize Bluetooth, I2S sampling stops working. First samples are set to 1885 and after that it only reads zeros.

All I found about this issue is this post - viewtopic.php?f=13&t=14314. But once I insert the function it mentions it crashes, which is expected since I do not use WIFI.

Who is online

Users browsing this forum: No registered users and 72 guests