Skip to content

Commit

Permalink
drivers: spi: fix 16 bit spi dma transfers for the STM32 driver
Browse files Browse the repository at this point in the history
Calculate the correct dma segment length for STM32 16 bit spi dma transfers
Fixes zephyrproject-rtos#52563

Signed-off-by: Rami Saad <[email protected]>
  • Loading branch information
rmsaad authored and carlescufi committed Jan 20, 2023
1 parent fdae56d commit 1d86819
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/spi/spi_ll_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ static int spi_dma_move_buffers(const struct device *dev, size_t len)
int ret;
size_t dma_segment_len;

dma_segment_len = len / data->dma_rx.dma_cfg.dest_data_size;
dma_segment_len = len * data->dma_rx.dma_cfg.dest_data_size;
ret = spi_stm32_dma_rx_load(dev, data->ctx.rx_buf, dma_segment_len);

if (ret != 0) {
return ret;
}

dma_segment_len = len / data->dma_tx.dma_cfg.source_data_size;
dma_segment_len = len * data->dma_tx.dma_cfg.source_data_size;
ret = spi_stm32_dma_tx_load(dev, data->ctx.tx_buf, dma_segment_len);

return ret;
Expand Down

0 comments on commit 1d86819

Please sign in to comment.