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,


Parents Reply Children
  • 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.