0

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?

guenthernagel
  • 73
  • 1
  • 3
  • 14

2 Answers2

1

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.

guenthernagel
  • 73
  • 1
  • 3
  • 14
0

With version up to v1.0.1 it is not possible to connect under reset with STM32CubeIDE from GUI.

The reason(s) why you are having the issue could be:

  • You are using low-power features where CPU is halted
  • You are overwriting default alternate function setup for SWDIO and SWCLK pins (PA13 and PA14).

If you need to use Connect under reset, use STM32CubeProgrammer for flashing. Even better, try not to use sleep modes or do not overwrite flashing GPIOs for the test.

unalignedmemoryaccess
  • 7,246
  • 2
  • 25
  • 40
  • Thanks. In the Cube MX Config I dont use PA13/14, if I use low Power Stuff, its unaware, how can I check? Generally, its a bug or a feature that's there are no "Connect under reset"? – guenthernagel Jun 19 '19 at 17:58
  • @guenthernagel it is unimplemented feature, coming soon. Do you use ST board or your own one? Did you add some more code to the project? Do you use `__WFI` or `__WFE` instruction somewhere? – unalignedmemoryaccess Jun 19 '19 at 17:59
  • OK. Is there any workaround? Its possible to use external programmer/debugger directly out of the IDE? – guenthernagel Jun 19 '19 at 18:01
  • @guenthernagel in normal conditions, programming should work and it works normally. So I would like to understand your hardware too. – unalignedmemoryaccess Jun 19 '19 at 18:02
  • Hmm. I use the EasyMX Pro v7 for ARM Development board from mikroelektronika - it have a onboard ST-LINK (They call it mikroProg) : https://www.mikroe.com/easymx-pro-stm32 If i erase the chip with ST-Link Utility by holding rst btn on board, I can write one time with Cube IDE – guenthernagel Jun 19 '19 at 18:05
  • What I see right now is, If I erase the MCU with Utility and Debug it with IDE the first time, the code uploads but it dont run. Have to Stop Debugging then and make a reset, after that the code is running... Strage things... – guenthernagel Jun 19 '19 at 18:29
  • Everything looks like you are using low-power features, or CPU clock is too slow (did you modify HCLK clock inside CubeMX?) Try to set maximal clock with internal RC oscillator. – unalignedmemoryaccess Jun 19 '19 at 18:36
  • Is the STLink gdbserver or openOCD documentation written in the dead language? – 0___________ Jun 19 '19 at 21:24
  • `With version up to v1.0.1 it is not possible to connect under reset with STM32CubeIDE` does everything have to be clickable? No strtup, no config files? no command line options? **It is possible to connect under reset** – 0___________ Jun 19 '19 at 21:25
  • @P__J__ technically you are right. I updated my answer ;) – unalignedmemoryaccess Jun 19 '19 at 21:28
  • @P__J__ which command I need for connect under Reset? I dont found the cmd line options. – guenthernagel Jun 20 '19 at 19:32
  • @tilz0R, Clock is at 72MHz, with external OSC. How can I check the low-power settings? I tried it today with own hardware, similar to mikroE Stuff, still same problem. – guenthernagel Jun 20 '19 at 19:34
  • @tilz0R found the problem by myself. Check out my answer on top. – guenthernagel Jun 22 '19 at 16:08