cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_SAI_Transmit_DMA buffer size?

Jeremy Vance_2
Associate III
Posted on November 07, 2017 at 20:25

So, I have 5 TDM data slots being used in my SAI1 master TX using circular DMA.  I have a buffer that is 10240 bytes in size (5*1024*2).  So, to start the TDM signal, I call: 

HAL_SAI_Transmit_DMA(&hsai_BlockA1, &DMABuffer[0], DMA_BUFFER_SIZE);

Where:

&sharpdefine DMA_BUFFER_SIZE (NUMBER_OF_CHANNELS * CHANNEL_BUFFER_SIZE * 2)

static uint8_t DMABuffer[DMA_BUFFER_SIZE];

memset(&DMABuffer[0], 0, DMA_BUFFER_SIZE); //clear out DMA Buffer

In my head I would assume that the circular DMA would loop through the DMABuffer data while triggering half and complete interrupts (which do trigger).  However, when I capture the data going out the data line, I see the attached plot.  I should see all zero's but there is enormous amounts with a little downtime (about 20%).  If I change the above line to 

HAL_SAI_Transmit_DMA(&hsai_BlockA1, &DMABuffer[0], DMA_BUFFER_SIZE / 5);

I do see the expected all zeros.

So, what am I missing?  Is the size parameter in HAL_SAI_Transmit_DMA supposed to be the buffer size or the buffer size divided by the number of active data slots?

Thanks,

Jeremy

#sai-hal_sai_transmit_dma #stm32f7-hal
1 REPLY 1
Posted on November 07, 2017 at 20:52

 (about 20%).

It's more like 25%. Bytes vs. words, in DMA?

JW