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.

PCM5142 setup

Other Parts Discussed in Thread: PCM5142, CC3200

Hi,


I'm having a hell of a time getting a PCM5142 going. It's driving me insane!

My setup:


CC3200 Launchpad, pinmux configured the same as if there were an AUDBOOST booster pack connected. (i.e. Pin 63 = McASP0_AFSX, pin 53 McASP0_ACLK, pin 64 McASP0_AXR0, pin 50 McASP0_AXR1.)

AFSX -> pin 23 (LRCK)

ACLK -> pin 21 (BCK)

AXR0 -> pin 22 (DIN)

Configured in I2C control mode, both ADDR pins low.


I'm trying to get 3 wire i2s mode up and running, but have had no success with anything so far. I'm trying to figure out if it's on the DAC side or the MCU side.

My problem: I can't get anything out of it!

My current register settings

Page 0

w 0 0x04 0x01   // PLL Enable

w 0 0x0d 0x10 // BCK as ref for PLL

w 0 0x14 0x00 // p=1

w 0 0x15 0x30 // j = 48

w 0 0x16 0x00 // d =0

w 0 0x17 0x00 // d=0

w 0 0x18 0x01 // r = 2

w 0 0x1b 0x05 // ddsp = 6

w 0 0x1c 0x0f // ddac = 16

w 0 0x1d 0x03 // dncp = 4

w 0 0x1e 0x0f // dosr = 16

w 0 0x25 0x7d // disable all clock error, enable auto clock (also tried 0x7f, i.e. all errors disabled, auto clock disabled)

w 0 0x28 0x02 // 24 bit I2S (also tried 0x0, 0x3 for 16, 32 bit resp)

My clock output from the CC3200 on BCK is 1.024 MHz.

On the CC3200 I follow the example in swru367b section 12.3.3 . This sets up the I2S pins, starts the clock etc etc.

What happens is... nothing. I can read and write registers via I2C. PLL shows as locked. Register 5E shows everything as ok except SCK. Since the PLL is referencing BCK, does this matter? Register 5F similarly shows everything ok except SCK.

On the MCU side, the XDATA interrupt fires, the handler is called, data is (allegedly) written.

This happens twice then XUNDRN is asserted.

I don't currently have access to a scope to verify clock etc, but have thoroughly studied sprufm1 to verify that the data is output in the correct format and that the clock settings seem fine.


I've tried DMA mode, CPU mode, multiple clock settings, multiple word lengths, different pin settings (i.e. switching to AXR1). I've tried the CC3200 wifi_audio_app, suitably modified to write the registers relevant to the PCM5142. I've updated everything to the latest SDK version and service pack.

Please help! I'm out of ideas and losing my mind!

Thanks

  • I don't know if this is related, but I've been attempting to read through the example and compare the I2S setup in it to what is in the SWRU367B document. It doesn't appear that the example code multiplies the sample bit rate with 10 to get the fractional clock rate required by SCLK.

    wifi_audio_app example code

        MAP_PRCMI2SClockFreqSet(512000);   
        //512000 = 16*2*16000Khz(Num of bytes * STEREO * 16000 sampling)
        MAP_I2SConfigSetExpClk(I2S_BASE,512000,512000,I2S_SLOT_SIZE_16|
                                           I2S_PORT_DMA);

    Document SWRU367B example:

    (c) Set fractional clock divider to generate module input clock of BitRate * 10:
    PRCMI2SClockFreqSet(14112000)
    (d) Configure the internal divider of the module to generate the required bit clock frequency:
    I2SConfigSetExpClk(I2S_BASE, 14112000, 1411200, I2S_SLOT_SIZE_16|I2S_PORT_CPU).
    • The second parameter “I2S_SLOT_SIZE_16|I2S_PORT_CPU” sets the slot size and chooses
    the port interface on which the I2C module should expect the data.

    I'm personally working on another codec, and just trying to understand the setup.

  • Thanks, I already raised a question about that a while ago; The response was "both ways are fine". I'll step through I2SConfigSetExpClk to confirm, but looking at the code briefly it seems fine.

  • Yeah, I just noticed the divider part too. Looks like it's fine.

  • Success!!

    For future reference to anyone going nuts trying to get this up and running on a breadboard, make sure XSMT is not floating. I had ignored it completely. Tie it high and hear the wonderfull sine wave that you've been waiting for. Also, don't put any Report statements in your interrupt handler, it will more than likely cause an overrun.