This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new fc1ae9b7bec imxrt/lpspi: Fix correct LPSPI DMA transfer size for 16-bit
fc1ae9b7bec is described below
commit fc1ae9b7becd31b4e966aee2e7ebfc263e942701
Author: Atsunori Saito <[email protected]>
AuthorDate: Tue Feb 17 14:10:32 2026 +0900
imxrt/lpspi: Fix correct LPSPI DMA transfer size for 16-bit
- Fix byte count calculation for 16-bit SPI words
using shift-by-1 instead of shift-by-2
- Use word count instead of byte count for DMA
iteration config on both RX and TX channels
Signed-off-by: Atsunori Saito <[email protected]>
---
arch/arm/src/imxrt/imxrt_lpspi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/src/imxrt/imxrt_lpspi.c b/arch/arm/src/imxrt/imxrt_lpspi.c
index d90b7757f22..9d0617ded62 100644
--- a/arch/arm/src/imxrt/imxrt_lpspi.c
+++ b/arch/arm/src/imxrt/imxrt_lpspi.c
@@ -1475,7 +1475,7 @@ static void imxrt_lpspi_exchange(struct spi_dev_s *dev,
/* Convert the number of word to a number of bytes */
- nbytes = (priv->nbits > 8) ? nwords << 2 : nwords;
+ nbytes = (priv->nbits > 8) ? nwords << 1 : nwords;
/* Invalid DMA channels fall back to non-DMA method. */
@@ -1526,7 +1526,7 @@ static void imxrt_lpspi_exchange(struct spi_dev_s *dev,
config.daddr = (uint32_t) (rxbuffer ? rxbuffer : rxdummy);
config.soff = 0;
config.doff = rxbuffer ? adjust : 0;
- config.iter = nbytes;
+ config.iter = nwords;
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
@@ -1540,7 +1540,7 @@ static void imxrt_lpspi_exchange(struct spi_dev_s *dev,
config.daddr = priv->spibase + IMXRT_LPSPI_TDR_OFFSET;
config.soff = txbuffer ? adjust : 0;
config.doff = 0;
- config.iter = nbytes;
+ config.iter = nwords;
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;