Trouble with ESP32 and LJ/RJ I2S Audio MSB/LSB
Posted: Thu Nov 05, 2020 9:17 pm
I'm trying to bring up a AK4552 https://datasheetspdf.com/pdf-file/1370 ... s/AK4552/1 Audio Codec, which works so far, but I'm getting distortion on low signal levels. The ADC is 24-bit MSB justified, while the DAC is 24-bit LSB justified.
How do I properly run the ADC in 24-bit MSB justified mode while DAC is in 24-bit LSB justified mode)?
Code: Select all
int mclk_rate = fs * 384; // FIXME: factor depends on fs and CKS pins settings
static const i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_TX),
.sample_rate = fs,
.bits_per_sample = I2S_BITS_PER_SAMPLE_24BIT,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, // switch to left only?
.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB),
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // high interrupt priority
.dma_buf_count = 2,
.dma_buf_len = AudioDriver::BufferSize,
.use_apll = true,
.tx_desc_auto_clear = false,
.fixed_mclk = mclk_rate
};