I use the I2S (deprecated) to send audio data from ESP32 to another chip. The received values are wrong so I checked the data on scope. I send 0x31 with:
Code: Select all
int i;
for(i=0; i<item_size/2; i++){
data[2*i] = 1; //0x31, little endian
data[2*i+1] = 3;
}
i2s_write(0, data, item_size, &bytes_written, portMAX_DELAY);
Code: Select all
i2s_config_t i2s_config = {
.mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX
.sample_rate = 44100,
.bits_per_sample = 16,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, //2-channels
.communication_format = I2S_COMM_FORMAT_I2S_MSB,
.dma_buf_count = 6,
.dma_buf_len = 1024,
.intr_alloc_flags = 0, //Default interrupt priority
.tx_desc_auto_clear = true, //Auto clear tx descriptor on underflow
};
Looking at this picture, it seems the issue is that the data (yellow) is 1 clock tick late compared to the word select because the i2s is configure with most significant bit first.
Any idea with this occurs ?
Regards,
Matt