2018-05-22 11:48 PM
Hello.,.,
I used STM32F765BIT MCU SAI interface in slave mode to capture 4 channel audio inputs(TDM mode), I am using DMA (in Circular mode) to receive the audio data and it is working fine , But now I am upgrading to STM32H7BI MCU and I used the same procedure as earlier but I am not getting any DMA interrupts and data. I cross checked the signals from audio codec Frame clock, sampling clock, & data in are coming proper. I am suspecting the driver issue either in DMA or SAI interface , Can anyone just look into this and suggest any changes required.
SAI interface Init function:-
hsai_BlockA2.Instance = SAI2_Block_A;
hsai_BlockA2.Init.Protocol = SAI_FREE_PROTOCOL; hsai_BlockA2.Init.AudioMode = SAI_MODESLAVE_RX; hsai_BlockA2.Init.DataSize = SAI_DATASIZE_16; hsai_BlockA2.Init.FirstBit = SAI_FIRSTBIT_MSB; hsai_BlockA2.Init.ClockStrobing = SAI_CLOCKSTROBING_FALLINGEDGE; hsai_BlockA2.Init.Synchro = SAI_ASYNCHRONOUS; hsai_BlockA2.Init.OutputDrive = SAI_OUTPUTDRIVE_DISABLE; hsai_BlockA2.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_HF; hsai_BlockA2.Init.SynchroExt = SAI_SYNCEXT_DISABLE; hsai_BlockA2.Init.MonoStereoMode = SAI_STEREOMODE; hsai_BlockA2.Init.CompandingMode = SAI_NOCOMPANDING; hsai_BlockA2.Init.TriState = SAI_OUTPUT_NOTRELEASED; hsai_BlockA2.Init.PdmInit.Activation = DISABLE; hsai_BlockA2.Init.PdmInit.MicPairsNbr = 0; hsai_BlockA2.Init.PdmInit.ClockEnable = SAI_PDM_CLOCK1_ENABLE; hsai_BlockA2.FrameInit.FrameLength = 64; hsai_BlockA2.FrameInit.ActiveFrameLength = 1; hsai_BlockA2.FrameInit.FSDefinition = SAI_FS_STARTFRAME; hsai_BlockA2.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW; hsai_BlockA2.FrameInit.FSOffset = SAI_FS_FIRSTBIT; hsai_BlockA2.SlotInit.FirstBitOffset = 0; hsai_BlockA2.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE; hsai_BlockA2.SlotInit.SlotNumber = 4; hsai_BlockA2.SlotInit.SlotActive = 0x0000000F; if (HAL_SAI_Init(&hsai_BlockA2) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }hsai_BlockB2.Instance = SAI2_Block_B;
hsai_BlockB2.Init.Protocol = SAI_FREE_PROTOCOL; hsai_BlockB2.Init.AudioMode = SAI_MODESLAVE_TX; hsai_BlockB2.Init.DataSize = SAI_DATASIZE_16; hsai_BlockB2.Init.FirstBit = SAI_FIRSTBIT_MSB; hsai_BlockB2.Init.ClockStrobing = SAI_CLOCKSTROBING_FALLINGEDGE; hsai_BlockB2.Init.Synchro = SAI_SYNCHRONOUS; hsai_BlockB2.Init.OutputDrive = SAI_OUTPUTDRIVE_DISABLE; hsai_BlockB2.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_HF; hsai_BlockB2.Init.SynchroExt = SAI_SYNCEXT_DISABLE; hsai_BlockB2.Init.MonoStereoMode = SAI_STEREOMODE; hsai_BlockB2.Init.CompandingMode = SAI_NOCOMPANDING; hsai_BlockB2.Init.TriState = SAI_OUTPUT_NOTRELEASED; hsai_BlockB2.Init.PdmInit.Activation = DISABLE; hsai_BlockB2.Init.PdmInit.MicPairsNbr = 0; hsai_BlockB2.Init.PdmInit.ClockEnable = SAI_PDM_CLOCK1_ENABLE; hsai_BlockB2.FrameInit.FrameLength = 64; hsai_BlockB2.FrameInit.ActiveFrameLength = 1; hsai_BlockB2.FrameInit.FSDefinition = SAI_FS_STARTFRAME; hsai_BlockB2.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW; hsai_BlockB2.FrameInit.FSOffset = SAI_FS_FIRSTBIT; hsai_BlockB2.SlotInit.FirstBitOffset = 0; hsai_BlockB2.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE; hsai_BlockB2.SlotInit.SlotNumber = 4; hsai_BlockB2.SlotInit.SlotActive = 0x0000000F; if (HAL_SAI_Init(&hsai_BlockB2) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }#stm32h7 #sai-audio-record #i2s