Skip to content
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

USB hard reset causes total failure on STM32L053-Disco #334

Closed
lcrocker opened this issue Aug 19, 2015 · 4 comments · Fixed by #336
Closed

USB hard reset causes total failure on STM32L053-Disco #334

lcrocker opened this issue Aug 19, 2015 · 4 comments · Fixed by #336

Comments

@lcrocker
Copy link

I'm using an STM32L053 Discovery board, connected via USB to a PC running Ubuntu 14.04.

An earlier version of st-flash and other tools were working for me, but when I built and installed the latest version, everything failed. "st-info --chipid" didn't print anything, st-flash always failed with chip-id 0 error, GUI wouldn't connect. Did the "git bisect" thing and narrowed it down to the 8271b32... commit on Aug 15, "Make _stlink_usb_reset use hardreset". Reversed that patch on the head and everything's happy again: GUI connects, st-info --chipid shows 0x0417, st-flash erase erases.

The comment at the head of _stlink_usb_reset is "TODO - not convinced this does anything..." Doesn't exactly inspire confidence. At any rate, whatever setup that was intended to fix isn't my setup, so you'll have to make that change conditional on something. Sorry, I have no clue what that might be.

@mlu
Copy link
Contributor

mlu commented Aug 20, 2015

I think this might be connected to the fact that the original _stlink_usb_reset() really does not reset and run the target like a push of the reset button, and that st-info and st-flash always calls reset when opening usb as discussed in #332 .
My suggestion, is we make the reset when opening usb an active choise option but we keep the hard reset so it is possible to actually reset the target.

@mlu
Copy link
Contributor

mlu commented Aug 20, 2015

We can try the following changes and see if they help, with the patch "Make _stlink_usb_reset use hardreset" applied, the idea is to understand what is actually going on .
In stlink/flash/main.c:144
{ sl = stlink_open_usb(o.log_level, 1);

to
{ sl = stlink_open_usb(o.log_level, 0);

In src/st-info.c:line 54
if (sl == NULL) sl = stlink_open_usb(0, 1);
to
if (sl == NULL) sl = stlink_open_usb(0, 0);

@lcrocker
Copy link
Author

This works on my 053. You also have to make the same change to line 533 of gui/stlink-gui.c. I've never used "st-term", so I don't know about that one.

@mlu
Copy link
Contributor

mlu commented Aug 20, 2015

I will look into this and check all resets, and also see how we can add optional resets. But its good the code works :)

@stlink-org stlink-org deleted a comment from stevenhoneyman Apr 6, 2020
@stlink-org stlink-org deleted a comment from mlu Apr 6, 2020
@stlink-org stlink-org deleted a comment from stevenhoneyman Apr 6, 2020
@stlink-org stlink-org deleted a comment from mlu Apr 6, 2020
@stlink-org stlink-org deleted a comment from stevenhoneyman Apr 6, 2020
@stlink-org stlink-org deleted a comment from stevenhoneyman Apr 6, 2020
@stlink-org stlink-org deleted a comment from mlu Apr 6, 2020
@stlink-org stlink-org deleted a comment from stevenhoneyman Apr 6, 2020
@stlink-org stlink-org deleted a comment from xor-gate Apr 6, 2020
@stlink-org stlink-org deleted a comment from xor-gate Apr 6, 2020
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants