cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure the internal synchronization in SAI peripherals ??

Vel
Associate III

Hi,

I am using stm32h753 IC, in my design. I want to know, how to configure the SAI internal synchronization. If any example program is there in same..

Here i am mentioned the configuration:-

   hsai_BlockA1.Instance            =      SAI1_Block_A;

   hsai_BlockA1.Init.Protocol         =      SAI_FREE_PROTOCOL;

   hsai_BlockA1.Init.MckOutput         =      SAI_MCK_OUTPUT_DISABLE;

   hsai_BlockA1.Init.AudioMode      =      SAI_MODEMASTER_TX;

   hsai_BlockA1.Init.Synchro         =      SAI_ASYNCHRONOUS;

   hsai_BlockA1.Init.MonoStereoMode   =      SAI_MONOMODE;

   hsai_BlockA1.Init.OutputDrive      =      SAI_OUTPUTDRIVE_DISABLE;

   hsai_BlockA1.Init.NoDivider      =      SAI_MASTERDIVIDER_DISABLE;

   hsai_BlockA1.Init.MckOverSampling   =      SAI_MCK_OVERSAMPLING_ENABLE;

   hsai_BlockA1.Init.Mckdiv         =      13;

   hsai_BlockA1.Init.FIFOThreshold   =      SAI_FIFOTHRESHOLD_FULL;

   hsai_BlockA1.Init.AudioFrequency   =      SAI_AUDIO_FREQUENCY_96K;

   hsai_BlockA1.Init.DataSize         =      SAI_DATASIZE_16;

   hsai_BlockA1.Init.FirstBit         =      SAI_FIRSTBIT_MSB;

   hsai_BlockA1.Init.ClockStrobing   =      SAI_CLOCKSTROBING_RISINGEDGE;

   hsai_BlockA1.Init.CompandingMode   =      SAI_NOCOMPANDING;

   hsai_BlockA1.FrameInit.FrameLength         =   32;

   hsai_BlockA1.FrameInit.ActiveFrameLength   =   16;

   hsai_BlockA1.FrameInit.FSDefinition      =   SAI_FS_STARTFRAME;

   hsai_BlockA1.FrameInit.FSPolarity         =   SAI_FS_ACTIVE_LOW;

   hsai_BlockA1.FrameInit.FSOffset         =   SAI_FS_FIRSTBIT;

   hsai_BlockA1.SlotInit.FirstBitOffset      =   1;

   hsai_BlockA1.SlotInit.SlotSize            =   SAI_SLOTSIZE_DATASIZE;

   hsai_BlockA1.SlotInit.SlotNumber         =   4;

   hsai_BlockA1.SlotInit.SlotActive         =   (SAI_SLOTACTIVE_0|SAI_SLOTACTIVE_2);

   if (HAL_SAI_Init(&hsai_BlockA1) != HAL_OK)

      {

   //      Error_Handler();

      }

   hsai_BlockB1.Instance            =      SAI1_Block_B;

   hsai_BlockB1.Init.Protocol         =      SAI_FREE_PROTOCOL;

   hsai_BlockB1.Init.MckOutput         =      SAI_MCK_OUTPUT_DISABLE;

   hsai_BlockB1.Init.AudioMode      =      SAI_MODESLAVE_RX;

   hsai_BlockB1.Init.Synchro         =      SAI_SYNCHRONOUS;

   hsai_BlockB1.Init.MonoStereoMode   =      SAI_MONOMODE;

   hsai_BlockB1.Init.OutputDrive      =      SAI_OUTPUTDRIVE_DISABLE;

   hsai_BlockB1.Init.NoDivider      =      SAI_MASTERDIVIDER_DISABLE;

   hsai_BlockB1.Init.MckOverSampling   =      SAI_MCK_OVERSAMPLING_ENABLE;

   hsai_BlockB1.Init.Mckdiv         =      13;

   hsai_BlockB1.Init.FIFOThreshold   =      SAI_FIFOTHRESHOLD_FULL;

   hsai_BlockB1.Init.AudioFrequency   =      SAI_AUDIO_FREQUENCY_96K;

   hsai_BlockB1.Init.DataSize         =      SAI_DATASIZE_16;

   hsai_BlockB1.Init.FirstBit         =      SAI_FIRSTBIT_MSB;

   hsai_BlockB1.Init.ClockStrobing   =      SAI_CLOCKSTROBING_RISINGEDGE;

   hsai_BlockB1.Init.CompandingMode   =      SAI_NOCOMPANDING;

   hsai_BlockB1.FrameInit.FrameLength         =   32;

   hsai_BlockB1.FrameInit.ActiveFrameLength   =   16;

   hsai_BlockB1.FrameInit.FSDefinition      =   SAI_FS_STARTFRAME;

   hsai_BlockB1.FrameInit.FSPolarity         =   SAI_FS_ACTIVE_LOW;

   hsai_BlockB1.FrameInit.FSOffset         =   SAI_FS_FIRSTBIT;

   hsai_BlockB1.SlotInit.FirstBitOffset      =   1;

   hsai_BlockB1.SlotInit.SlotSize            =   SAI_SLOTSIZE_DATASIZE;

   hsai_BlockB1.SlotInit.SlotNumber         =   1;

   hsai_BlockB1.SlotInit.SlotActive         =   SAI_SLOTACTIVE_0;

   if (HAL_SAI_Init(&hsai_BlockB1) != HAL_OK)

   {

//      Error_Handler();

   }

0 REPLIES 0