Post Go back to editing

migrating from AD1836 to AD1939 with BF533


I am working on an audio application with BF533. Our initial design used the AD1836 audio codec, which worked well. We were advised to switch to AD1939, and are having some problems.

First off, the SPI control words are 24-bit, instead of 16. BF533 only supports 8- and 16-bit transfers, so I followed the workaround advised here: (setting CPHA positive and toggling slave-select by writing to SPI_FLG).

The SPI data looks ok on the analyzer, except that the clock state is high when idling - it seems impossible to change this while using the workaround above.

My goal is to get the same behavior as the old codec, using 4 channels of audio I/O in I2S mode connected with SPORT0 on the BF533. So I'm leaving all the AD1939's control registers at default, except for setting the MSB of the PLL_CONTROL_0 to enable DACs and ADCs. But I am a little unclear on the implications of all the control register settings.

Should I be setting something differently on the codec?

Should I rewire the board to use the codec in "standalone" mode?

Is there a better place for me to post questions about the codec specifically?

Is there an appnote or example code for this new codec?

I'm writing in C using the bfin-elf-gcc toolchain, and following the basic template from the I2S talkthrough example for the BF533 EZ-KIT.

Attached is a code fragment with the codec initialization and SPI write functions.

Any tips would be much appreciated. Many thanks for your time!

Ezra Buchla
  • Hi Ezra,

    If you are using the part in default state, you would be well served to get your system running with the AD1938 in standalone mode.  Standalone mode for the AD1939 enables both the ADC and DAC ports into I2S, 256xFs, and both ports are set into Slave mode. Once you have your audio path working, confirming the proper operation of the BF533. If you need to make changes to the settings in the AD1939, you will be able to move forward with the programming of the AD1939 with the confidence that the BF533 audio ports are functioning correctly.

    Best regards,


  • thank you!

    OK this is foolish of me but i did not realize that that ADCs on the 1939 are in Slave mode by default. I assume this means they expect inputs for bit clock and L/R clock? On the 1836 these are outputs by default. So i do have to change those register settings to use the same configuration as the bf533 i2s talkthrough example (processing is triggered on sport0 rx interrupt) ... right?

    Thanks again!


  • Hi Ezra,

    The other option would be to set the AD1939 into Master stand alone mode, by tying the COUT pin high. In this condition, the ADC clock ports are in master mode and the ALRCLK and ABCLK pins will become outputs.

    Best regards,


  • thanks! this works perfectly.

    just for the record, i was not able to get it working by setting the control registers appropriately, and i still wonder if this is due to the wrongness of the clock waveform using the 24-bit SPI workaround, or to something else.

    in any case we are happy to be using a simpler circuit!



  • Excellent, I am glad that it's working! Please let me know if you have any other questions.

  • Modified your code, and got it work . 

    Command 9 is read, and 8 is write.  Please change command 9 to 8, and have a try.

    Another thing is the our CS signal is connected to PF0, we have to use it as GPIO.

    Good luck..