on
2022-04-04
01:07 AM
- edited on
2024-06-04
06:06 AM
by
Laurids_PETERSE
STM32CubeMX
STM32CubeProgrammer
STM32CubeIDE
The easiest and only way to prevent connection issues using CubeMX is to make sure that your debug pins are Free, Reserved for Debug or Used by the Debug.
Generally, SWD is mapped on PA13 (SWDIO) and PA14 (SWCLK). This is the default state after reset.
Taking the example of Serial Wire Debugging for a NUCLEO-U575ZI-Q
Free | Reserved for Debug | Used by the Debug |
---|---|---|
Note:
It is always recommended to activate the debug interface in MX, this will protect the IO pins from being used by another IP.
Note:
In CubeMX interface, the Debug section can be found under System Core > SYS IP for the legacy products.
In case, one of the debug pins have been set accidently to any other signal than SWDIO and SWCLK. Then you generated the code and loaded it in the MCU.
During Debug, the message “Target is not responding, retrying...” will keep showing up in the IDE console and eventually the connection will be lost.
In this case, the only way to take back the control of the board is by connecting it under reset using the NRST pin.
Debug pins must be overwritten by the debugger to achieve the communication, this can be done using STM32CubeProgrammer or the IDE (CubeIDE, MDK-ARM or EWARM).
Reset and Connection modes can be selected in the ST-LINK configuration Panel.
Once connected, Mass erase the Chip
The Mass Erase function erases the full memory, A message “Mass erase successfully achieved” will be displayed in case of success.
After doing these steps, the board will be able to communicate with the debugger.
Return to CubeMX and activate the Debug.
After code re-generation, open debug configuration
And change the Reset behavior type to “Connect Under Reset”
Click on Apply, then debug the board.
For more details, please check AN4989 , section 4,
STM32CubeMX install link
STM32CubeProgrammer install link
STM32CubeIDE install link
I have tried with stmcubeprogrammer step one but getting this error below. My Board is Stm32WLxx.
15:43:24 : UR connection mode is defined with the HWrst reset mode
15:43:24 : ST-LINK SN : 13002900130000544141514E
15:43:24 : ST-LINK FW : V2J42S7
15:43:24 : Board : --
15:43:24 : Voltage : 3.25V
15:43:24 : Error: No STM32 target found! If your product embeds Debug Authentication, please perform a discovery using Debug Authentication
Check that jumpers on the board are in default position.
As you are using a STLink Clone, did you check your precedures against a know working setup? It seem at the moment both debugger and target board are unknown. First check your procedures with both end know working, e.g. a ST Nucleo Board and check your procedures are working.When working, attach the clone to the Nucleo, disabling the on board STLink and check again. When still working, connect to yout target board.
@MahadiHasan32 Yes, those units are definitely clones - they are not ST products (the ST logo is fake).
Beware that the pinouts on those things are not consistent:
Im also facing same issue, but im using Nucleo-H7A3ZI-Q Development Board, can you please help me to resolve the issue
Re: STM32H7A3ZIT6 - Code not automatically startin... - STMicroelectronics Community
The first thing to check is whether the Host system (eg, PC) can connect to the ST-Link.
On Windows, the Device Manager should show both an 'ST-Link Debug' device and an ST-Link Virtual COM Port (if the ST-Link supports it):
Without this basic connection from the Host to the ST-Link, nothing else can even begin to work!
If the ST-Link is not detected, check your cable: are you sure it's a full data cable - not jus a charging cable?
Try other cables.
Try other USB ports.
If connecting via a hub, try without it; if connecting without a hub, try with one - a powered one.
Try connection with no other USB devices - including hubs or "docking stations" - attached.
Beware that the USB connectors on dev boards can be quite fragile.
PS:
Specifically for ST-Link V3, see: "FAQ: Possible communication failure between STLINK-V3 and some recent computers":