DMA2 not firing on STM32G431 Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
nylon63
Posts: 1
Joined: Wed Jan 08, 2025 4:29 pm
Been thanked: 1 time

DMA2 not firing on STM32G431  Topic is solved

Postby nylon63 » Wed Jan 08, 2025 5:06 pm

ChibiOS Version: r16867

Compiler: gcc version 13.3.1 20240614 (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24))

Platform and Board:
- MCU: STM32G431CB
- Custom board

Nature of the Problem:
When SPI using DMA2 channels on STM32G431, the DMA transfer gets stuck - the EN bit is set but the CNDTR register does not decrease and no
dma2 stream interrupts are fired. The same configuration works perfectly with DMA1 channels.

Interestingly, memory-to-memory transfers using dmaStartMemCopy with DMA2 work fine, but for SPI the transfer never completes while identical code using DMA1 works as expected.

Steps to reproduce:
1. Build and flash the attached minimal project
2. Observe that spiExchange transfers never complete (LED stops blinking)
3. Change SPI1 RX TX DMA to DMA1 in the code - transfers work correctly (LED blinks)

I've attached a minimal ChibiOS project that demonstrates this issue.
Attachments
g431cb.zip
(13.48 KiB) Downloaded 19 times

User avatar
Giovanni
Site Admin
Posts: 14565
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1112 times
Been thanked: 937 times
Contact:

Re: DMA2 not firing on STM32G431

Postby Giovanni » Sun Jan 26, 2025 9:38 am

Hi,

Update, probably found the problem, from the Reference Manual RM0440 rev 8 pag.420:

Code: Select all

For category 2 devices:
•DMAMUX channels 0 to 5 are connected to DMA1 channels 1 to 6
•DMAMUX channels 6 to 11 are connected to DMA2 channels 1 to 6


This is wrong, channels 1 to 6 of DMA2 are mapped on DMAMUX channels 8 to 13 (same positions of other G4 devices with 8 channels per DMA).

Will commit a fix later today.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14565
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1112 times
Been thanked: 937 times
Contact:

Re: DMA2 not firing on STM32G431

Postby Giovanni » Sun Jan 26, 2025 9:54 am

Hi,

Fixed as bug #1295.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 5 guests