nuttx/arch
Jinji Cui 8302295dd0 arch/arm/src/stm32/stm32_spi: chunk DMA exchanges to honor 16-bit NDTR
The STM32 DMA NDTR/CNDTR transfer-count register is 16 bits wide on
every STM32 series the in-tree driver supports (IPv1 CNDTR, IPv2
SxNDTR).  spi_exchange()'s DMA path forwarded the caller's full
nwords to stm32_dmasetup(), so a single SPI_EXCHANGE() of >= 65536
words silently programmed NDTR to (nwords & 0xffff).  When the
truncated count was zero - the typical case for an exact 64 KiB
transfer (flash erase block, FAT cluster, common DMA staging
buffer) - the stream completed instantly with no transfer-complete
interrupt and the caller deadlocked in spi_dmarxwait().

Walk the request in chunks of at most 65535 words inside the
existing DMA branch, reusing the same spi_dma{rx,tx}{setup,start,
wait}() sequence per chunk.  Single-descriptor transfers (every
in-tree caller today) are byte-for-byte identical.  CONFIG_SPI_TRIGGER
is honored for the first chunk only; subsequent chunks must run
unconditionally because re-arming between chunks of one logical
exchange was never part of the SPI_TRIGGER contract.

Drive-by: rescale priv->buflen-clamped nwords so the DMA
descriptor matches the actually-copied byte count, promote the
spiinfo() format specifier from %d to %zu, and fix two adjacent
comment typos.

See the PR description for reproduction, NSH log and benchmark
numbers (5.12 MB/s, 97.5% of SCK/8 @ 42 MHz on STM32F407 + W25Q128).

Signed-off-by: Jinji Cui <113000688+cjj66619@users.noreply.github.com>
2026-05-15 10:10:46 +08:00
..
arm arch/arm/src/stm32/stm32_spi: chunk DMA exchanges to honor 16-bit NDTR 2026-05-15 10:10:46 +08:00
arm64 arch/imx9: Add bidirectional dshot driver using i.MX9 FlexIO 2026-04-30 12:24:47 +08:00
avr style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
ceva arch/ceva: Replace board_app_initialize 2026-05-02 18:36:46 +08:00
dummy
hc style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
mips include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
misoc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
or1k include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
renesas style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
risc-v [arch|board]/risc-v: Allow BSS segments on PSRAM for ESP32-P4 2026-05-14 09:20:03 +08:00
sim fix(sim): fix cmake build on macOS 2026-05-13 10:01:26 -03:00
sparc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
tricore include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
x86 arch/x86: Add palette 256 color to qemu-i486 VGA driver 2026-05-02 09:51:59 -04:00
x86_64 arch/x86_64/intel64: fix signal delivery race in x86_64_sigdeliver 2026-04-21 21:57:44 +08:00
xtensa arch/xtensa: Update common layer version for esp32[-|-s2|-s3] 2026-05-09 09:48:32 +08:00
z16 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
z80 style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
CMakeLists.txt
Kconfig arch/delays: Invalid default value for BOARD_LOOPSPERMSEC 2026-02-25 15:00:03 -03:00