Setup SAI - read adc values from AD7771 via DOUTx interface lines
Hi,
I have STM32H743Z and ADC converter AD7771. I want to use SAI interface for reading data from it. I have configured AD7771, that results form conversions are sent over DOUT_0 line. In oscilloscope I can see line DRDY (falling edge), line DOUT0 sends some data (do not have SAI decoder) and CLK for clock. I connected ADC like that: SAI3_FS->DRDY, SAI3_SD->DOUT0, SAI3_SCK to DCLK.
output data should be in this format (I use 8 ADC channels)
I configured SAI like that:
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;Problem is that if I call HAL_SAI_Receive(&hsai_BlockB3, Buffer, 4, 0xffffff); so nothing is recieved.
What I missed? Where could be a problem?
Thank you very much, Jan.