2025-10-02 3:42 PM
HI
I am having an issue with starting measurements using the on-board microphone. Everything has been configured based on the BSP code, but set up from scratch using CubeMX. The problem is that when I start the DMA Receive
if (HAL_SAI_Receive_DMA(&hsai_BlockA4, (uint8_t*)PDM_Buffer, PDM_BUF_SIZE) != HAL_OK)
{
printf("SAI RX start error!\r\n");
}
else
{
printf("SAI RX started OK");
}
//callbacks:
void HAL_SAI_RxHalfCpltCallback(SAI_HandleTypeDef *hsai)
{
printf("HAL_SAI_RxHalfCpltCallback\n");
}
void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai)
{
printf("HAL_SAI_RxCpltCallback\n");
}
void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai)
{
printf("SAI error: 0x%08lx\n", hsai->ErrorCode);
}
I immediately get an interrupt reporting a DMA error (128 eror code in decimal).
I have already tried changing the clock frequencies, tried running it on a different core, and also tested with different data sizes, but none of this helped.
My config below: