Skip to main content
LHarm.1
Associate III
January 13, 2022
Solved

What is the cause a DMA transfer error?

I am trying to read from an external SPI ADC at a 1MHz rate using a timer and 4 dma channels.

I setup TIM 3 to run at 16 MHz and rollover at a count of 24.

CC1 pulse is 1, cc2 pulse is 2 cc3 pulse is 22.

CC1 drives DMA1 stream4 which is setup to transfer from memory to a GPIO BSSR register , cs assert

CC2 drives DMA1 stream 5 which writes a 16bit value to the SPI Tx register, starting a transfer

CC3 drives DMA1 stream 7 which is setup to transfer from memory to a GPIO BSSR register, cs de-assert

The SPI transfer works as expected, but bothe the GPIO DMAs fail with a transfer error and the NDTR register decremented by 1 from the programmed value.

How can I debug the DMA transfer error. I have tried both 16 and 32 bit transfers as well as just running a single channel. No luck.

Any help will be apprreciated.

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
January 13, 2022

You have to use DMA2 to transfer from/to GPIO.

http://efton.sk/STM32/gotcha/g30.html

JW

4 replies

TDK
January 13, 2022

Please put your chip number in your post.

"If you feel a post has answered your question, please click ""Accept as Solution""."
LHarm.1
LHarm.1Author
Associate III
January 13, 2022

stm32f411RETx. I am using a Nucleo-f411RE board.

waclawek.jan
waclawek.janBest answer
Super User
January 13, 2022

You have to use DMA2 to transfer from/to GPIO.

http://efton.sk/STM32/gotcha/g30.html

JW

LHarm.1
LHarm.1Author
Associate III
January 13, 2022

Thank you.