2019-09-18 06:20 AM
Hi,
I am using stm32h753, in my design. I am using SAI Peripheral for audio(TAS2770 Ic) with internal synchronization method. In receiving mode ,my configuration of slot is slot 0 | slot1.
In transmitting mode, configuration of slot is SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_2 |SAI_SLOTACTIVE_3.
While receiving data, i got multiple datas in that array using HAL_SAI_Receive_DMA library function. i am expecting the current and voltage value from audio device. but how to separate the voltage and current value??
SAI 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;//26
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|SAI_SLOTACTIVE_3);
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.FIFOThreshold = SAI_FIFOTHRESHOLD_EMPTY;
hsai_BlockB1.Init.DataSize = SAI_DATASIZE_8;
hsai_BlockB1.Init.FirstBit = SAI_FIRSTBIT_MSB;
hsai_BlockB1.Init.ClockStrobing = SAI_CLOCKSTROBING_FALLINGEDGE;
hsai_BlockB1.Init.CompandingMode = SAI_NOCOMPANDING;
hsai_BlockB1.FrameInit.FrameLength = 32;
hsai_BlockB1.FrameInit.ActiveFrameLength = 8;
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 = 4;
hsai_BlockB1.SlotInit.SlotActive = SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_1;
if (HAL_SAI_Init(&hsai_BlockB1) != HAL_OK)
{
// Error_Handler();
}
Thanks.,
vel