cancel
Showing results for 
Search instead for 
Did you mean: 

SAI_DMA_ERROR while using Receive_IT()

TBaue.1
Associate

Dear Community,

i'm working on an 4 Slot SAI Interface with an STM32G4 Series MCU.

The FrameSync signal is kind of slow (~2kHz) so i want to use the Receive_IT() to throw an interrupt when 4 Slots (32Bit each) has received.

So after starting the ADC Hardware, i'm calling

HAL_SAI_Receive_IT(&hsai_BlockA1, (uint8_t*)sai_buf, 4);

To start the SAI Receiver.

In the HAL_SAI_RxCpltCallback() Function, i'm currently just looking to the received data and then start the Receive_IT again (sai_buf is defined as extern in header):

void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai)
{
	uint32_t ch0_sample = sai_buf[0] & 0x00ffffff;
	uint32_t ch1_sample = sai_buf[1] & 0x00ffffff;
	uint32_t ch2_sample = sai_buf[2] & 0x00ffffff;
 
 
	HAL_SAI_Receive_IT(hsai, (uint8_t*)sai_buf, 4);
}

Now to the issue that i'm facing (for like 4h now without now clue what's wrong).

When placing a breakpoint in the Callback to check the Data, it works just fine and data seems to be valid. I can just click run and it stops immediately in the next Callback with new data.

However, when I remove the Breakpoint and click run, the

void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai)

gets called immediately. When looking in the hsai handler, the SAI_DMA_ERROR code is set. That makes no sense to me since i'm not using the DMA in any way.

What am I missing here?

Thank you for your suggestions,

kind regards and have a good time!

Tony

EDIT: the sai_buf is defined as

uint32_t sai_buf[4];

0 REPLIES 0