From 33cb179b4f2e5bf6fdefccc38dc1cf57ff76e8d6 Mon Sep 17 00:00:00 2001 From: Brett Witherspoon Date: Mon, 26 Jun 2023 22:20:19 -0400 Subject: [PATCH] drivers: dma: stm32u5: set data length in bytes The block data length field should be in bytes. Setting this to a value that is not a multiple of the data size results in a user setting error. Running the ADC DMA test prior to this commit: west build -p -b nucleo_u575zi_q zephyr/tests/drivers/adc/adc_dma E: Transfer Error. I: tc: 0, ht: 0, dte: 0, ule: 0, use: 1 E: DMA sampling complete, but DMA reported error -5 Existing tests using DMA on the nucleo_u575zi_q were not effected because they only use a data size of one and continue to function as expected: west build -p -b nucleo_u575zi_q zephyr/tests/drivers/spi/spi_loopback \ -DOVERLAY_CONFIG="overlay-stm32-spi-dma.conf" SUITE PASS - 100.00% [spi_loopback]: pass = 1, fail = 0, ... west build -p -b nucleo_u575zi_q zephyr/tests/drivers/dma/loop_transfer SUITE PASS - 100.00% [dma_m2m_loop]: pass = 3, fail = 0, ... Signed-off-by: Brett Witherspoon --- drivers/dma/dma_stm32u5.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/dma/dma_stm32u5.c b/drivers/dma/dma_stm32u5.c index 253a154e09a..88ab979df62 100644 --- a/drivers/dma/dma_stm32u5.c +++ b/drivers/dma/dma_stm32u5.c @@ -494,13 +494,7 @@ static int dma_stm32_configure(const struct device *dev, index = find_lsb_set(config->dest_data_size) - 1; DMA_InitStruct.DestDataWidth = table_dst_size[index]; - if (stream->source_periph) { - DMA_InitStruct.BlkDataLength = config->head_block->block_size / - config->source_data_size; - } else { - DMA_InitStruct.BlkDataLength = config->head_block->block_size / - config->dest_data_size; - } + DMA_InitStruct.BlkDataLength = config->head_block->block_size; /* The request ID is stored in the dma_slot */ DMA_InitStruct.Request = config->dma_slot;