Skip to main content
VZerb.1
Associate
November 27, 2020
Question

Debugging Nucleo-F401RE with st-link

  • November 27, 2020
  • 11 replies
  • 4582 views

I am trying to debug a a nucleo-F401RE with the st-link. About a week ago, it was fine and the code uploaded. I had made it so that the LED on the F401RE turned on and off when I pushed down and released the push button. I came back to it yesterday to work on more after I got parts to do other stuff.

I simply tried to reupload the code to turn the LED on and off with the pushbutton again, but it failed and I began getting many errors. Some about trying to join a joined drive, and this one below. I searched all over and could not find a solution. I upgraded CubeIDE to 1.5 but that didn't help. I tried to delete everything and redownload both versions of cubeIDE again. Now I am just getting this error:

Error in final launch sequence:

Failed to execute MI command:

target remote localhost:61234

Error message from debugger back end:

Remote communication error. Target disconnected.: Success.

Failed to execute MI command:

target remote localhost:61234

Error message from debugger back end:

Remote communication error. Target disconnected.: Success.

Remote communication error. Target disconnected.: Success.

Please let me know what to try next. Sorry if I haven't provided enough info. Please let me know if I should provide any other details. I am new to this.

This topic has been closed for replies.

11 replies

Tesla DeLorean
Guru
November 27, 2020

Check if you can connect using STM32 Cube Programmer, without involving CubeIDE or GDB Server

If you can connect, try erasing the firmware on the board.

See if you can "Connect under Reset"

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
VZerb.1
VZerb.1Author
Associate
November 28, 2020

When I try to connect with STM32 Cube Programmer, it gives me this error:

Error: ST-LINK error (DEV_TARGET_HELD_UNDER_RESET)

Do you mean try to "connect under reset" in the programmer or in CubeIDE. When I tried to connect under reset in cubeIDE it gave me a similar "target held under reset" error.

VZerb.1
VZerb.1Author
Associate
November 28, 2020

After changing the settings, I have found that it will connect in hot plug mode in both Cube Programmer and ST Link Utility. I do not know if this helps anything though.

VZerb.1
VZerb.1Author
Associate
November 28, 2020

When I try to do a mass erase in Cube Programmer, it gives me this error:

Error: Mass erase operation failed.Please verify flash protection

VZerb.1
VZerb.1Author
Associate
November 28, 2020

When I try to "erase chip" in ST Link Utility, it gives me this error and message:

19:49:00 : Internal command error

19:49:04 : Read out protection is activated

LaurentL
ST Employee
November 30, 2020

So maybe you have activated Read out Protection in option bytes.

Try to reprogram option bytes to remove read out protection on STM32CubeProgrammer.

Rgds,

Laurent

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
VZerb.1
VZerb.1Author
Associate
November 30, 2020

I removed read out protection and I still can't do anything else. When I try to do a full chip erase it gives me this error:

 10:55:16 : Starting Automatic Mode...

 10:55:16 : Waiting for device n:1...

 10:55:16 : MASS ERASE ... 

 10:55:18 : Mass erase operation failed.Please verify flash protection

 10:55:18 : Please disconnect device n:1 and connect the next...

I cannot find where to "verify flash protection"

VZerb.1
VZerb.1Author
Associate
November 30, 2020

@LaurentL​ 

LaurentL
ST Employee
December 1, 2020

Are you up to date on CubeProgrammer version ?

v2.6.0 is the latest.

If you connect and read option bytes, what is the read out protection state ? and write protections ?

Then, set write protections off when you remove also the read out protection if set.

Then, you can use the eraser button on the bottom left to do a mass erase.

After that, you might use the automatic mode but you need to set the device in a workable state first.

Then, to use CubeIde, don't forget to disconnect on CubeProgrammer (or exit CubeProgrammer).

I think I remember there was this read out protection issue on some F4 a long time ago, I don't remember if the issue was on VCAP capacitors.

Check them and check that VCAP voltage are ok (1.35 V I think).

Check also all GND, VDD and VDDA pins if any. Also the BOOT pins.

Well, on a Nucleo board, this should be ok, I thought it was a self made board.

Rgds,

Laurent

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
VZerb.1
VZerb.1Author
Associate
December 4, 2020

I am updated. The read out protection state was set to 0, but I set it to AA which says is no protection (same as 0). The write protections were all unchecked so I checked them all to disable protection. I tried to do the mass erase but the LED on the st link just keeps doing its flashing red and blue indicating it is transferring info. It just does this continuously but I would cancel it because it was taking so long. Is it supposed to take a long time?

Could you explain how to check the voltages VCAP, GND, VDD, and VDDA, and BOOT pins? I don't see them on the st link or board, but are they in the chart for the board?

@LaurentL​ 

Thank you for your help.