ST-Link debugger connection lost after adding DMA to SPI
With STM32CubeIDE 1.7.0 (Windows) I try to setup SPI2 with DMA at an Nucleo-G431RB.
After starting with an new STM32Cube C-Project for the Nucleo-G431RB with all peripherals at their default settings, I enable SPI2:
- Full-Duplex Master at PB[15:13]
- 8bits
- prescaler at 16
- all other settings at their defaults
A simple
HAL_SPI_TransmitReceive(&hspi2, tx_buffer, rx_buffer, BUFFER_SIZE, 100);works as expected and I am able to transmit and receive data.
If I then enable the SPI2_RX and/or SPI2_TX DMA in the Device Configuration, I am no longer able to upload the generated binaries to the Nucleo board:
STMicroelectronics ST-LINK GDB server. Version 5.9.1
Copyright (c) 2021, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled
Waiting for debugger connection...
Debugger connected
Debugger connection lost.
Shutting down...
GDB received a timeout when trying to connect to the target.
If I remove the DMA channels of SPI2 from the Device configuration, GDB is able to connect to the target again:
STMicroelectronics ST-LINK GDB server. Version 5.9.1
Copyright (c) 2021, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled
Waiting for debugger connection...
Debugger connected
-------------------------------------------------------------------
STM32CubeProgrammer v2.8.0
-------------------------------------------------------------------
ST-LINK SN : 004C003D3039510734393838
ST-LINK FW : V3J8M3
Board : NUCLEO-G431RB
Voltage : 3.28V
SWD freq : 24000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x468
Revision ID : Rev Y
Device name : STM32G43x/G44x
Flash size : 128 KBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0x__
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a09144.srec
File : ST-LINK_GDB_server_a09144.srec
Size : 11372 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 5]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:00.316
Verifying ...
Download verified successfully
Debugger connection lost.
Shutting down...Why does adding DMA channels to the device configuration breaks the connection of GDB to the target?
How can I get DMA working at SPI2?
Best regards, Sebastian
