Post Go back to editing

Any advice on reading the AD7779 DOUT0 using an STM32 SAI input?


I'm trying to read samples from all eight channels of an AD7779. I've got the SPI control interface up and running with very few problems but I need to route the analogue samples through the digital serial interface into an SAI input on an STM32F746-family ARM. I can see the DCLK, DRDY and DOUT0 are being driven but the processor doesn't seem to register the data arrival.

There's very little support from ST unless you want to use the SAI in a pure audio capacity, but I need to use the interface in "freeform" mode.

I'd appreciate any advice - good or bad!

Thanks in advance,


  • Hi Dave,

    Where you able to read the register map through SPI, in SPI control mode? If so, note the SPI interface can also be used for clocking out the ADC data.

    Note that for reading the ADC data from the DOUT interface, the difference is that the AD7779 acts as the master, and clocks out the data. I wouldn't have any oarticular advice for STM32F746 as haven't used them together, but you can check the No-OS drivers on the web just in case they are of any help.

    AD7779 - No-OS Driver [Analog Devices Wiki] 



  • Thanks for the response Lluis,

    Unfortunately, I need to use the DOUT interface as the SPI would be too slow, plus my target hardware designer wants to use the DOUT interface so I'm being pushed that way by system design (doesn't mean to say that we won't end up using the SPI!).

    On the SPI side of things, I've got everything I need already running but thanks for the link.

    Do you have any experience interfacing any type of ARM device to the DOUT interface? ARMs tend to have lots of commonality so there could be a clue elsewhere - a trawl of the web doesn't give me any real help.

    Thanks in advance,


  • Hi Dave,

    Apologies for the late reply, glad to hear you are sorted on the SPI. When using DOUT, unlike, the AD7779 acts as the master instead. Unfortunately I don't have experience myself interfacing it through the STM32, as we use for the Evaluation Board our SDP-H1 boards. Have you used the evaluation board? Checking how the interface work on that one  may be of help for you?



  • This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin
  • Hi,
    anything new? How to setup MCU (ideally STM32) for DOUT rx of data?

    my basic SAI config for STM32 is like that, but there is probably something wrong (I want to read 8 channels on 1 line DOUT_0)

    hsai_BlockB3.Instance = SAI3_Block_B;
    hsai_BlockB3.Init.Protocol = SAI_FREE_PROTOCOL;
    hsai_BlockB3.Init.AudioMode = SAI_MODESLAVE_RX;
    hsai_BlockB3.Init.DataSize = SAI_DATASIZE_8;
    hsai_BlockB3.Init.FirstBit = SAI_FIRSTBIT_MSB;
    hsai_BlockB3.Init.ClockStrobing = SAI_CLOCKSTROBING_FALLINGEDGE;
    hsai_BlockB3.Init.Synchro = SAI_ASYNCHRONOUS;
    hsai_BlockB3.Init.OutputDrive = SAI_OUTPUTDRIVE_DISABLE;
    hsai_BlockB3.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_EMPTY;
    hsai_BlockB3.Init.SynchroExt = SAI_SYNCEXT_DISABLE;
    hsai_BlockB3.Init.MonoStereoMode = SAI_STEREOMODE;
    hsai_BlockB3.Init.CompandingMode = SAI_NOCOMPANDING;
    hsai_BlockB3.Init.TriState = SAI_OUTPUT_NOTRELEASED;
    hsai_BlockB3.Init.PdmInit.Activation = DISABLE;
    hsai_BlockB3.Init.PdmInit.MicPairsNbr = 1;
    hsai_BlockB3.Init.PdmInit.ClockEnable = SAI_PDM_CLOCK1_ENABLE;
    hsai_BlockB3.FrameInit.FrameLength = 256;
    hsai_BlockB3.FrameInit.ActiveFrameLength = 1;
    hsai_BlockB3.FrameInit.FSDefinition = SAI_FS_STARTFRAME;
    hsai_BlockB3.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW;
    hsai_BlockB3.FrameInit.FSOffset = SAI_FS_FIRSTBIT;
    hsai_BlockB3.SlotInit.FirstBitOffset = 0;
    hsai_BlockB3.SlotInit.SlotSize = SAI_SLOTSIZE_32B;
    hsai_BlockB3.SlotInit.SlotNumber = 1;
    hsai_BlockB3.SlotInit.SlotActive = 0x00000000;

    Thank you


    The total frame size you require for all the 8 channels' data to appear on a single DOUTx is 256, which would be 32 slots of 8 bit data ( Or 8 slots of a 32 bit data). Here you have configured the hsai_BlockB3.Init.DataSize as 8 bitYou may have to update the number of slots accordingly, which is 32.

    Could you try configuring the hsai_BlockB3.SlotInit.SlotNumber = 32? 

  • Thank you for reply. I tried to change hsai_BlockB3.SlotInit.SlotNumber = 32 but still the same problem - can not read any data from STM32.

    But I found out that if I change   hsai_BlockB3.SlotInit.SlotActive = 1; then something is recieved, but in STM32 is written this: 

    What does it mean? I want to have 8 channels on DOUT_1 line - so there is 32 slots? Or this all this "pack" is taken as 1 slot?

    What else could be wrong:

    - hsai_BlockB3.Init.DataSize = SAI_DATASIZE_8 - but you said 8 - so I take it as the

    correct value

    hsai_BlockB3.FrameInit.FrameLength = 256; - it sounds good for me when I want to read 8 channels (1 channel have 1 B header and 3 B for ADC data) 4x8x8 = 256 bits

    hsai_BlockB3.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE; Not sure about it, from STM32 datasheet:  

    Thank you very much for any help. Jan.