Skip to main content
Takayoshi Ishii
Associate III
June 20, 2017
Solved

STLink can not connect to Nucleo as ''Wrong device detected''

  • June 20, 2017
  • 1 reply
  • 3002 views
Posted on June 20, 2017 at 12:27

Hello,

I am a new for STM32.

I bought Nucreo-L053R8 board, and installed latest Systemworkbench and STLink USB driver stsw-link009 on my PC. My OS is windows 8.1. I made a very short program and it could be compiled.

When I connect Nucreo board to my PC, I can see it as 'USB BUS DEVICE-STM32 STLink'.

Then I did run on Systemworkbench, then a window is opend and said 'OpenOCD Problem Occured, Reason: Wrong device detedted'.

After few second, USB is disconnected and I can see it as unknown device.

When I made the project, I select the device as L053.

Console shows like following.

-----------------------------------------

Wrong device detected

Open On-Chip Debugger 0.10.0-dev-00278-ga53935e-dirty (2017-05-09-09:25)

Licensed under GNU GPL v2

For bug reports, read

https://community.st.com/external-link.jspa?url=http%3A%2F%2Fopenocd.org%2Fdoc%2Fdoxygen%2Fbugs.html

srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

adapter speed: 4000 kHz

adapter_nsrst_delay: 100

Info : clock speed 4000 kHz

Info : STLINK v2 JTAG v25 API v2 SWIM v14 VID 0x0483 PID 0x3748

Info : vid/pid are not identical: 0x0483/0x374B 0x0483/0x3748

Info : using stlink api v2

Error: init mode failed (unable to connect to the target)

in procedure 'program'

in procedure 'init' called at file 'embedded:startup.tcl', line 473

in procedure 'ocd_bouncer'

** OpenOCD init failed **

shutdown command invoked

-----------------------------------------

Let me know how should I do.

    This topic has been closed for replies.
    Best answer by Bogdan Golab
    Posted on June 21, 2017 at 15:01

    Right, almost every nucleo I bought had an old firmware version causing ST_LINK issues. I have not mentioned it.

    1 reply

    Bogdan Golab
    Lead
    June 20, 2017
    Posted on June 20, 2017 at 17:19

    Maybe wrong configuration - you have ST-LINK v2 but you actually has v-1 in cfg file.

    stlink-v2.cfg:

    VID/PID 0x0483 0x3748 for ST-Link/V2

    VID/PID 0x0483 0x374b for ST-Link/V2-1
    Takayoshi Ishii
    Associate III
    June 21, 2017
    Posted on June 21, 2017 at 04:31

    Bogdan,

    Thank you for your reply.

    I changed the config file as ST-Link/v2, and the error massage of 

    '

    Info : vid/pid are not identical: 0x0483/0x374B 0x0483/0x3748'

    is disappered. but the result is still same.

    My board usb hardware infomation's PID is 0x3748, so my board is ST-Link/v2 for sure. 

    And I noticed that, the log said,

    '

    Info : STLINK v2 JTAG v25 API v2 SWIM v14 VID 0x0483 PID 0x3748'

    so it will connect as SWIM, but my project debug config has 

     'transport select 'hla_swd'

    that mean I think the config setting is SWD but the hardware is SWIM.

    If this is the problem, how can I change the config from SWD to SWIM? I tried to change the hla_swd to hla_swim, but when I build it, the swim character is change to swd automatically.  

    Nemui Trinomius
    Associate II
    June 21, 2017
    Posted on June 21, 2017 at 08:18

    Dear Takayoshi Ishii,

    You said 'that mean I think the config setting is SWD but the hardware is SWIM.',

    but ALL STLink/V2-1 in Nucleo uses SWD interface despite supporting JTAG/SWD/SWIM.

    Currently OpenOCD cfg's default SWD clock settings for L0 is too fast,

    so you need to reduce clock below 1000kHz.

    I met same problem STM32L053C8-Discovery,and avoid the error to reduce SWD clock.

    See my article for more information.

    http://nemuisan.blog.bai.ne.jp/?eid=222175

    Best Regards,

    Nemui.