Open hyves42 opened 2 months ago
I tried to investigate this issue again today. It was actually not that easy to reproduce, and it finally happened after I reflashed the stm32 with stlink-gui 1.7.0.
After that, no matter how many times I unplugged or rebooted my setup, I was not able to perform any successful reset with st-flash reset
from testing
branch. The fix suggested above in stlink_exit_debug_mode()
still works.
I can see a pulse on nRST in both cases so I guess the reset is actually performed, but maybe the processor is left in a not running state ?
JAFO here with some thoughts:
Summary: please check the target Boot0 line for pull down to be sure the external board is not the cause.
Boot0 is indeed tied to ground on the external board. I'm using both an STM32-V3-SET and some nucleo boards as STlink V2. Also I had no issue before with version 1.7.0 or with official ST tools so I don't think it is an hardware issue.
Tested again today, as long as I'm not unplugging anything randomly and not exiting stlink-gui
before disconnecting I have no issue with board reset so I changed the title of this issue to something less alarming.
But still, version 1.7.0 can handle reset in cases where the system state is unclear better than the testing branch.
@hyves42: Please have a look at #1260 as well. Maybe this can give some further hints.
Can someone with the respective hardware and knowledge please help to debug this?
@Nightwalker-87 After a software reset, the core remains in the Halt state. After the reset, you must run the core so that the firmware can start...
... which does not sound like a bug to me really. I think to have read this in an earlier ticket targeting this topic.
@Nightwalker-87 But this is not the user expected behavior...
@hyves42 Try to change reset code in the src/st-flash/flash.c
file:
// reset
if (stlink_reset(sl, RESET_AUTO)) {
printf("Failed to reset device\n");
goto on_error;
}
to
// reset
if (stlink_reset(sl, RESET_AUTO)) {
printf("Failed to reset device\n");
goto on_error;
} else
stlink_run(sl, RUN_NORMAL);
In order to allow developers to isolate and target your respective issue, please take some time to select the check boxes below and fill out each of the following items appropriate to your specific problem.
st-flash
]I noticed a regression between
st-flash
1.7.0 from ubuntu repos and the currenttesting
branchI generally reset the target board with the following command:
Expected/description: The target resets (OK on v1.7.0)
This does not work anymore on the
testing
branch, the target does not reset.Interestingly enough, nucleo boards still reset fine, I only see issues when I connect an external board via stlink.
Investigations:
I found a way to fix it but I don't know enough about stlink internals to see if it's a good solution.
The changes since 1.7.0 relevant to this issue are:
stlink_reset()
now setssl->core_stat = TARGET_RESET;
stlink_exit_debug_mode()
now checksIf I remove the test on
sl->core_stat != TARGET_RESET
, the reset command starts working again. But this test was probably added for a valid reason so I will leave devs with more expertise find the right solution.