Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segger J-Link issue #96

Closed
DanieleNardi opened this issue Nov 15, 2021 · 9 comments
Closed

Segger J-Link issue #96

DanieleNardi opened this issue Nov 15, 2021 · 9 comments
Labels
question Further information is requested

Comments

@DanieleNardi
Copy link

I'm trying to share my Segger J-Link over USB to my WSL2 instance, but no success right now. The device appears in lsusb list. JLinkGDBServerCL just replies that the connection to J-Link failed then it asks me Connected correctly?.

I'm trying to debug on-chip application from WSL2 using Visual Studio Code.

Environment settings:
Host: Windows 10 Pro 21H1
WSL2 instance: Ubuntu 20.04 LST (5.10.60.1-microsoft-standard-WSL2)
J-link version 7.58a installed in WSL2 instance above.
arm toolchain: arm-none-eabi-8-2018-q4-major

VSCode launch.json configuration:

"name": "DVC TopRow Emerald Inventory",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceFolder}",
"armToolchainPath": "/opt/gcc-arm-none-eabi/bin",
"executable": "path/to/elf",
"serverpath": "/opt/SEGGER/JLink/JLinkGDBServerCLExe",
"servertype": "jlink",
"device": "MK10DX256xxx7",
"interface": "jtag",
"serialNumber": "proper serial number",
"runToMain": true,
"svdFile": "path/to/svd"
@dorssel
Copy link
Owner

dorssel commented Nov 15, 2021

Please provide the log of the server following: https://github.com/dorssel/usbipd-win/wiki/Troubleshooting

@DanieleNardi
Copy link
Author

Please provide the log of the server following: https://github.com/dorssel/usbipd-win/wiki/Troubleshooting

info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Windows\system32
info: UsbIpServer.ConnectedClient[1]
      Client 172.20.52.229 claimed device at 4-3 (USB\VID_1366&PID_0101\000050118073).

I get only these ones.

@dorssel
Copy link
Owner

dorssel commented Nov 15, 2021

Please run with usbipd server Logging:LogLevel:Default=Trace

@DanieleNardi
Copy link
Author

After I updated J-Link drivers on host side (j-link drivers now have same version), the connection worked, but the VSCode debugger still doesn't work.
Log in the attached file.
usbipdlog.txt

@dorssel
Copy link
Owner

dorssel commented Nov 15, 2021

There are no errors in that log. This means that usbipd-win was able to forward all USB requests without issue and there were more than 3000 requests. I think the problem is client side. Have a look if /var/log/syslog contains any information; you may have to install rsyslog first.

@dorssel dorssel added the question Further information is requested label Nov 29, 2021
@lzptr
Copy link

lzptr commented Dec 13, 2021

Hi @DanieleNardi,

I am currently working on it and I can debug with JLink + cortex-debug from within VSCode.
Did you copy the udev rules?
sudocp /opt/SEGGER/JLink/99-jlink.rules /etc/udev/rules.d/99-jlink.rules

I also have some problems with the udev service under WSL2+Ubuntu20.04.
After every reboot I need to restart the udev service with:

sudo service udev restart
sudo udevadm control --reload

Also this only works if you didn't already attach the USB device to WSL2. So you need to first restart the udev service and then attach the USB device. At least on my setup I have to do it.
But after that it works from within VSCode until you reboot the system, which is really cool.

@DanieleNardi
Copy link
Author

Very good to know!
Now I'm committed to another project, as soon as I can switch I'll try to get this thing working also for me.

Thank you!

@pearson
Copy link

pearson commented Feb 2, 2022

@RoboGnome :

I also have some problems with the udev service under WSL2+Ubuntu20.04. After every reboot I need to restart the udev service with:

sudo service udev restart
sudo udevadm control --reload

Thanks for this! I did not need to copy udev rules, but these two commands got my JLink working.

@dorssel
Copy link
Owner

dorssel commented Feb 11, 2022

WSL documentation has been updated with udev details. Closing.

@dorssel dorssel closed this as completed Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants