atomic14 / atomic14/esp32_wireless_microphone

I try to use adc atten

Open
#7 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
108
Forks
18
PR merge metrics
No merged PRs in 30d

Description

~~~
void ADCSampler::configureI2S()
{
//init ADC pad
i2s_set_adc_mode(m_adcUnit, m_adcChannel);
**adc1_config_channel_atten(ADC1_CHANNEL_7, ADC_ATTEN_DB_11);**
// enable the adc
i2s_adc_enable(m_i2sPort);
}
~~~
~~~
int ADCSampler::read(int16_t *samples, int count)
{
// read from i2s
size_t bytes_read = 0;
i2s_read(m_i2sPort, samples, sizeof(int16_t) * count, &bytes_read, portMAX_DELAY);
int samples_read = bytes_read / sizeof(int16_t);
for (int i = 0; i < samples_read; i++)
{
//Serial.println(samples[i]);
**Serial.println(uint16_t(samples[i]) & 0xfff);**
//Serial.println(2048 - (uint16_t(samples[i]) & 0xfff));
samples[i] = (2048 - (uint16_t(samples[i]) & 0xfff)) * 17;
}
return samples_read;
}
~~~
I add some code between ** **
whatever i use ADC_ATTEN_DB_11 or ADC_ATTEN_DB_0,the max nums out of serial were always about 3000 after the big loud voice was happend . Did I set it up incorrectly thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with ADCSampler::configureI2S() and ADCSampler::read(), focusing on adc1_config_channel_atten(), ADC_ATTEN_DB_11, ADC_ATTEN_DB_0, and the serial value calculation. Reproduce the reported output with both attenuation settings and inspect the ESP32 ADC/I2S behavior; done means the cause of the unchanged maximum reading is identified and documented or corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.