Skip to main content
Visitor II
July 4, 2021
Solved

ST-Link v3 Mini with STM32CubeIDE

  • July 4, 2021
  • 4 replies
  • 4501 views

Hi

I am using STM32CUBEIDE on macOS. Until now I used my ST-Link v2 via SWD with no problems. I have recently upgraded to an ST-Link v3 MINI and implemented the STDC14 connector on my custom pcbs. The pinout is according to the datasheet (the pins on the ST-Link are numbered and DIO is 4, CLK 6 and so on..)

however: when I open STM32CUBEIDE it recognizes the st-link but when I hit run or debug, it will return "no target found". When I disconnect the ST-Link v3 and connect my st-link v2 I am able to flash the board with no problems.

the ST-Link v3 MINI led is always red during this process.

Does anybody have a clue on how to handle this? I also did not manage to use the drag&drop function...

    This topic has been closed for replies.
    Best answer by Tilen MAJERLE

    A good point would be to check how does it behave with STM32CubeProgrammer tool. If there are problems detecting STM32 device, it may be linked to wrong pinout. This would eliminate potential issue linked to CubeIDE as mentioned by Markus.

    4 replies

    ST Employee
    July 5, 2021

    Hello there!

    A few questions so I can get a better understanding of the issue.

    What version of macOS are you using?

    We recently found an issue where the first time a launch happens on macOS it can get this error but a second launch works. Any chance it's the same for you?

    Are you using the ST-Link GDB Server? Could you send me the gdb server log? You can activate it in your debug configuration.

    LStoe.1Author
    Visitor II
    July 17, 2021

    No, it does not work on the next launches either..

    I am using macOS Mojave 10.14.6 with STM32CubeIDE Version: 1.6.1 Build: 9958_20210326_1446 (UTC).

    STM32CubeProgrammer is version 2.6.0 (Which seems to work, see my reply in answer below)

    This is the gdb server log:

    [0.000] initConfigParams(): Configuration flags start
    [0.000] initConfigParams(): external-init false
    [0.000] initConfigParams(): pend-halt-timeout (null)
    [0.000] initConfigParams(): halt false
    [0.000] initConfigParams(): config-file ""
    [0.000] initConfigParams(): persistent false
    [0.000] initConfigParams(): +log-file "/Users/linus/STM32IDE/bikelights2/Debug/st-link_gdbserver_log.txt"
    [0.000] initConfigParams(): +log-level 31
    [0.000] initConfigParams(): +port-number 61234
    [0.000] initConfigParams(): +verbose true
    [0.000] initConfigParams(): refresh-delay 15
    [0.000] initConfigParams(): +verify true
    [0.000] initConfigParams(): +swd true
    [0.000] initConfigParams(): swo-port 61234
    [0.000] initConfigParams(): cpu-clock 8000000
    [0.000] initConfigParams(): swo-clock-div 128
    [0.000] initConfigParams(): +initialize-reset true
    [0.001] initConfigParams(): debuggers false
    [0.001] initConfigParams(): +serial-number "0015003A3156501620323443"
    [0.001] initConfigParams(): +apid 0
    [0.001] initConfigParams(): attach false
    [0.001] initConfigParams(): shared false
    [0.001] initConfigParams(): erase-all false
    [0.001] initConfigParams(): memory-map ""
    [0.001] initConfigParams(): ext-memory-loaders false
    [0.001] initConfigParams(): extload ""
    [0.001] initConfigParams(): +stm32cubeprogrammer-path "/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.macos64_1.6.0.202101291314/tools/bin"
    [0.001] initConfigParams(): temp-path ""
    [0.001] initConfigParams(): preserve-temps false
    [0.001] initConfigParams(): frequency -1
    [0.001] initConfigParams(): licenses false
    [0.001] initConfigParams(): ignore-rest false
    [0.001] initConfigParams(): version false
    [0.001] initConfigParams(): help false
    [0.001] initConfigParams(): Configuration flags end
    [0.001] init(): STMicroelectronics ST-LINK GDB server. Version 5.8.0
    Copyright (c) 2020, STMicroelectronics. All rights reserved.
    [0.007] Device_Initialise(): Target connection mode: Under reset
    [0.018] readFromTarget(): Reading ROM table for AP 0 @0xf0000fd0
    [0.022] reset_hw_wtchpt_module(): Hardware watchpoint supported by the target 
    [0.025] Device_Initialise(): COM frequency = 24000 kHz
    [0.025] Device_Initialise(): ST-LINK Firmware version : V3J7M3
    [0.025] Device_Initialise(): Device ID: 0x417
    [0.025] Device_Initialise(): PC: 0x0
    [0.025] Device_Initialise(): ST-LINK Failed to get target status
    [0.026] initServerContext(): 
    Error in initializing ST-LINK device.
    Reason: [0.026] initServerContext(): Unknown. Please check power and cabling to target.

    UPDATE:

    Okay so upon comparing the two logs, I saw that CubeProgrammer is running at 8kHz while CubeIDE (set to auto) was trying 24kHz, I set it to 8 kHz and now it seems to work!

    ST Employee
    July 5, 2021

    A good point would be to check how does it behave with STM32CubeProgrammer tool. If there are problems detecting STM32 device, it may be linked to wrong pinout. This would eliminate potential issue linked to CubeIDE as mentioned by Markus.

    LStoe.1Author
    Visitor II
    July 17, 2021

    with STM32CubeProgrammer I am able to read out the memory.

    I click connect, then everything shows up, device name seems correct etc. but after a couple of seconds the ST-Link gets disconnected: macOS gives a warning that I have disconnected the ST-Link without ejecting it and CubeProgrammer says "Warning: Connection to device 0x417 is lost"

    This is the log:

    12:39:35 : ST-LINK SN : 0015003A3156501620323443
     12:39:35 : ST-LINK FW : V3J7M3
     12:39:35 : Board : STLINK-V3MINI
     12:39:35 : Voltage : 3.44V
     12:39:35 : ST-LINK error (DEV_CONNECT_ERR)
     12:39:35 : ST-LINK SN : 0015003A3156501620323443
     12:39:35 : ST-LINK FW : V3J7M3
     12:39:35 : Board : STLINK-V3MINI
     12:39:35 : Voltage : 3.47V
     12:39:35 : SWD freq : 8000 KHz
     12:39:35 : Connect mode: Normal
     12:39:35 : Reset mode : Software reset
     12:39:35 : Device ID : 0x417
     12:39:35 : Revision ID : Rev X
     12:39:35 : UPLOADING OPTION BYTES DATA ...
     12:39:35 : Bank : 0x00
     12:39:35 : Address : 0x4002201c
     12:39:35 : Size : 104 Bytes
     12:39:35 : Bank : 0x01
     12:39:35 : Address : 0x1ff80000
     12:39:35 : Size : 20 Bytes
     12:39:35 : UPLOADING ...
     12:39:35 : Size : 1024 Bytes
     12:39:35 : Address : 0x8000000
     12:39:35 : Read progress:
     12:39:35 : Data read successfully
     12:39:35 : Time elapsed during the read operation is: 00:00:00.004
     12:40:06 : Error: Unable to get core ID
     12:40:06 : Error: Unable to get core ID
     12:40:06 : Warning: Connection to device 0x417 is lost
     12:40:08 : Disconnected from device.

    UPDATE 1: After the third time it does not disconnect anymore.. strange.. 

    UPDATE 2:

    Okay so upon comparing the two logs, I saw that CubeProgrammer is running at 8kHz while CubeIDE (set to auto) was trying 24kHz, I set it to 8 kHz and now it seems to work!

    ST Employee
    July 6, 2021

    Hello,

    I have an STLink V3 Mini and it is working fine on a Nucleo G491RE.

    You can try If you have a recent Nucleo that have an external 10 pins Debug Connector,

    You must set the supply jumper to 5V_charger and set the jumper JP1 to Reset the embedded STLink next to the STLink USB connector.

    If you don't have other board to try, you can check what pins are mandatory to connect from the Nucleo's board schematic.

    The flat cable is using only the 10 pins in the center for Nucleo. (V3 mini has a 14 pins flat cable).

    Rgds,

    Laurent

    LStoe.1Author
    Visitor II
    July 17, 2021

    Sadly, I don't have another board. The necessary pins are connect (STM32CubeProgrammer works, see answer above)

    Graduate II
    July 6, 2021

    Does your target stay long in WFI? StlinkV3 is very bad at connecting to such targets. Did you try to connect under reset (if reset is connected)?

    LStoe.1Author
    Visitor II
    July 17, 2021

    How do I check if it stays long in WFI?

    I have connect under reset enabled in the debug configuration in STM32CubeIDE