Part Number: PCM5242
Other Parts Discussed in Thread: PCM5142
Hello!
I'm trying to create a simple startup/init code for PCM5142/PCM5242 family. Unfortunately I'm not able to get it working.
Also tried to just turn on/off GPIOs connected to led's but no success. Is there any recommended init procedure that may I'm missing?
So far trying:
write_byte_data(ADDR, 0x00, 0x00); // Set to page 0 write_byte_data(ADDR, 0x02, 0x10); // Standby Mode write_byte_data(ADDR, 0x01, 0x11); // Reset Modules and Mode Registers write_byte_data(ADDR, 0x37, 0x1A); // Disable reporting of missing SCLK as an error write_byte_data(ADDR, 0x13, 0x10); // Switch PLL input to BCLK write_byte_data(ADDR, 0x14, 0x10); // Set the clock source for the DAC // setup for 44.1kHz and derivatives int bckFreq = 44100; int p = 1; int r = 2; int j = 90316800 / bckFreq / r; int d = 0; //Derive clocks from the 90.3168MHz PLL int nmac = 2; int ndac = 16; int ncp = 4; int dosr = 8; int idac = 1024; // DSP clock / sample rate //PLL write_byte_data(ADDR, 0x20, p - 1); // P write_byte_data(ADDR, 0x21, j); // J write_byte_data(ADDR, 0x22, (d >> 8) & 0x3F); // D_MSB write_byte_data(ADDR, 0x23, d & 0xFF); // D_LSB write_byte_data(ADDR, 0x24, r - 1); // R //Clock dividers write_byte_data(ADDR, 0x27, nmac - 1); // DSP Clock write_byte_data(ADDR, 0x28, ndac - 1); // DAC Clock write_byte_data(ADDR, 0x29, ncp - 1); // NCP Clock write_byte_data(ADDR, 0x30, dosr - 1); // OSR Clock // IDAC (nb of DSP clock cycles per sample) write_byte_data(ADDR, 0x35, (idac >> 8) & 0xFF); // NCP Clock write_byte_data(ADDR, 0x36, idac & 0xFF); // OSR Clock write_byte_data(ADDR, 0x02, 0x00); // Normal Operation write_byte_data(ADDR, 0x01, 0x00); // Normal Operation write_byte_data(ADDR, 0x08, 0x08); // 08 Set GPIO4 as Output write_byte_data(ADDR, 0x83, 0x02); // Set GPIO4 as flag for clock errors write_byte_data(ADDR, 0x86, 0x08); // Set GPIO4 High
Can you please point me to the right direction?
Thanks!
Oriol.