My fix for: "No emulators connected via USB":
The solution took me hours to figure out. Hopefully this post will help others with a similar problem.
Specifications:
- Windows 10 Version 1607
- J-Link EDU Version 10.1 (16-45) Part No 8.08.90
- SEGGER J-Link Commander V6.14b (Compiled Mar 9 2017 08:46:23)
- Firmware: J-Link V10 compiled Jan 9 2017 17:48:51
- Hardware version: V10.10
- Visual Studio 2017
- Visual GDB 5.2.14.1389
- STM32 Smart V2.0 (STMF103C8T6) target board
I found that using VisualGDB to connect to my STM32 for some single-step debugging with OpenOCD was the cause.
The J-Link is properly detected, even with the wrong USB drivers in VisualGDB:
Upon testing OpenOCD connection in Visual Studio w/VisualGDB, this message will pop up, wanting to change the USB drivers:
Not changing the drivers... well, no debugging will be available in Visual Studio. Changing the drivers will make OpenOCD happy in VisualGDB:
But I had setup VisualGDB weeks, perhaps months ago. And that change only occurs once.
These alternate drivers used by OpenOCD in VisualGDB are apparently not at all compatible with the Segger J-Link utilities. Trying to run jlink.exe results in the completely useless error message "No emulators connected via USB":
Unfortunately, a simple re-install of the Segger Software, Utilities and USB driver does not solve the problem. Even the uninstall of Segger software and USB drivers, reboot, run CCleaner, reboot, re-install, reboot does not help.
Oddly, when re-installing the Segger software...
(be sure USB driver is checked, it was checked s default for me)
...my J-Link shows up as a COM port that does not work with either J-Link utilities nor VisualGDB:
Manually installing a specific USB driver gives a "Driver not signed" error.
Besides, I have no clue which should be installed anyhow (64 bit or 32 bit or JLinkCDC.inf or JLink.inf)....
So you'll need to first uninstall AND DELETE the existing drivers:
If you don't delete the old drivers Windows will tell you the proper drivers are already installed (despite the fact that the J-Link does not work at all with Segger utilities nor VisualGDB when configured as a COM port).
Next, unplug (if still plugged in) and re-plug the J-Link back into a USB port. If your computer *still* does not recognize the device properly (read: if Segger utilities still think it is not connected), go to Device Manager, right click on the J-Link COM port, and select "Browse my computer" to the install location of the INF files:
And use the path of your Segger install. In my case this is:
C:\PROGRAM FILES (X86)\SEGGER\JLINK_V614B\USBDRIVER\
That should get your Segger utilities working again. Alas the J-Link won't work with VisualGDB anymore... and if you change the USB drivers to make it work, well... start the process all over again. :)
Some additional information:
There's an awesome tool out there called zadig that sees the J-Link like this when it works with the Segger utilities:
Note the "jlink" driver.
Here's what zadig shows when the J-Link is working with VisualGDB:
Note the change from "jlink" to "WINUSB".
Too bad that the list of drivers available in zadig does not include this jlink driver. Once it is changed, I have no idea how to put it back with zadig.
Really the solution should be on the Segger side - the same way that VisualGDB says "hey, I see your device but the wrong USB driver is being used, would you like to change it?". Or even better: simply work with the standard WINUSB driver.
My hope is that the folks at Segger and Sysprogs (the makers of VisualGDB) will cooperate and make switching between environments a little less painful. :)
In any case - this was my solution to "No emulators connected via USB" for the J-Link JTAG debugger.
Note that I have more information on this topic in my next post here:
http://gojimmypi.blogspot.com/2017/03/more-on-segger-j-link-and-visualgdb.html
Really helpful, thank you!
ReplyDelete