Debugger connection fails when using UART2 in DMA mode in Nucleo-401RE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-23 7:24 AM
Hello everybody,
I am trying to build a simple communication between my PC and a Nucleo-F401RE using UART over the USB connection.
I am able to do this successfully using a “polling�? or an “interrupt�? configuration.
However, when I configure the UART2 of my F401RE as using DMA (I use the CubeMX tool in CubeIDE to do the configuration) and then try to run the program in run or debug mode, I get the error messages:
“Debugger connection lost.
Shutting down...�?
Is it not possible to use DMA of UART2??
Many thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-23 7:58 AM
It's possible. Not sure what DMA setting could cause the debugger to be lost, but there's gotta be a bug in your program somewhere.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-23 8:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-23 8:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-23 5:44 PM
Try to single-step your code (and that includes the Cube portion); if you get close to the spot where the debugger disconnects. My guess is, that it's where the DMA control register gets written in order to enable DMA. In any case, report back, together with the read-back content of relevant DMA registers and any other relevant information from just before the debugger-connection-loss occurs.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-23 11:32 PM
Thanks JW by the suggestion.
When I press "Debug" in CubeIDE I don't even get to the part where I can single-step the code, the debugger disconnects before that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-24 4:04 AM
> I don't even get to the part where I can single-step the code
You mean, you can't get it to stop at beginning of main()?
But that then the problem is probably not related directly to the UART DMA, which is supposedly set *after* beginning of main()... To confirm this, try to comment out only the function call where DMA is enabled.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-24 4:12 AM
Exactly, I can't get it to stop at beginning of main(). After I click on Run->Debug on CubeIDE I get the following:
"STMicroelectronics ST-LINK GDB server. Version 5.5.0
Copyright (c) 2019, 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..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-24 4:16 AM
If I then delete the DMA configuration of UART2 on CubeMX, then recompile and run I get the following:
"STMicroelectronics ST-LINK GDB server. Version 5.5.0
Copyright (c) 2019, 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.4.0
-------------------------------------------------------------------
ST-LINK SN : 066EFF504955857567023636
ST-LINK FW : V2J36M26
Voltage : 3.25V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x433
Device name : STM32F401xD/E
Flash size : 512 KBytes
Device type : MCU
Device CPU : Cortex-M4
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a08128.srec
File : ST-LINK_GDB_server_a08128.srec
Size : 8116 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sector 0
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:00.686
Verifying ...
Download verified successfully "
And the debugger is stopped at the first line of main()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-04-24 4:29 AM
So the debugger won't even download program when DMA is enabled? That does not make sense at all and indicates problem in CubeIDE itself.
Maybe somehow related to https://community.st.com/s/question/0D50X0000C21PzlSQE/debugger-stuck-on-random-line ?
I don't use Cube/CubeMx/CubeIDE.
JW
