Setup: ESP32 connected to PCM1681 in dual-stereo I2S mode (i.e. both I2S peripherals being used on the ESP32 to provide four channel output). The ESP32 is generating MCLK via APLL at 512x sample rate.
This is my initial register config:
#ifndef _PCM1681_REG_CFG_
#define _PCM1681_REG_CFG_
#ifdef __cplusplus
extern "C"
{
#endif
#define DAMS_BIT_OFFSET (0x80)
#define DEFAULT_ATTENUATION (0xFF) // 0 dB
typedef struct
{
uint8_t address;
uint8_t data;
} pcm1681_cfg_reg_t;
static const pcm1681_cfg_reg_t pcm1681_reg_defaults[] = {
{0x01, DEFAULT_ATTENUATION},
{0x02, DEFAULT_ATTENUATION},
{0x03, DEFAULT_ATTENUATION},
{0x04, DEFAULT_ATTENUATION},
{0x05, DEFAULT_ATTENUATION},
{0x06, DEFAULT_ATTENUATION},
{0x07, 0x00},
{0x08, 0x00},
{0x09, 0x04}, /* format config; 4: I2S stereo 16-bit to 24-bit */
{0x0A, 0x00},
{0x0B, 0xff},
{0x0C, 0x0f},
{0x0D, DAMS_BIT_OFFSET}, // DAMS = 1
{0x10, DEFAULT_ATTENUATION},
{0x11, DEFAULT_ATTENUATION},
{0x12, 0x00},
{0x13, 0x00},
};
#ifdef __cplusplus
}
#endif
#endif // _PCM1681_REG_CFG_
After startup, the only register I am touching is soft mute, upon shutdown to avoid pops.
Sending DATA1 24-bit stereo I2S audio, the DAC seems to be just outputting the right channel on both VOUT1 and VOUT2
Likewise, DATA2 stereo seems to be just outputting the right channel on both VOUT3 and VOUT4
With a test mode in my app that outputs a spoken word on each channel (i.e. recordings of someone saying "One", "Two", "Three", "Four"), I only ever hear "Two" out both the front speakers and "Four" out the rear speakers.
From the datasheet, I would expect to hear left and right audio on VOUT1 and VOUT2, respectively, and likewise for VOUT3 and VOUT4. Basically I expect to hear the same number as the VOUT number while my test is running.
Am I doing something wrong?
I'm going to sniff my I2S data and double check that I'm not just accidentally sending the right channel in both slots, but I'm pretty sure that part is working. About 90% sure.