Skip to content

Commit 3924642

Browse files
committed
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 <mariopaja@hotmail.com>
1 parent 0d794df commit 3924642

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
@@ -286,9 +286,11 @@ static int i2s_stm32_sai_dma_init(const struct device *dev)
286286
#if defined(CONFIG_SOC_SERIES_STM32H7X)
287287
hdma->Instance = __LL_DMA_GET_STREAM_INSTANCE(stream->reg, stream->dma_channel);
288288
hdma->Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
289-
hdma->Init.MemDataAlignment = DMA_PDATAALIGN_HALFWORD;
289+
hdma->Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
290290
hdma->Init.Priority = DMA_PRIORITY_HIGH;
291291
hdma->Init.FIFOMode = DMA_FIFOMODE_DISABLE;
292+
hdma->Init.PeriphInc = DMA_PINC_DISABLE;
293+
hdma->Init.MemInc = DMA_MINC_ENABLE;
292294
#else
293295
hdma->Instance = LL_DMA_GET_CHANNEL_INSTANCE(stream->reg, stream->dma_channel);
294296
hdma->Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
@@ -307,10 +309,7 @@ static int i2s_stm32_sai_dma_init(const struct device *dev)
307309
if (stream->dma_cfg.channel_direction == (enum dma_channel_direction)MEMORY_TO_PERIPHERAL) {
308310
hdma->Init.Direction = DMA_MEMORY_TO_PERIPH;
309311

310-
#if defined(CONFIG_SOC_SERIES_STM32H7X)
311-
hdma->Init.PeriphInc = DMA_PINC_DISABLE;
312-
hdma->Init.MemInc = DMA_MINC_ENABLE;
313-
#else
312+
#if !defined(CONFIG_SOC_SERIES_STM32H7X)
314313
hdma->Init.SrcInc = DMA_SINC_INCREMENTED;
315314
hdma->Init.DestInc = DMA_DINC_FIXED;
316315
#endif
@@ -319,10 +318,7 @@ static int i2s_stm32_sai_dma_init(const struct device *dev)
319318
} else {
320319
hdma->Init.Direction = DMA_PERIPH_TO_MEMORY;
321320

322-
#if defined(CONFIG_SOC_SERIES_STM32H7X)
323-
hdma->Init.PeriphInc = DMA_PINC_ENABLE;
324-
hdma->Init.MemInc = DMA_MINC_DISABLE;
325-
#else
321+
#if !defined(CONFIG_SOC_SERIES_STM32H7X)
326322
hdma->Init.SrcInc = DMA_SINC_FIXED;
327323
hdma->Init.DestInc = DMA_DINC_INCREMENTED;
328324
#endif

0 commit comments

Comments
 (0)