STM32 Cube IDE (True Studio) Connect under Reset

guenthernagel picture guenthernagel · Jun 19, 2019 · Viewed 8.5k times · Source

I just tried out the new STM32 Cube IDE, which based on Atollic True Studio which based on Eclipse.

Looks good, Cube MX is integraded but the Debugger / ST-Link Intigration made problems by me.

If I flash a MCU for first time, it works pretty well. But on next time, the IDE says

"Target no device found

Error in initializing ST-LINK device. Reason: No device found on target."

I found out that the ST-Link V2 with my Hardware need a "Connect under Reset".

With the ST-Link Utility it works fine, but in Cube IDE I cant find that point to set up.

Here is the Config Form: IDE

Can anyone assist?

Answer

guenthernagel picture guenthernagel · Jun 22, 2019

I found the problem of the code, why the upload just works one time after full erase:

Cube IDE generate the HAL_MspInit() in ..stm32f1xx_hal_msp.c which contains:

__HAL_AFIO_REMAP_SWJ_DISABLE();

With that all debug stuff will be disabled after first flash. With changing this line to:

__HAL_AFIO_REMAP_SWJ_NOJTAG();

The Debug mode works fine and several times in a row.