-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STLINK/V3-SET: If the device fails to enter SWD mode, the usb device is not released #1399
Comments
@Ant-ON: Can we be sure about that the STLINK-V3-SET is fully supported yet? |
@Nightwalker-87 STLINK-V3-SET has the same commands as STLINK-V3, therefore the STLINK-V3-SET should be supported too |
So why shall there a problem then which does not seem to occur with other variants? |
I have the same issue with my ST-LINK V3 SET. sending flash reset command when no MCU is connected, leads to first this message
And when the command is triggered another time you will receive an error
The debug flag does not give more information
Additionally, it looks like the ST-LINK V3 SET is stuck/hanging. This is something that I diagonalised with the LEDs and the response time delay when you execute the The issue remains the same even though I connect the MCU back again to the ST-LINK V3 SET; only a power reset of debugger i.e. unplugging the USB cable and connecting it back again solves the issue. Finally, as @TheFissk mentioned, I too have not observed any issue with ST-LINK V2 it just comes out of the command with an error, and is able to connect to the MCU when the MCU is connected again to the debugger. The V2 does not produce LIBUSB_ERROR_TIMEOUT error. Flash reset with ST-LINK V2.
Feel free to comment, if more information is required 😃 |
I can confirm the behaviour like @ankurraji mentioned with v1.8.0 and ST-LINK V3 MINIE. So it seems not to depend only on the combination command set and ST-LINK V3 SET. |
Please investigate further. We need some volunteers with the appropriate hardware that are able to look into this. |
Got this on a stm32 G0 using a STlink-v3mini |
We are still looking for further investigation and further ideas here. Please contribute. |
I'm having the same issue but using the ST-LINK from the nucleo-L476RG (FW version V2J45M31):
I could flash my device just once. Following flashes failed. I can connect my nucleo board with the STM32CubeProgrammer and flash it. |
Please re-test this on a linux machine with a current libusb package from the default internal package source. |
it still fails in the same way on my system, compiled against libusb 1.0.27 |
As far as I could investigate, this needs to be addressed within |
I suppose the bug is somewhere here in
We find that |
Along with this topic, I propose some restructuring in the codebase regarding existing STLINK commands, defined in |
To highlight this renaming has taken place:
I found that the whole STLINK/v3 implementation started here with commit 09ea99a. |
The STLINK-V3MINIE also failed to enter SWD mode here in a very similar way. @TheFissk Can you rule out such a hardware-related cause? |
@Nightwalker-87 I got the same behaviour on both of my V3 SETS, on both the 1.8 release, the latest changes in the develop branch. both with the provided mezzanine board attached and without. Always without any 3rd party boards attached (no chance that anything other than the official ST hardware was the source of the problem) So unless ST messed up the hardware on both of my programmers, its unlikely that hardware is to blame. I should note that if I expect to be able to enter SWD (there is a board attached to my programmer) everything works as expected. Its only when there isn't a board attached, and I shouldn't be able to enter SWD that I see this problem. (ie on the second running of the command the program hangs with libusb timeout errors, rather than failing instantly as in the first running). |
@TheFissk: Thank you for the clarifications. We need to check further. |
My device, Nucleo-F030R8, has been working well for quite some time. However, yesterday it started exhibiting the problems mentioned. I'm pretty sure after I had attempted a flash with no board connected. I'm sure I've done this a number of times in the past without problems. I think this problem started after a recent ST-LINK/V2-1 "upgrade" using STLinkUpgrade 3.16.7. st-info --probe. Failed to enter SWD mode I have just managed to flash by dragging the executable onto the desktop "disc" image of my board. Somehow I managed to connect once but subsequent attempts failed. Found 1 stlink programmers |
Hi all! I've just reread all of the comments on this issue, but I'm not clear what are the options or next steps. I would appreciate if someone could point how to help and if is there any workaround. In our case, we are using ST-LINK V3PWR and when target is not available, the ST-LINK will hang indefinitely until we reconnect the USB cable. We already took care to upgrade the ST-LINK firmware (it is now shown as version V4J6). For us this is a major problem since we run ST-LINK remotely and, at the moment, USB cable reconnect requires operator physical intervention. Best Regards, |
Checking at the latest commit code, I see that only a few commands are specific to V3. Therefore I guess that either some V3 capabilities are pending to be implemented or almost all V3 capabilities can be used via V2 commands. Also I have noticed that when using stm32cubeprogrammer (on linux) the problem still stands so I lean towards pointing to some instability in the ST-LINK firmware. |
@raul-klg It is normal that only several commands have the APIV3 suffix. This suffix informs about commands added in version 3 of the protocol. The initialization command ( |
Thanks for the reply, Ant-ON Meanwhile I though some information on our side could be helpful, so I'm attaching a I got the log with the command Edit: I cannot attach the log, the interesting part is this:
|
I fix it by erasing full chip with STM32 Programmer then reinstalling with STM32 Programmer. Also, when other things respond with zeroes in some fields, STM32 Programmer has no problem, all fields appear correctly. |
Thank you for this reply. From your words I understand that you do a full chip erase from STM32CubeProgrammer against ST-LINK V3/PWR via some other debugging device (maybe one other ST-LINK). I can do this, but how would you reprogram the /faulty/ ST-LINK, would the STLinkUpgradeTool work in this case? Regards, |
My st-links are V2 on stm32 boards. I do a full chip erase with st32 programmer then I use st32 programmer's st-link "upgrade" facility to reprogram the chip's st-link. I'm no expert in this field so I'm not really sure what's going on, just that it solves my st-link chip unrecognized problem whenever it occurs |
When there is no board connected to the programmer causing it to fail to enter SWD mode subsequent invokations of the tool hang before failing.
Commandline output:
These commands are separated by several seconds, I'm not machinegunning the tool expecting it to work. The first command returns immediately, the second hangs for ~10s
I also tested it against st-info --chipid and it works in much the same way, but it suppresses the stderr output, so that the program hangs for a ~10 seconds before outputting:
Plugging a board into the programmer once its entered this degraded state does not resolve the issue, it will continue to output the same errors
st-info --probe
works as expected returning instantly regardless of whether or not the device was able to enter SWD mode in previous invokations ofst-info --probe
The V2 programmer works as expected, returning instantly even after failing to enter SWD mode.
Expected/description:
If the V3 programmer should return instantly after failing to enter SWD mode, regardless of whether or not it was able to enter SWD mode previously.
The text was updated successfully, but these errors were encountered: