Loading...
 
Skip to main content

System Workbench for STM32


SPDIF Example for STM32F7?

Thanks a lot, tjaekel!

I found your example as a great starting point for spdif applications. For my project, I'm trying to use IT + DMA to have full background processing. The application is working but I can hear small clicks in both channels appearing randomly on top of the sound coming from the RCA connection.

The main changes I made:

void SPDIF_RX_IRQHandler(void)
{
HAL_SPDIFRX_IRQHandler(&hspdif);

/* this has a side effect: if USB audio - this corrupts the sound ! */
if (HAL_SPDIFRX_ReceiveDataFlow_IT(&hspdif, SPDIFIN0_RxBuf, SPDIF_SAMPLE_NUM) == HAL_OK)
{}
}

void SPDIFRX_Start_IT(void)
{
if (HAL_SPDIFRX_ReceiveDataFlow_IT(&hspdif, SPDIFIN0_RxBuf, SPDIF_SAMPLE_NUM) == HAL_OK)
{
BSP_AUDIO_OUT_Play((uint16_t *)SPDIFIN0_RxBuf, (SPDIF_SAMPLE_NUM - 192) * 4);
}
}

So I was curious, did you run into similar issues before? USB audio is not initialized, btw.

I would be very thankful if you could point me out in the right direction or share some more code! 😊