This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PCM5122: I2S Master Mode Issue

Part Number: PCM5122

Hi, 

 

I have a oscillator connected to the SCK pin of 36.864MHz and I want to use the chip in I2S master mode. this is connected to my STMcontroller which streams with a sampling frequency of 48KHz.

I made my init function below for the streaming I set up a DMA stream.

WhenI measure, I measure the following on the I2S lines:

SCK: 36.864MHZ (from oscilator)
BCK: 1.152MHz (which I don't believe to be correct)
SD: (Has data)
WS: 9KHz (which I don't believe to be correct)

I read the read only registers but the only conclusion I feel I can make is that I made a mistake somewhere in my clocking setup:
Reg 0x04 - PLL: UNLOCKED, Enabled=1
Reg 0x5A - Overflow Flags: L1OV=0 R1OV=0 L2OV=0 R2OV=0 SFOV=0
Reg 0x5B - Detected FS: Error, SCK ratio: 0
Reg 0x5D - Detected BCK ratio: 128 BCKs per frame
Reg 0x5E - Clock Status: CDST=0 PLL-L=0 LRCK/BCK=1 FS-SCKr=0 SCKval=1 BCKval=1 FSval=0
Reg 0x5F - Clock Error Flags: LTSH=0 CKMF=0 CSRF=0 CERF=1
Reg 0x6C - Analog Mute: Left=0 Right=0
Reg 0x78 - Auto-Mute: Left=0 Right=0

Here is the code for my init funcion as well, I control the chip via I2C

HAL_StatusTypeDef PCM5122_Init(void)

{

HAL_StatusTypeDef status;



// Page 0

status = PCM5122_WriteRegister(0x00, 0x00);

if (status != HAL_OK) return status;

// Soft Reset ON

status = PCM5122_WriteRegister(0x02, 0x10);

if (status != HAL_OK) return status;

HAL_Delay(10);




// Page 253

status = PCM5122_WriteRegister(0x00, 253);

if (status != HAL_OK) return status;

// Clock flex

status = PCM5122_WriteRegister(0x3F, 0x11);

if (status != HAL_OK) return status;

status = PCM5122_WriteRegister(0x40, 0xFF);

if (status != HAL_OK) return status;




// Page 0

status = PCM5122_WriteRegister(0x00, 0x00);

if (status != HAL_OK) return status;




// MASTER mode

status = PCM5122_WriteRegister(0x09, 0b00010001);

if (status != HAL_OK) return status;




// Disable auto clock

status = PCM5122_WriteRegister(0x25, 0b00000010);

if (status != HAL_OK) return status;




// Reset BCK/LRCK dividers

status = PCM5122_WriteRegister(0x0C, 0b00000000);

if (status != HAL_OK) return status;

status = PCM5122_WriteRegister(0x0C, 0b00000011);

if (status != HAL_OK) return status;




// Clock source = SCK

status = PCM5122_WriteRegister(0x0E, 0b00110000);

if (status != HAL_OK) return status;




// DAC clock divider (correct for 36.864 MHz → 48 kHz)

status = PCM5122_WriteRegister(0x1C, (48-1)); // 48-1

if (status != HAL_OK) return status;




// I2S format

status = PCM5122_WriteRegister(0x28, 0b00000011);

if (status != HAL_OK) return status;




// Disable auto mute

status = PCM5122_WriteRegister(0x41, 0x00);

if (status != HAL_OK) return status;




//Configure PLL for audio core (48 kHz target, 36.864 MHz SCK)

status = PCM5122_WriteRegister(0x14, (3 -1)); // PLL P

if (status != HAL_OK) return status;

status = PCM5122_WriteRegister(0x15, 1); // PLL J

if (status != HAL_OK) return status;

status = PCM5122_WriteRegister(0x17, 8); // PLL D

if (status != HAL_OK) return status;

status = PCM5122_WriteRegister(0x18, (8-1)); // PLL R (post-divider)

if (status != HAL_OK) return status;




// Enable PLL

status = PCM5122_WriteRegister(0x04, 0b00000001);

if (status != HAL_OK) return status;

HAL_Delay(10); // wait for PLL to lock




// Unmute DACs

status = PCM5122_WriteRegister(0x03, 0x00);

if (status != HAL_OK) return status;

// Soft Reset OFF

status = PCM5122_WriteRegister(0x02, 0x00);

if (status != HAL_OK) return status;




HAL_Delay(10);




return HAL_OK;

}
  • Hi William,

    For your intended fs and SCK, the recommended PLL values per Table 131 are P = 3, J = 8, D = 0, and R = 1.

    This is set by registers:

    0x14 = 0x02

    0x15 = 0x08

    0x17 = 0x00

    0x18 = 0x00

    Give these values a try.

    Best,

    Garret

  • Hi, 

    Hmm, No that didn't do it, I searched a bit further and set the divers after the reset of the BCK/LRCK Dividers.
    It does say PLL locked now but my detected FS is still wrong.

    Reg 0x04 - PLL: LOCKED, Enabled=1
    Reg 0x5A - Overflow Flags: L1OV=0 R1OV=0 L2OV=0 R2OV=0 SFOV=0
    Reg 0x5B - Detected FS: 8kHz, SCK ratio: 9
    Reg 0x5D - Detected BCK ratio: 64 BCKs per frame
    Reg 0x5E - Clock Status: CDST=0 PLL-L=0 LRCK/BCK=0 FS-SCKr=0 SCKval=0 BCKval=0 FSval=0
    Reg 0x5F - Clock Error Flags: LTSH=0 CKMF=0 CSRF=0 CERF=0
    Reg 0x6C - Analog Mute: Left=0 Right=0
    Reg 0x78 - Auto-Mute: Left=0 Right=0


    HAL_StatusTypeDef PCM5122_Init(void)

    {

    HAL_StatusTypeDef status;

    // Page 0

    status = PCM5122_WriteRegister(0x00, 0x00);

    if (status != HAL_OK) return status;

    // Soft Reset ON

    status = PCM5122_WriteRegister(0x02, 0x10);

    if (status != HAL_OK) return status;

    HAL_Delay(10);

    // Page 253

    status = PCM5122_WriteRegister(0x00, 253);

    if (status != HAL_OK) return status;

    // Clock flex

    status = PCM5122_WriteRegister(0x3F, 0x11);

    if (status != HAL_OK) return status;

    status = PCM5122_WriteRegister(0x40, 0xFF);

    if (status != HAL_OK) return status;

    // Page 0

    status = PCM5122_WriteRegister(0x00, 0x00);

    if (status != HAL_OK) return status;

    // MASTER mode

    status = PCM5122_WriteRegister(0x09, 0b00010001);

    if (status != HAL_OK) return status;

    // Disable auto clock

    status = PCM5122_WriteRegister(0x25, 0b00000010);

    if (status != HAL_OK) return status;

    // Reset BCK/LRCK dividers

    status = PCM5122_WriteRegister(0x0C, 0b00000000);

    if (status != HAL_OK) return status;

    status = PCM5122_WriteRegister(0x0C, 0b00000011);

    if (status != HAL_OK) return status;

    // MASTER MODE DIVIDERS

    status = PCM5122_WriteRegister(0x20, 0x0B); // BCK divider = SCK / 12 → 3.072 MHz

    if (status != HAL_OK) return status;

    status = PCM5122_WriteRegister(0x21, 0x3F); // LRCK divider = BCK / 64 → 48 kHz

    if (status != HAL_OK) return status;

    // Clock source = SCK

    status = PCM5122_WriteRegister(0x0E, 0b00110000);

    if (status != HAL_OK) return status;

    // DAC clock divider (correct for 36.864 MHz → 48 kHz)

    status = PCM5122_WriteRegister(0x1C, (48-1)); // 48-1

    if (status != HAL_OK) return status;

    // I2S format

    status = PCM5122_WriteRegister(0x28, 0b00000011);

    if (status != HAL_OK) return status;

    // Disable auto mute

    status = PCM5122_WriteRegister(0x41, 0x00);

    if (status != HAL_OK) return status;

    //Configure PLL for audio core (48 kHz target, 36.864 MHz SCK)

    status = PCM5122_WriteRegister(0x14, 0x02); // PLL P

    if (status != HAL_OK) return status;

    status = PCM5122_WriteRegister(0x15, 0x08); // PLL J

    if (status != HAL_OK) return status;

    status = PCM5122_WriteRegister(0x17, 0x00); // PLL D

    if (status != HAL_OK) return status;

    status = PCM5122_WriteRegister(0x18, 0x00); // PLL R (post-divider)

    if (status != HAL_OK) return status;

    // Enable PLL

    status = PCM5122_WriteRegister(0x04, 0b00000001);

    if (status != HAL_OK) return status;

    HAL_Delay(10); // wait for PLL to lock

    // Unmute DACs

    status = PCM5122_WriteRegister(0x03, 0x00);

    if (status != HAL_OK) return status;

    // Soft Reset OFF

    status = PCM5122_WriteRegister(0x02, 0x00);

    if (status != HAL_OK) return status;

    HAL_Delay(10);

    return HAL_OK;

    }



  • Hi William,

    That is good that the clocks are at least valid now. Does the clock detection registers match what you are measuring at LRCK and BCK pins?

    As in are you scoping a 8kHz LRCK and 512kHz BCK?

    SCK ratio = 9 suggests the PLL is set up correctly for a 36.864MHz SCK, but the other ratios imply the SCK is detecting as 6.144MHz. Can you send a scope shot of the SCK?

    Best,

    Garret

  • Hi,

    Well that's the weird part.

    BCK: 3.072MHz

    LRCLK: 48KHz

    SCK: 36.864MHz (from oscillator)

    SD: Data

    Kind regards,

    William

  • Hi William,

    If you are scoping the correct clocks, then I think this configuration is okay.

    Best,

    Garret

  • Right,
    Thank you!

    Before I close this just a small question.

    Is it a possibility that the data Im sending to the chip is wrong, or can a mistake on the output of the DAC also make such results?

    kind regards,

    William

  • Hi William,

    No the data should not have an effect on the clock detection architecture.

    Best,

    Garret

  • Hi, 


    I'm still having issues.


    Reg 0x04 - PLL: LOCKED, Enabled=1
    Reg 0x5A - Overflow Flags: L1OV=0 R1OV=0 L2OV=0 R2OV=0 SFOV=0
    Reg 0x5B - Detected FS: 32-48kHz, SCK ratio: 9
    Reg 0x5D - Detected BCK ratio: 64 BCKs per frame
    Reg 0x5E - Clock Status: CDST=0 PLL-L=0 LRCK/BCK=0 FS-SCKr=0 SCKval=0 BCKval=0 FSval=0
    Reg 0x5F - Clock Error Flags: LTSH=0 CKMF=0 CSRF=0 CERF=0
    Reg 0x6C - Analog Mute: Left=0 Right=0
    Reg 0x78 - Auto-Mute: Left=0 Right=0

    Everything is detecting allright now.
    But I'm still muted. But im not muting the chip.

    I'm confused.

    Kind regards, 

    William

  • Update, 

    I turned of the reset before and after my init function.

    And commented out the flex registers on page 253.

    Now my signal is messed up but my DAC in no longer in MUTE.

  • Hi William,

    Can you send a scope of your output signal? How is it messed up?

    Best,

    Garret

  • Hi,

    It has the right frequency I thank, I can see it jump in the KHz range.
    (I'm expecting a 1KHz sine wave in a full scale output.)



    I'm thinking it has something to do with the DAC divider.



    I also reenabled the clock flex registers but this didn't have an effect.

    Kind regards,

    William

  • Hi William,

    Can you send a full register dump? And the input data file?

    Best,

    Garret

  • Yes,

    === PAGE 0 ===
    P0 Reg 0x01 = 0x00 (0b00000000)
    P0 Reg 0x02 = 0x00 (0b00000000)
    P0 Reg 0x03 = 0x00 (0b00000000)
    P0 Reg 0x04 = 0x01 (0b00000001)
    P0 Reg 0x06 = 0x00 (0b00000000)
    P0 Reg 0x07 = 0x00 (0b00000000)
    P0 Reg 0x08 = 0x00 (0b00000000)
    P0 Reg 0x09 = 0x11 (0b00010001)
    P0 Reg 0x0A = 0x00 (0b00000000)
    P0 Reg 0x0C = 0x03 (0b00000011)
    P0 Reg 0x0D = 0x00 (0b00000000)
    P0 Reg 0x0E = 0x30 (0b00110000)
    P0 Reg 0x12 = 0x00 (0b00000000)
    P0 Reg 0x13 = 0x10 (0b00010000)
    P0 Reg 0x14 = 0x02 (0b00000010)
    P0 Reg 0x15 = 0x08 (0b00001000)
    P0 Reg 0x16 = 0x00 (0b00000000)
    P0 Reg 0x17 = 0x00 (0b00000000)
    P0 Reg 0x18 = 0x00 (0b00000000)
    P0 Reg 0x1B = 0x00 (0b00000000)
    P0 Reg 0x1C = 0x2F (0b00101111)
    P0 Reg 0x1D = 0x00 (0b00000000)
    P0 Reg 0x1E = 0x00 (0b00000000)
    P0 Reg 0x20 = 0x0B (0b00001011)
    P0 Reg 0x21 = 0x3F (0b00111111)
    P0 Reg 0x22 = 0x00 (0b00000000)
    P0 Reg 0x23 = 0x01 (0b00000001)
    P0 Reg 0x24 = 0x00 (0b00000000)
    P0 Reg 0x25 = 0x02 (0b00000010)
    P0 Reg 0x28 = 0x03 (0b00000011)
    P0 Reg 0x29 = 0x00 (0b00000000)
    P0 Reg 0x2A = 0x11 (0b00010001)
    P0 Reg 0x2B = 0x01 (0b00000001)
    P0 Reg 0x2C = 0x00 (0b00000000)
    P0 Reg 0x3B = 0x66 (0b01100110)
    P0 Reg 0x3C = 0x00 (0b00000000)
    P0 Reg 0x3D = 0x30 (0b00110000)
    P0 Reg 0x3E = 0x30 (0b00110000)
    P0 Reg 0x3F = 0x22 (0b00100010)
    P0 Reg 0x40 = 0x02 (0b00000010)
    P0 Reg 0x41 = 0x00 (0b00000000)
    P0 Reg 0x50 = 0x00 (0b00000000)
    P0 Reg 0x51 = 0x00 (0b00000000)
    P0 Reg 0x52 = 0x00 (0b00000000)
    P0 Reg 0x53 = 0x00 (0b00000000)
    P0 Reg 0x54 = 0x00 (0b00000000)
    P0 Reg 0x55 = 0x00 (0b00000000)
    P0 Reg 0x56 = 0x00 (0b00000000)
    P0 Reg 0x57 = 0x00 (0b00000000)
    P0 Reg 0x5A = 0x00 (0b00000000)
    P0 Reg 0x5B = 0x39 (0b00111001)
    P0 Reg 0x5C = 0x00 (0b00000000)
    P0 Reg 0x5D = 0x40 (0b01000000)
    P0 Reg 0x5E = 0x00 (0b00000000)
    P0 Reg 0x5F = 0x00 (0b00000000)
    P0 Reg 0x6C = 0x33 (0b00110011)
    P0 Reg 0x6D = 0x00 (0b00000000)
    P0 Reg 0x72 = 0x03 (0b00000011)
    P0 Reg 0x73 = 0x00 (0b00000000)
    P0 Reg 0x76 = 0x87 (0b10000111)
    P0 Reg 0x77 = 0x01 (0b00000001)
    P0 Reg 0x78 = 0x00 (0b00000000)
    P0 Reg 0x79 = 0x00 (0b00000000)
    P0 Reg 0x7A = 0x00 (0b00000000)
    P0 Reg 0x7B = 0x00 (0b00000000)
    P0 Reg 0x7C = 0x00 (0b00000000)
    P0 Reg 0x7D = 0x00 (0b00000000)
    
    === PAGE 1 ===
    P1 Reg 0x01 = 0x00 (0b00000000)
    P1 Reg 0x02 = 0x00 (0b00000000)
    P1 Reg 0x05 = 0x00 (0b00000000)
    P1 Reg 0x06 = 0x01 (0b00000001)
    P1 Reg 0x07 = 0x00 (0b00000000)
    P1 Reg 0x08 = 0x00 (0b00000000)
    P1 Reg 0x09 = 0x01 (0b00000001)
    
    === PAGE 44 ===
    P44 Reg 0x01 = 0x00 (0b00000000)
    
    === PAGE 253 ===
    P253 Reg 0x3F = 0x11 (0b00010001)
    P253 Reg 0x40 = 0xFF (0b11111111)

    Sample 1180 L: 2073095680       R: 2073095680
    Sample 1182 L: 1982223488       R: 1982223488
    Sample 1184 L: 1857434624       R: 1857434624
    Sample 1186 L: 1700864768       R: 1700864768
    Sample 1188 L: 1515192704       R: 1515192704
    Sample 1190 L: 1303595264       R: 1303595264
    Sample 1192 L: 1069692864       R: 1069692864
    Sample 1194 L: 817487744        R: 817487744
    Sample 1196 L: 551295232        R: 551295232
    Sample 1198 L: 275669920        R: 275669920
    Sample 1200 L: -4672184 R: -4672184
    Sample 1202 L: -1700770304      R: -1700770304
    Sample 1204 L: -1515082624      R: -1515082624
    Sample 1206 L: -1303471360      R: -1303471360
    Sample 1208 L: -1069557312      R: -1069557312
    Sample 1210 L: -817342720       R: -817342720
    Sample 1212 L: -551143168       R: -551143168
    Sample 1214 L: -275513344       R: -275513344
    Sample 1216 L: 4830579  R: 4830579
    Sample 1218 L: 285091424        R: 285091424
    Sample 1220 L: 560474240        R: 560474240
    Sample 1222 L: 826267264        R: 826267264
    Sample 1224 L: 1077922560       R: 1077922560
    Sample 1226 L: 1311134336       R: 1311134336
    Sample 1228 L: 1521912192       R: 1521912192
    Sample 1230 L: 1706649600       R: 1706649600
    Sample 1232 L: 1862185856       R: 1862185856
    Sample 1234 L: 1985859712       R: 1985859712
    Sample 1236 L: 2075554816       R: 2075554816
    Sample 1238 L: 2129736704       R: 2129736704
    Sample 1240 L: 2147478272       R: 2147478272
    Sample 1242 L: -1311252736      R: -1311252736
    Sample 1244 L: -1522017664      R: -1522017664
    Sample 1246 L: -1706740736      R: -1706740736
    Sample 1248 L: -1862260864      R: -1862260864
    Sample 1250 L: -1985917184      R: -1985917184
    Sample 1252 L: -2075593728      R: -2075593728
    Sample 1254 L: -2129756160      R: -2129756160
    Sample 1256 L: -2147477888      R: -2147477888
    Sample 1258 L: -2128455424      R: -2128455424
    Sample 1260 L: -2073014400      R: -2073014400
    Sample 1262 L: -1982103552      R: -1982103552
    Sample 1264 L: -1857278080      R: -1857278080
    Sample 1266 L: -1700674048      R: -1700674048
    Sample 1268 L: -1514970880      R: -1514970880
    Sample 1270 L: -1303346048      R: -1303346048
    Sample 1272 L: -1069420544      R: -1069420544
    Sample 1274 L: -817196864       R: -817196864
    Sample 1276 L: -550990720       R: -550990720
    Sample 1278 L: -275356960       R: -275356960
    Sample 1280 L: 1857200768       R: 1857200768
    Sample 1282 L: 1700580352       R: 1700580352
    Sample 1284 L: 1514862464       R: 1514862464
    Sample 1286 L: 1303224960       R: 1303224960
    Sample 1288 L: 1069288832       R: 1069288832
    Sample 1290 L: 817056896        R: 817056896
    Sample 1292 L: 550844928        R: 550844928
    Sample 1294 L: 275207872        R: 275207872
    Sample 1296 L: -5138103 R: -5138103
    Sample 1298 L: -285396160       R: -285396160
    Sample 1300 L: -560771008       R: -560771008
    Sample 1302 L: -826550912       R: -826550912
    Sample 1304 L: -1078188288      R: -1078188288
    Sample 1306 L: -1311377536      R: -1311377536
    Sample 1308 L: -1522128896      R: -1522128896
    Sample 1310 L: -1706836352      R: -1706836352
    Sample 1312 L: -1862339456      R: -1862339456
    Sample 1314 L: -1985977216      R: -1985977216
    Sample 1316 L: -2075634176      R: -2075634176
    Sample 1318 L: 826697280        R: 826697280
    Sample 1320 L: 1078325504       R: 1078325504
    Sample 1322 L: 1311503360       R: 1311503360
    Sample 1324 L: 1522240896       R: 1522240896
    Sample 1326 L: 1706932352       R: 1706932352
    Sample 1328 L: 1862417920       R: 1862417920
    Sample 1330 L: 1986036992       R: 1986036992
    Sample 1332 L: 2075674368       R: 2075674368
    Sample 1334 L: 2129796480       R: 2129796480
    Sample 1336 L: 2147477120       R: 2147477120
    Sample 1338 L: 2128413824       R: 2128413824
    Sample 1340 L: 2072932864       R: 2072932864
    Sample 1342 L: 1981983488       R: 1981983488
    Sample 1344 L: 1857121536       R: 1857121536
    Sample 1346 L: 1700483968       R: 1700483968
    Sample 1348 L: 1514750720       R: 1514750720
    Sample 1350 L: 1303099520       R: 1303099520
    Sample 1352 L: 1069152064       R: 1069152064
    Sample 1354 L: 816911104        R: 816911104
    Sample 1356 L: 550692544        R: 550692544
    Sample 1358 L: -1981924096      R: -1981924096
    Sample 1360 L: -1857044096      R: -1857044096
    Sample 1362 L: -1700389504      R: -1700389504
    Sample 1364 L: -1514640640      R: -1514640640
    Sample 1366 L: -1302975744      R: -1302975744
    Sample 1368 L: -1069016448      R: -1069016448
    Sample 1370 L: -816766016       R: -816766016
    Sample 1372 L: -550540416       R: -550540416
    Sample 1374 L: -274894880       R: -274894880
    Sample 1376 L: 5454193  R: 5454193
    Sample 1378 L: 285709504        R: 285709504
    Sample 1380 L: 561076224        R: 561076224
    Sample 1382 L: 826842816        R: 826842816
    Sample 1384 L: 1078461824       R: 1078461824
    Sample 1386 L: 1311628160       R: 1311628160
    Sample 1388 L: 1522352128       R: 1522352128
    Sample 1390 L: 1707028096       R: 1707028096
    Sample 1392 L: 1862496384       R: 1862496384
    Sample 1394 L: 1986097024       R: 1986097024
    Sample 1396 L: -561220736       R: -561220736
    Sample 1398 L: -826980928       R: -826980928
    Sample 1400 L: -1078591232      R: -1078591232
    Sample 1402 L: -1311746560      R: -1311746560
    Sample 1404 L: -1522457472      R: -1522457472
    Sample 1406 L: -1707119104      R: -1707119104
    Sample 1408 L: -1862571392      R: -1862571392
    Sample 1410 L: -1986154368      R: -1986154368
    Sample 1412 L: -2075753728      R: -2075753728
    Sample 1414 L: -2129836160      R: -2129836160
    Sample 1416 L: -2147476352      R: -2147476352
    Sample 1418 L: -2128372480      R: -2128372480
    Sample 1420 L: -2072851584      R: -2072851584
    Sample 1422 L: -1981863424      R: -1981863424
    Sample 1424 L: -1856964992      R: -1856964992
    Sample 1426 L: -1700293120      R: -1700293120
    Sample 1428 L: -1514528768      R: -1514528768
    Sample 1430 L: -1302850304      R: -1302850304
    Sample 1432 L: -1068879680      R: -1068879680
    Sample 1434 L: 2128351872       R: 2128351872
    Sample 1436 L: 2072811136       R: 2072811136
    Sample 1438 L: 1981804032       R: 1981804032
    Sample 1440 L: 1856887552       R: 1856887552
    Sample 1442 L: 1700199424       R: 1700199424
    Sample 1444 L: 1514420352       R: 1514420352
    Sample 1446 L: 1302729216       R: 1302729216
    Sample 1448 L: 1068747968       R: 1068747968
    Sample 1450 L: 816480192        R: 816480192
    Sample 1452 L: 550242176        R: 550242176
    Sample 1454 L: 274589376        R: 274589376
    Sample 1456 L: -5761717 R: -5761717
    Sample 1458 L: -286014208       R: -286014208
    Sample 1460 L: -561372928       R: -561372928
    Sample 1462 L: -827126400       R: -827126400
    Sample 1464 L: -1078727552      R: -1078727552
    Sample 1466 L: -1311871360      R: -1311871360
    Sample 1468 L: -1522568704      R: -1522568704
    Sample 1470 L: -1707214720      R: -1707214720
    Sample 1472 L: -1862649856      R: -1862649856
    Sample 1474 L: 286171264        R: 286171264
    Sample 1476 L: 561525952        R: 561525952
    Sample 1478 L: 827272768        R: 827272768
    Sample 1480 L: 1078864768       R: 1078864768
    Sample 1482 L: 1311997056       R: 1311997056
    Sample 1484 L: 1522680704       R: 1522680704
    Sample 1486 L: 1707310720       R: 1707310720
    Sample 1488 L: 1862728320       R: 1862728320
    Sample 1490 L: 1986274176       R: 1986274176
    Sample 1492 L: 2075834240       R: 2075834240
    Sample 1494 L: 2129876224       R: 2129876224
    Sample 1496 L: 2147475456       R: 2147475456
    Sample 1498 L: 2128330880       R: 2128330880
    Sample 1500 L: 2072769920       R: 2072769920
    Sample 1502 L: 1981743360       R: 1981743360
    Sample 1504 L: 1856808320       R: 1856808320
    Sample 1506 L: 1700103040       R: 1700103040
    Sample 1508 L: 1514308608       R: 1514308608
    Sample 1510 L: 1302603776       R: 1302603776
    Sample 1512 L: -2147475072      R: -2147475072
    Sample 1514 L: -2128310400      R: -2128310400
    Sample 1516 L: -2072729728      R: -2072729728
    Sample 1518 L: -1981683968      R: -1981683968
    Sample 1520 L: -1856730880      R: -1856730880
    Sample 1522 L: -1700008448      R: -1700008448
    Sample 1524 L: -1514198400      R: -1514198400
    Sample 1526 L: -1302480000      R: -1302480000
    Sample 1528 L: -1068475584      R: -1068475584
    Sample 1530 L: -816189248       R: -816189248
    Sample 1532 L: -549937600       R: -549937600
    Sample 1534 L: -274276384       R: -274276384
    Sample 1536 L: 6077807  R: 6077807
    Sample 1538 L: 286327552        R: 286327552
    Sample 1540 L: 561678144        R: 561678144
    Sample 1542 L: 827418304        R: 827418304
    Sample 1544 L: 1079001088       R: 1079001088
    Sample 1546 L: 1312121856       R: 1312121856
    Sample 1548 L: 1522791808       R: 1522791808
    Sample 1550 L: 274127264        R: 274127264
    Sample 1552 L: -6227635 R: -6227635
    Sample 1554 L: -286476000       R: -286476000
    Sample 1556 L: -561822656       R: -561822656
    Sample 1558 L: -827556416       R: -827556416
    Sample 1560 L: -1079130368      R: -1079130368
    Sample 1562 L: -1312240256      R: -1312240256
    Sample 1564 L: -1522897280      R: -1522897280
    Sample 1566 L: -1707497344      R: -1707497344
    Sample 1568 L: -1862881664      R: -1862881664
    Sample 1570 L: -1986391424      R: -1986391424
    Sample 1572 L: -2075913472      R: -2075913472
    Sample 1574 L: -2129915776      R: -2129915776
    Sample 1576 L: -2147474560      R: -2147474560
    Sample 1578 L: -2128289408      R: -2128289408
    Sample 1580 L: -2072688512      R: -2072688512
    Sample 1582 L: -1981623168      R: -1981623168
    Sample 1584 L: -1856651648      R: -1856651648
    Sample 1586 L: -1699912192      R: -1699912192
    Sample 1588 L: -1514086656      R: -1514086656
    Sample 1590 L: 2129935744       R: 2129935744
    Sample 1592 L: 2147474176       R: 2147474176
    Sample 1594 L: 2128268672       R: 2128268672
    Sample 1596 L: 2072648064       R: 2072648064
    Sample 1598 L: 1981563776       R: 1981563776
    Sample 1600 L: 1856574208       R: 1856574208
    Sample 1602 L: 1699818368       R: 1699818368
    Sample 1604 L: 1513978240       R: 1513978240
    Sample 1606 L: 1302233344       R: 1302233344
    Sample 1608 L: 1068207040       R: 1068207040
    Sample 1610 L: 815903360        R: 815903360
    Sample 1612 L: 549639360        R: 549639360
    Sample 1614 L: 273970880        R: 273970880
    Sample 1616 L: -6385330 R: -6385330
    Sample 1618 L: -286632256       R: -286632256
    Sample 1620 L: -561974848       R: -561974848
    Sample 1622 L: -827701888       R: -827701888
    Sample 1624 L: -1079266688      R: -1079266688
    Sample 1626 L: -1312365056      R: -1312365056
    Sample 1628 L: -549487232       R: -549487232
    Sample 1630 L: -273814272       R: -273814272
    Sample 1632 L: 6543725  R: 6543725
    Sample 1634 L: 286789312        R: 286789312
    Sample 1636 L: 562127872        R: 562127872
    Sample 1638 L: 827848256        R: 827848256
    Sample 1640 L: 1079403904       R: 1079403904
    Sample 1642 L: 1312490752       R: 1312490752
    Sample 1644 L: 1523120384       R: 1523120384
    Sample 1646 L: 1707688960       R: 1707688960
    Sample 1648 L: 1863038592       R: 1863038592
    Sample 1650 L: 1986511104       R: 1986511104
    Sample 1652 L: 2075993856       R: 2075993856
    Sample 1654 L: 2129955840       R: 2129955840
    Sample 1656 L: 2147473664       R: 2147473664
    Sample 1658 L: 2128247680       R: 2128247680
    Sample 1660 L: 2072606720       R: 2072606720
    Sample 1662 L: 1981502976       R: 1981502976
    Sample 1664 L: 1856494976       R: 1856494976
    Sample 1666 L: -1986568448      R: -1986568448
    Sample 1668 L: -2076032640      R: -2076032640
    Sample 1670 L: -2129975168      R: -2129975168
    Sample 1672 L: -2147473152      R: -2147473152
    Sample 1674 L: -2128227200      R: -2128227200
    Sample 1676 L: -2072566528      R: -2072566528
    Sample 1678 L: -1981443584      R: -1981443584
    Sample 1680 L: -1856417408      R: -1856417408
    Sample 1682 L: -1699627392      R: -1699627392
    Sample 1684 L: -1513756160      R: -1513756160
    Sample 1686 L: -1301984128      R: -1301984128
    Sample 1688 L: -1067934592      R: -1067934592
    Sample 1690 L: -815612352       R: -815612352
    Sample 1692 L: -549334784       R: -549334784
    Sample 1694 L: -273657856       R: -273657856
    Sample 1696 L: 6701420  R: 6701420
    Sample 1698 L: 286945600        R: 286945600
    Sample 1700 L: 562280064        R: 562280064
    Sample 1702 L: 827993728        R: 827993728
    Sample 1704 L: 1079540224       R: 1079540224
    Sample 1706 L: 815472320        R: 815472320
    Sample 1708 L: 549188928        R: 549188928
    Sample 1710 L: 273508736        R: 273508736
    Sample 1712 L: -6851248 R: -6851248
    Sample 1714 L: -287094016       R: -287094016
    Sample 1716 L: -562424512       R: -562424512
    Sample 1718 L: -828131776       R: -828131776
    Sample 1720 L: -1079669504      R: -1079669504
    Sample 1722 L: -1312733824      R: -1312733824
    Sample 1724 L: -1523336832      R: -1523336832
    Sample 1726 L: -1707875584      R: -1707875584
    Sample 1728 L: -1863191808      R: -1863191808
    Sample 1730 L: -1986628352      R: -1986628352
    Sample 1732 L: -2076072960      R: -2076072960
    Sample 1734 L: -2129995264      R: -2129995264
    Sample 1736 L: -2147472768      R: -2147472768
    Sample 1738 L: -2128206080      R: -2128206080
    Sample 1740 L: -2072525312      R: -2072525312
    Sample 1742 L: -1981382784      R: -1981382784
    Sample 1744 L: 1863270272       R: 1863270272
    Sample 1746 L: 1986688000       R: 1986688000
    Sample 1748 L: 2076113024       R: 2076113024
    Sample 1750 L: 2130015232       R: 2130015232
    Sample 1752 L: 2147472256       R: 2147472256
    Sample 1754 L: 2128185344       R: 2128185344
    Sample 1756 L: 2072484736       R: 2072484736
    Sample 1758 L: 1981323392       R: 1981323392
    Sample 1760 L: 1856260736       R: 1856260736
    Sample 1762 L: 1699437184       R: 1699437184
    Sample 1764 L: 1513535872       R: 1513535872
    Sample 1766 L: 1301737472       R: 1301737472
    Sample 1768 L: 1067665984       R: 1067665984
    Sample 1770 L: 815326464        R: 815326464
    Sample 1772 L: 549036480        R: 549036480
    Sample 1774 L: 273352320        R: 273352320
    Sample 1776 L: -7008943 R: -7008943
    Sample 1778 L: -287250304       R: -287250304
    Sample 1780 L: -562576704       R: -562576704
    Sample 1782 L: -1301613568      R: -1301613568
    Sample 1784 L: -1067530304      R: -1067530304
    Sample 1786 L: -815181312       R: -815181312
    Sample 1788 L: -548884352       R: -548884352
    Sample 1790 L: -273195744       R: -273195744
    Sample 1792 L: 7167338  R: 7167338
    Sample 1794 L: 287407328        R: 287407328
    Sample 1796 L: 562729728        R: 562729728
    Sample 1798 L: 828423616        R: 828423616
    Sample 1800 L: 1079942912       R: 1079942912
    Sample 1802 L: 1312984192       R: 1312984192
    Sample 1804 L: 1523559936       R: 1523559936
    Sample 1806 L: 1708066944       R: 1708066944
    Sample 1808 L: 1863348608       R: 1863348608
    Sample 1810 L: 1986747904       R: 1986747904
    Sample 1812 L: 2076153344       R: 2076153344
    Sample 1814 L: 2130035328       R: 2130035328
    Sample 1816 L: 2147471744       R: 2147471744
    Sample 1818 L: 2128164352       R: 2128164352
    Sample 1820 L: 2072443392       R: 2072443392
    Sample 1822 L: -1708157952      R: -1708157952
    Sample 1824 L: -1863423488      R: -1863423488
    Sample 1826 L: -1986805248      R: -1986805248
    Sample 1828 L: -2076192128      R: -2076192128
    Sample 1830 L: -2130054656      R: -2130054656
    Sample 1832 L: -2147471232      R: -2147471232
    Sample 1834 L: -2128143744      R: -2128143744
    Sample 1836 L: -2072403200      R: -2072403200
    Sample 1838 L: -1981203072      R: -1981203072
    Sample 1840 L: -1856103936      R: -1856103936
    Sample 1842 L: -1699246208      R: -1699246208
    Sample 1844 L: -1513313792      R: -1513313792
    Sample 1846 L: -1301488128      R: -1301488128
    Sample 1848 L: -1067393472      R: -1067393472
    Sample 1850 L: -815035456       R: -815035456
    Sample 1852 L: -548731904       R: -548731904
    Sample 1854 L: -273039328       R: -273039328
    Sample 1856 L: 7325033  R: 7325033
    Sample 1858 L: 287563616        R: 287563616
    Sample 1860 L: 1513205248       R: 1513205248
    Sample 1862 L: 1301366912       R: 1301366912
    Sample 1864 L: 1067261696       R: 1067261696
    Sample 1866 L: 814895424        R: 814895424
    Sample 1868 L: 548586048        R: 548586048
    Sample 1870 L: 272890208        R: 272890208
    Sample 1872 L: -7474860 R: -7474860
    Sample 1874 L: -287712032       R: -287712032
    Sample 1876 L: -563026368       R: -563026368
    Sample 1878 L: -828707136       R: -828707136
    Sample 1880 L: -1080208512      R: -1080208512
    Sample 1882 L: -1313227264      R: -1313227264
    Sample 1884 L: -1523776384      R: -1523776384
    Sample 1886 L: -1708253440      R: -1708253440
    Sample 1888 L: -1863501824      R: -1863501824
    Sample 1890 L: -1986865024      R: -1986865024
    Sample 1892 L: -2076232320      R: -2076232320
    Sample 1894 L: -2130074624      R: -2130074624
    Sample 1896 L: -2147470592      R: -2147470592
    Sample 1898 L: 1313352960       R: 1313352960
    Sample 1900 L: 1523888256       R: 1523888256
    Sample 1902 L: 1708349312       R: 1708349312
    Sample 1904 L: 1863580160       R: 1863580160
    Sample 1906 L: 1986924672       R: 1986924672
    Sample 1908 L: 2076272384       R: 2076272384
    Sample 1910 L: 2130094464       R: 2130094464
    Sample 1912 L: 2147470080       R: 2147470080
    Sample 1914 L: 2128101888       R: 2128101888
    Sample 1916 L: 2072321280       R: 2072321280
    Sample 1918 L: 1981082752       R: 1981082752
    Sample 1920 L: 1855947136       R: 1855947136
    Sample 1922 L: 1699055872       R: 1699055872
    Sample 1924 L: 1513093376       R: 1513093376
    Sample 1926 L: 1301241472       R: 1301241472
    Sample 1928 L: 1067124864       R: 1067124864
    Sample 1930 L: 814749504        R: 814749504
    Sample 1932 L: 548433536        R: 548433536
    Sample 1934 L: 272733792        R: 272733792
    Sample 1936 L: -7632555 R: -7632555
    Sample 1938 L: -1698961280      R: -1698961280
    Sample 1940 L: -1512983168      R: -1512983168
    Sample 1942 L: -1301117440      R: -1301117440
    Sample 1944 L: -1066989184      R: -1066989184
    Sample 1946 L: -814604352       R: -814604352
    Sample 1948 L: -548281408       R: -548281408
    Sample 1950 L: -272577184       R: -272577184
    Sample 1952 L: 7790950  R: 7790950
    Sample 1954 L: 288025344        R: 288025344
    Sample 1956 L: 563331520        R: 563331520
    Sample 1958 L: 828998912        R: 828998912
    Sample 1960 L: 1080481920       R: 1080481920
    Sample 1962 L: 1313477632       R: 1313477632
    Sample 1964 L: 1523999360       R: 1523999360
    Sample 1966 L: 1708444928       R: 1708444928
    Sample 1968 L: 1863658496       R: 1863658496
    Sample 1970 L: 1986984576       R: 1986984576
    Sample 1972 L: 2076312704       R: 2076312704
    Sample 1974 L: 2130114560       R: 2130114560
    Sample 1976 L: -1080611200      R: -1080611200
    Sample 1978 L: -1313595904      R: -1313595904
    Sample 1980 L: -1524104576      R: -1524104576
    Sample 1982 L: -1708535808      R: -1708535808
    Sample 1984 L: -1863733376      R: -1863733376
    Sample 1986 L: -1987041792      R: -1987041792
    Sample 1988 L: -2076351360      R: -2076351360
    Sample 1990 L: -2130133760      R: -2130133760
    Sample 1992 L: -2147468928      R: -2147468928
    Sample 1994 L: -2128060160      R: -2128060160
    Sample 1996 L: -2072239616      R: -2072239616
    Sample 1998 L: -1980962304      R: -1980962304
    Sample 2000 L: -1855790208      R: -1855790208
    Sample 2002 L: -1698864768      R: -1698864768
    Sample 2004 L: -1512871296      R: -1512871296
    Sample 2006 L: -1300992000      R: -1300992000
    Sample 2008 L: -1066852288      R: -1066852288
    Sample 2010 L: -814458432       R: -814458432
    Sample 2012 L: -548128960       R: -548128960
    Sample 2014 L: 1980902912       R: 1980902912
    Sample 2016 L: 1855712640       R: 1855712640
    Sample 2018 L: 1698770944       R: 1698770944
    Sample 2020 L: 1512762752       R: 1512762752
    Sample 2022 L: 1300870784       R: 1300870784
    Sample 2024 L: 1066720512       R: 1066720512
    Sample 2026 L: 814318400        R: 814318400
    Sample 2028 L: 547983104        R: 547983104
    Sample 2030 L: 272271616        R: 272271616
    Sample 2032 L: -8098472 R: -8098472
    Sample 2034 L: -288330016       R: -288330016
    Sample 2036 L: -563628160       R: -563628160
    Sample 2038 L: -829282432       R: -829282432
    Sample 2040 L: -1080747520      R: -1080747520
    Sample 2042 L: -1313720704      R: -1313720704
    Sample 2044 L: -1524215680      R: -1524215680
    Sample 2046 L: -1708631296      R: -1708631296

    Thank you.

    Kind Regards, 

    William

  • Hi William,

    Can you try to set register 14 to 0x00? Otherwise you could enable auto clocking mode to alleviate any concerns with the manual setup. Manual PLL configuration should not be necessary when using standard audio clock frequencies.

    Best,

    Garret

  • Hi, 

    There are a few updates, I had to switch to a 24.576MHz oscillator because of a misconfiguration with another chip on the same clock line.

    "Can you try to set register 14 to 0x00?" This didn't work.

    All right that sounds like a good idea, I started making a new init function. Based on using the auto clocking setup.

    But no I measure:
    BCK: 24.576 MHz
    SD: nothing
    WS: 24.576 MHz

    HAL_StatusTypeDef PCM5122_Init(void)

    {

    HAL_StatusTypeDef status;

    // Soft reset

    status = PCM5122_WriteRegister(0x00, 0x00);

    status = PCM5122_WriteRegister(0x02, 0x11); // Soft reset

    HAL_Delay(10);

    status = PCM5122_WriteRegister(0x02, 0x00); // Release reset

    HAL_Delay(10);

    // Page 0

    status = PCM5122_WriteRegister(0x00, 0x00);

    // Power up

    status = PCM5122_WriteRegister(0x02, 0x00);

    // AUTO CLOCKING + MASTER MODE

    status = PCM5122_WriteRegister(0x25, 0x00); // Auto clock enabled (DCAS=0)

    status = PCM5122_WriteRegister(0x0E, 0b00110000); // SCK as DAC clock source

    status = PCM5122_WriteRegister(0x0D, 0x00);

    status = PCM5122_WriteRegister(0x09, 0x11); // Master mode + BCKO + LRKO enabled

    status = PCM5122_WriteRegister(0x0C, 0b00000011); // Enable BCK/LRCK counters

    // I2S format 32-bit

    status = PCM5122_WriteRegister(0x28, 0b00000011);

    // Disable unwanted muting

    status = PCM5122_WriteRegister(0x41, 0x00); // Digital mute control

    status = PCM5122_WriteRegister(0x03, 0x00); // Unmute DACs

    // Advanced clock settings

    status = PCM5122_WriteRegister(0x00, 253);

    status = PCM5122_WriteRegister(0x3F, 0x11);

    status = PCM5122_WriteRegister(0x40, 0xFF);

    status = PCM5122_WriteRegister(0x00, 0x00); // Back to page 0

    HAL_Delay(20);

    return status;

    }

  • Hi William,

    It looks like you left out the BCLK and LRCK dividers which still must be configured.

  • Ow my apologies,

    Now if I read the debug registers it switches between:

    ========== PCM5122 CLOCK DEBUG ==========
    PLL Control (0x04): 0x20 [00100000]
    PLLE (PLL Enable) = 0 (1=enabled)
    PLCK (PLL Lock Flag) = 0 (0=locked, 1=not locked)

    DSP Overflow (0x5A): 0x04 [00000100]
    (Sticky bits - cleared on read)

    Detected FS / SCK Ratio (0x5B): 0xFF [11111111]                   // this can't be right
    DTFS[2:0] (Detected Sample Rate) = 7
    DTSR[3:0] (Detected SCK Ratio) = 15

    Detected BCK Ratio (0x5D): 0xE0 [11100000]
    BCKs per frame ≈ 224

    Clock Detector Status (0x5E): 0x08 [00001000]
    Bit7: RSV = 0
    CDST (SCK present) = 0 (0=present, 1=missing)
    PLL-L (PLL locked) = 0 (0=locked, 1=unlocked)
    LrckBck (LRCK/BCK present) = 0 (0=present, 1=both missing)
    fS-SCKr (FS/SCK ratio valid)= 1 (0=valid, 1=invalid)
    SCKval (SCK valid) = 0 (0=valid, 1=invalid)
    BCKval (BCK valid) = 0 (0=valid, 1=invalid)
    fSval (fS valid) = 0 (0=valid, 1=invalid)

    Clock Error/Halt Status (0x5F): 0x01 [00000001]
    (Most bits reserved)
    LTSH (Latched SCK Halt) = 0
    CKMF (Clock Missing) = 0
    CSRF (Clock Resync in prog)= 0
    CERF (Clock Error) = 1 (0=valid, 1=error)

    Analog Mute Monitor (0x6C): 0x50 [01010000]
    Left analog muted = 0
    Right analog muted = 0

    Auto Mute (0x78): 0xEF [11101111]
    Left auto-mute active = 1
    Right auto-mute active = 0
    ========================================

    ========== PCM5122 CLOCK DEBUG ==========
    PLL Control (0x04): 0x20 [00100000]
    PLLE (PLL Enable) = 0 (1=enabled)
    PLCK (PLL Lock Flag) = 0 (0=locked, 1=not locked)

    DSP Overflow (0x5A): 0x04 [00000100]
    (Sticky bits - cleared on read)

    Detected FS / SCK Ratio (0x5B): 0xFF [11111111]
    DTFS[2:0] (Detected Sample Rate) = 7
    DTSR[3:0] (Detected SCK Ratio) = 15

    Detected BCK Ratio (0x5D): 0xE0 [11100000]
    BCKs per frame ≈ 224

    Clock Detector Status (0x5E): 0x08 [00001000]
    Bit7: RSV = 0
    CDST (SCK present) = 0 (0=present, 1=missing)
    PLL-L (PLL locked) = 0 (0=locked, 1=unlocked)
    LrckBck (LRCK/BCK present) = 0 (0=present, 1=both missing)
    fS-SCKr (FS/SCK ratio valid)= 1 (0=valid, 1=invalid)
    SCKval (SCK valid) = 0 (0=valid, 1=invalid)
    BCKval (BCK valid) = 0 (0=valid, 1=invalid)
    fSval (fS valid) = 0 (0=valid, 1=invalid)

    Clock Error/Halt Status (0x5F): 0x01 [00000001]
    (Most bits reserved)
    LTSH (Latched SCK Halt) = 0
    CKMF (Clock Missing) = 0
    CSRF (Clock Resync in prog)= 0
    CERF (Clock Error) = 1 (0=valid, 1=error)

    Analog Mute Monitor (0x6C): 0x50 [01010000]
    Left analog muted = 0
    Right analog muted = 0

    Auto Mute (0x78): 0xEF [11101111]
    Left auto-mute active = 1
    Right auto-mute active = 0
    ========================================

    I measure:

    SCK: 24.567MHz
    BCK: 24.567MHz
    SD: no data
    WS: 24.567MHz

    Thank you already soo much!

    HAL_StatusTypeDef PCM5122_Init(void)

    {

    HAL_StatusTypeDef status;

    // Soft reset

    status = PCM5122_WriteRegister(0x00, 0x00);

    status = PCM5122_WriteRegister(0x02, 0x11); // Soft reset

    HAL_Delay(10);

    status = PCM5122_WriteRegister(0x02, 0x00); // Release reset

    HAL_Delay(10);

    // Page 0

    status = PCM5122_WriteRegister(0x00, 0x00);

    // Power up

    status = PCM5122_WriteRegister(0x02, 0x00);

    // === CLOCK CONFIGURATION ===

    // AUTO CLOCKING + MASTER MODE

    status = PCM5122_WriteRegister(0x25, 0x00); // Auto clock enabled (DCAS=0)

    // Reset BCK/LRCK divider counters first

    status = PCM5122_WriteRegister(0x0C, 0x00); // Reset both dividers

    HAL_Delay(1);

    status = PCM5122_WriteRegister(0x0C, 0b00000011); // Reset both dividers

    HAL_Delay(1);

    // SCK as DAC clock source

    status = PCM5122_WriteRegister(0x0E, 0b00110000);

    // Master mode + BCKO + LRKO enabled

    status = PCM5122_WriteRegister(0x09, 0x11);

    // Enable BCK/LRCK counters

    status = PCM5122_WriteRegister(0x0C, 0b00000011);

    // DBCK = 8 → BCK = 24.576 MHz / 8 = 3.072 MHz

    status = PCM5122_WriteRegister(0x20, (8 -1));

    // DLRK = 64 → LRCK = BCK / 64 = 48 kHz

    status = PCM5122_WriteRegister(0x21, (64 -1));

    // I2S format 32-bit

    status = PCM5122_WriteRegister(0x28, 0b00000011);

    // Disable unwanted muting

    status = PCM5122_WriteRegister(0x41, 0x00); // Digital mute control

    status = PCM5122_WriteRegister(0x03, 0x00); // Unmute DACs

    // Advanced clock settings

    status = PCM5122_WriteRegister(0x00, 253);

    status = PCM5122_WriteRegister(0x3F, 0x11);

    status = PCM5122_WriteRegister(0x40, 0xFF);

    status = PCM5122_WriteRegister(0x00, 0x00); // Back to page 0

    HAL_Delay(20);

    return status;

    }

  • Hi William,

    Our team is on holiday today. I will review and follow up next week.

    Best,

    Garret

  • Hi, 

    No Problem, happy Easter!

    ____


    I made a quick function to check something and well its now kind of working.

    I measure
    MCK: 24,567MHz
    BCK: 3.072MHz
    SD: data
    WS: 48KHz

    But nothing on the output of the DAC, this is because the output it muted and it also says the PLL is not locked but I'm seeing the clocks isn't that weird?



    HAL_StatusTypeDef PCM5122_Init(void)

    {

    HAL_StatusTypeDef status;

    // Manual clock mode

    PCM5122_WriteRegister(0x25, 0x02);

    // Disable PLL

    PCM5122_WriteRegister(0x04, 0x00);

    // Reset counters

    PCM5122_WriteRegister(0x0C, 0x00);

    HAL_Delay(1);

    // Correct dividers

    PCM5122_WriteRegister(0x20, 7); // BCK = 3.072 MHz

    PCM5122_WriteRegister(0x21, 63); // LRCK = 48 kHz

    // Enable counters

    PCM5122_WriteRegister(0x0C, 0x03);

    // I2S

    PCM5122_WriteRegister(0x28, 0x03);

    // Master mode

    PCM5122_WriteRegister(0x09, 0x11);

    HAL_Delay(50);

    return HAL_OK;

    }





  • Hi,

    I will be on the road for the next three days. I will try to keep up with my emails and the status of this, but I will pick this up again by Monday at the latest.

    My apologies for any delay.

    Kind regards,
    William

  • Hi William,

    It should not be a concern that the PLL is not locked since it is not enabled. There are a lot of ways to mute this device in hardware and software. Check the XSMT pin and any other mute registers.

    Best,

    Garret

  • Ah allright,

    XSMT I was indeed forgotten to pull high;
    I added these lines as well.

    PCM5122_WriteRegister(0x03, 0x00); // software unmute

    PCM5122_WriteRegister(0x41, 0x00); // disable auto mute

    I'll have a look into the muting options.

    It has also been decided to change the project a bit and for V2 this chip will not be on it.

    Thank you for all the help!

    Kinds regards, 

    William