Closed thegecko closed 3 years ago
Are you using the most recent STLink firmware?
An infinite wait response normally means a stuck transaction. But pyOCD has code to issue an abort, which should recover from this state (and does, in the few cases I've seen).
Have updated to the latest ST firmware (v34) and can confirm this problem still exists with the F475 IOT board. Updating seemed to resolve the issue on the other boards.
Update: I'm now able to reproduce this issue. It requires power cycling the board after programming firmware. The connect_mode=under-reset
option on my feature/connect_mode branch allows you to connect successfully. But there are still questions about what's causing the problem that need to be resolved.
Thanks @flit
Hi When you connect pyOCD, target is already on I think ?
With latest mbed-os version, target could now is sleep or deep sleep. So I am wondering how pyOCD can sync with target to attach it during a "wake up" ?
@schstm
@jeromecoutant You're right that this is related to low power modes. It needs to be addressed in the firmware itself.
There are two options for debug profile builds:
PyOCD does set the DBGMCU_CR bits when it connects. But if the target is already sleeping without these bits set, as happens when you power cycle the board and it starts executing the Mbed OS app, there's nothing PyOCD can do to wake up the device. Support for that has to be integrated into the SoC, primarily by having the DP in an always-on power domain. Unfortunately that is not the case for the vast majority of Cortex-M MCUs. Afaik, only the Arm Musca SoC do this. Aside from adding complexity, the more you put in AON the more leakage you have. There might be some MCU vendors that do this, but I'm not aware of them.
Note: mbed-os offers a DEBUG profile that would prevent deep-sleep to be entered and can be used for easy debug.
The Debug profile still enters sleep, just not deep sleep. But the debug connection is lost even in sleep, because FCLK is disabled. So you still need to set DBGMCU_CR.DBG_SLEEP, which the STM32 HAL for Mbed OS does not currently do.
Update: I'm now able to reproduce this issue. It requires power cycling the board after programming firmware. The
connect_mode=under-reset
option on my feature/connect_mode branch allows you to connect successfully. But there are still questions about what's causing the problem that need to be resolved.
@flit I'm having the same issue but I cannot find your linked branch anymore.
Closing this issue.
There were two fixes implemented long ago:
connect_mode
option, now accessible via --connect/-M
on the command line.If this is still a problem for anyone, please create a new issue.
Closing this issue.
still opened :-)
Oops, thanks @jeromecoutant :)
OS: MacOS 10.14.5 Mbed OS: 5.13.1 Compiler: GCC or AC6.11 pyOCD: 0.21.0 Targets: ST boards (seen on F411, F413, F042K6, F475IOT)
When deploying or debugging ST targets, occasionally a
DP Wait
error is thrown. This puts the board into a state which still allows updates via mass storage device but any pyOCD interaction continues to show this error even after a hard reset.With reference to https://github.com/mbedmicro/pyOCD/issues/623, the environment isn't in a VM and all firmware is up to date.
It would be good to understand how to recover from this state.