-
Notifications
You must be signed in to change notification settings - Fork 7.6k
i2s get data from internal ADC #1227
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
Comments
Did you slove this problem? |
No |
Do you have skype account, can we discuss? |
Any progress? |
The IDF example includes i2c_adc_enable(), which I'm guessing is the missing #4 in your list. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This stale issue has been automatically closed. Thank you for your contributions. |
----------------------------- Remove above -----------------------------
Hardware:
Board: ESP32 Dev Module
Core Installation/update date: 11/jul/2017
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 115200
Description:
Try to get data from internal ADC from i2c
but in RX data only zero
mic- MAX9812
Pin36 -> Mic OUT
GDN -> Mic GRND
3V -> Mic VCC
Sketch:
#include "driver/i2s.h"
#include "driver/adc.h"
int i2s_num = 0;
i2s_config_t i2s_config;
char* buf1= (char*) malloc(32768*2);
void example_disp_buf(uint8_t* buf, int length)
{
}
void setup() {
Serial.begin(115200);
//config i2s
i2s_config.mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_ADC_BUILT_IN);
i2s_config.sample_rate = 48000;
i2s_config.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT;
i2s_config.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT;
i2s_config.communication_format = (i2s_comm_format_t) (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB);
i2s_config.dma_buf_count = 2;
i2s_config.dma_buf_len = 512;
i2s_config.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1;
//install and start i2s driver
if(i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL)==ESP_OK) Serial.println("1 driver OK");
if ( i2s_set_pin(I2S_NUM_0, NULL)==ESP_OK) Serial.println("2 pin OK");
if (i2s_set_adc_mode(ADC_UNIT_1, ADC1_CHANNEL_0)==ESP_OK) Serial.println("3 mode OK");
if (i2s_start(I2S_NUM_0)==ESP_OK) Serial.println("5 i2s OK");
}
void loop() {
int i= i2s_read_bytes(I2S_NUM_0, buf1, 32768*2, portMAX_DELAY);
Serial.println(i);
example_disp_buf((uint8_t*) buf1, 164);
delay(550);
The text was updated successfully, but these errors were encountered: