2021-07-07 2:53 PM
Hello All, I am trying to get Full Duplex I2S working with a STM32H7 and a PCM3168A.
The STM has 2 SAI blocks (SAI1 A/B) (A in master mode and B in synchronous slave) for sending data to the PCM for the DAC part of the PCM. I use this to transmit 4 Mono signals. This works with double-buffered circular DMA.
I then have 2 SAI block (SAI4 A/B) both configured as synchronous slaves. both synchronized to SAI1. These should receive data from the ADC portion of the PCM. I want to setup a circular DMA transfer for this as well, to take data from the PCM and transfer continuously to a buffer.
I can start a DMA transfer with
status = HAL_SAI_Receive_DMA(&hsai_BlockA4, (uint8_t*)&adc0DMA, ADCDMABUFFERSIZE);
And status returns HAL_OK. But I only ever see 0's in the adc0DMA buffer. I can see I2S data on the incoming SD data line. I also have global interrupts enabled for the SAI, but the following generated handlers are never called when I set a breakpoint:
void BDMA_Channel0_IRQHandler(void)
{
/* USER CODE BEGIN BDMA_Channel0_IRQn 0 */
/* USER CODE END BDMA_Channel0_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_sai4_a);
/* USER CODE BEGIN BDMA_Channel0_IRQn 1 */
/* USER CODE END BDMA_Channel0_IRQn 1 */
}
/**
* @brief This function handles BDMA channel1 global interrupt.
*/
void BDMA_Channel1_IRQHandler(void)
{
/* USER CODE BEGIN BDMA_Channel1_IRQn 0 */
/* USER CODE END BDMA_Channel1_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_sai4_b);
/* USER CODE BEGIN BDMA_Channel1_IRQn 1 */
/* USER CODE END BDMA_Channel1_IRQn 1 */
}
/**
* @brief This function handles SAI4 global interrupt.
*/
void SAI4_IRQHandler(void)
{
/* USER CODE BEGIN SAI4_IRQn 0 */
/* USER CODE END SAI4_IRQn 0 */
HAL_SAI_IRQHandler(&hsai_BlockA4);
HAL_SAI_IRQHandler(&hsai_BlockB4);
/* USER CODE BEGIN SAI4_IRQn 1 */
/* USER CODE END SAI4_IRQn 1 */
}Am I missing an initial setup step that is not auto-generated? From what I understand SAI4 should be in sync to SAI1 with the frame signal. I know SAI1 is working and is generating signal on the PCM.
Connections:
Master-Clock, Bit-Clock, and Frame-Signal come from SAI1 and attach to the PCM (Both ADC and DAC sections as both are in "slave" mode on the PCM device).
SAI1_SD_A and SAI1_SD_B come from SAI1 and attach to the PCM.
SAI4_SD_A and SAI4_SD_B come from the PCM and attach to SAI4.
SAI1:
SAI4:
Any help or suggestions would be appreciated.
Thanks,
-Trevor
Solved! Go to Solution.
2021-07-12 7:03 AM
I found out my issue - I had not enabled "External Synchro Out" in the .ioc configuration on the master , (SAI1). After enabling that the slaves began to work.
I also ended up switching from SAI4 to SAI2 for the slave. Because only the BDMA was attached to SAI4 and that uses memory region D3.
2021-07-12 7:03 AM
I found out my issue - I had not enabled "External Synchro Out" in the .ioc configuration on the master , (SAI1). After enabling that the slaves began to work.
I also ended up switching from SAI4 to SAI2 for the slave. Because only the BDMA was attached to SAI4 and that uses memory region D3.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.