- #include "driver/i2s.h"
- i2s_config_t i2s_config = {
- .mode = (i2s_mode_t)(I2S_MODE_SLAVE | I2S_MODE_TX | I2S_MODE_RX),
- .sample_rate = 8000,
- .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
- .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
- .communication_format = I2S_COMM_FORMAT_STAND_PCM_SHORT,
- .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
- .dma_buf_count = 8,
- .dma_buf_len = 256,
- .use_apll = true,
- };
- i2s_pin_config_t pin_config = {
- .bck_io_num = 4,
- .ws_io_num = 5,
- .data_out_num = 7,
- .data_in_num = 6
- };
- uint16_t rxbuf[256];
- size_t readsize = 0;
- void setup(){
- i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
- i2s_set_pin(I2S_NUM_0, &pin_config);
- Serial.begin(115200);
- }
- void loop(){
- readsize=0;
- i2s_read(I2S_NUM_0, &rxbuf[0], 3, &readsize, 100);
- if(readsize > 0){
- for(int i = 0; i < readsize; i++){
- Serial.print(rxbuf[i]);
- Serial.print(" ");
- }
- Serial.println();
- }
- }
I2S - can wroom be slave and receive pcm data?
I2S - can wroom be slave and receive pcm data?
I'm new to I2S and there is not much information about how to set it as slave and receive pcm data. What i've tried is two esp32 S3-wroom as i2s master and slave based on the official I2S example > FullDuplex, if i change the communication_format to I2S_COMM_FORMAT_I2S, the slave's serial will print a serials of "0", its not what i sent but it's another problem. But if i change both master and slave to I2S_COMM_FORMAT_STAND_PCM_SHORT, the slave will not print at all. Is there other thing i need to do to receive PCM data? I only wired bck, ws, and data in or out three lines, the mclk is floating. The slave code is like:
Who is online
Users browsing this forum: No registered users and 100 guests