Skip to content

Commit 5af3adf

Browse files
mariopajakartben
authored andcommitted
drivers: i2s: stm32_sai: fix h7xx DMA configuration
This change fixes STM32H7xx dma configuration. PeriphInc and MemInc should be the same for both directions. MemDataAlignment should be set to DMA_MDATAALIGN_HALFWORD Signed-off-by: Mario Paja <[email protected]>
1 parent 12a8eaf commit 5af3adf

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/i2s/i2s_stm32_sai.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,11 @@ static int i2s_stm32_sai_dma_init(const struct device *dev)
289289
#if defined(CONFIG_SOC_SERIES_STM32H7X)
290290
hdma->Instance = __LL_DMA_GET_STREAM_INSTANCE(stream->reg, stream->dma_channel);
291291
hdma->Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
292-
hdma->Init.MemDataAlignment = DMA_PDATAALIGN_HALFWORD;
292+
hdma->Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
293293
hdma->Init.Priority = DMA_PRIORITY_HIGH;
294294
hdma->Init.FIFOMode = DMA_FIFOMODE_DISABLE;
295+
hdma->Init.PeriphInc = DMA_PINC_DISABLE;
296+
hdma->Init.MemInc = DMA_MINC_ENABLE;
295297
#else
296298
hdma->Instance = LL_DMA_GET_CHANNEL_INSTANCE(stream->reg, stream->dma_channel);
297299
hdma->Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
@@ -310,10 +312,7 @@ static int i2s_stm32_sai_dma_init(const struct device *dev)
310312
if (stream->dma_cfg.channel_direction == (enum dma_channel_direction)MEMORY_TO_PERIPHERAL) {
311313
hdma->Init.Direction = DMA_MEMORY_TO_PERIPH;
312314

313-
#if defined(CONFIG_SOC_SERIES_STM32H7X)
314-
hdma->Init.PeriphInc = DMA_PINC_DISABLE;
315-
hdma->Init.MemInc = DMA_MINC_ENABLE;
316-
#else
315+
#if !defined(CONFIG_SOC_SERIES_STM32H7X)
317316
hdma->Init.SrcInc = DMA_SINC_INCREMENTED;
318317
hdma->Init.DestInc = DMA_DINC_FIXED;
319318
#endif
@@ -322,10 +321,7 @@ static int i2s_stm32_sai_dma_init(const struct device *dev)
322321
} else {
323322
hdma->Init.Direction = DMA_PERIPH_TO_MEMORY;
324323

325-
#if defined(CONFIG_SOC_SERIES_STM32H7X)
326-
hdma->Init.PeriphInc = DMA_PINC_ENABLE;
327-
hdma->Init.MemInc = DMA_MINC_DISABLE;
328-
#else
324+
#if !defined(CONFIG_SOC_SERIES_STM32H7X)
329325
hdma->Init.SrcInc = DMA_SINC_FIXED;
330326
hdma->Init.DestInc = DMA_DINC_INCREMENTED;
331327
#endif

0 commit comments

Comments
 (0)