J-Link with Ubuntu Linux

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • J-Link with Ubuntu Linux

    Hi at all,

    I try using Segger J-Link with Ubuntu Linux. Unfortunately it isn't working correctly. An output of lsusb gives me the correct details about the device:

    Source Code

    1. Bus 002 Device 002: ID 1366:0101


    But the program JLinkExe ( version 4.58 ) reports that it cannot connect to J-Link via USB. The output of dmesg reports the following lines:

    Source Code

    1. [ 125.634515] usb 2-1: usbfs: USBDEVFS_CONTROL failed cmd JLinkExe rqt 128 rq 6 len 255 ret -110
    2. [ 127.631535] usb 2-1: usbfs: USBDEVFS_CONTROL failed cmd JLinkExe rqt 128 rq 6 len 255 ret -110
    3. [ 129.628752] usb 2-1: usbfs: USBDEVFS_CONTROL failed cmd JLinkExe rqt 128 rq 6 len 255 ret -110


    My udev settings are also correct I think:

    Source Code

    1. $ cat /etc/udev/rules.d/45-jlink.rules
    2. BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="kcontrol_rules_end"
    3. SYSFS{idProduct}=="0101", SYSFS{idVendor}=="1366", MODE="664", GROUP="plugdev"
    4. SYSFS{idProduct}=="0102", SYSFS{idVendor}=="1366", MODE="664", GROUP="plugdev"
    5. SYSFS{idProduct}=="0103", SYSFS{idVendor}=="1366", MODE="664", GROUP="plugdev"
    6. SYSFS{idProduct}=="0104", SYSFS{idVendor}=="1366", MODE="664", GROUP="plugdev"
    7. LABEL="kcontrol_rules_end"


    I also tried other udev-rules, found in this forum:

    Source Code

    1. SUBSYSTEM=="usb", ATTRS{idVendor}=="1366", ATTRS{idProduct}=="010[1234]", MODE="664", GROUP="plugdev


    So I hope that anybody can help me. I don't know exactly where the problem is located. It is not only the program JLinkExe which cannot connect to J-Link but also my IDE (CodeSourcery). The "funny" thing is that I was able to get it working two times (with approx. 50 trials, i.e. reboot reboot ...).

    Thanks for helping!
    Sebastian

    The post was edited 1 time, last by SebastianZ ().

  • Hi,

    Could you please try out V4.62 of the J-Link Linux package?
    In this version the 45-jlink.rules has been updated as well as some issues have been fixed.


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Sebastien,

    Seems to be a problem which is specific to your system configuration.
    We have A LOT of other users using J-Link under Linux (and many of them are using Ubuntu).
    So far, we do not see anything configured wrong in the information you provided.
    Maybe another user here has some idea what might be the problem in your system configuration?


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • I have seen this happening if there was something funny with the board. If you have another machine which can access the board, try doing a full erase for the flash and try again.

    To check if you're having permission issues, try using sudo.

    If either of those didn't work, running strace on JLinkExe will usually give you pretty good info. Type this (or modify the StartJLinkExe.sh script if you're using it)

    Source Code

    1. strace ./JLinkExe 2>strace.log


    Type exit as soon as jlinkexe fails to connect, and you should have a log in strace.log. Usually the last one or two ioctl calls before it starts talking about failure will tell you what is wrong. The ioctls return either 0 or a failure code you can google for, either standalone or in combination with the ioctl name. If you do not understand what I'm talking about and googling for it doesn't make you understand it, post the strace log here and someone will hopefully help you decipher the content.
  • I appear to have a similar issue. Recently the idProduct for my device changed from 0101 to 0104 and since I have been unable to connect.

    lsusb -v yields the following result:

    Source Code

    1. Bus 002 Device 004: ID 1366:0104 SEGGER
    2. Couldn't open device, some information will be missing
    3. Device Descriptor:
    4. bLength 18
    5. bDescriptorType 1
    6. bcdUSB 2.00
    7. bDeviceClass 0 (Defined at Interface level)
    8. bDeviceSubClass 0
    9. bDeviceProtocol 0
    10. bMaxPacketSize0 8
    11. idVendor 0x1366 SEGGER
    12. idProduct 0x0104
    13. bcdDevice 1.00
    14. iManufacturer 1
    15. iProduct 2
    16. iSerial 3
    17. bNumConfigurations 1
    18. Configuration Descriptor:
    19. bLength 9
    20. bDescriptorType 2
    21. wTotalLength 32
    22. bNumInterfaces 1
    23. bConfigurationValue 1
    24. iConfiguration 0
    25. bmAttributes 0xc0
    26. Self Powered
    27. MaxPower 100mA
    28. Interface Descriptor:
    29. bLength 9
    30. bDescriptorType 4
    31. bInterfaceNumber 0
    32. bAlternateSetting 0
    33. bNumEndpoints 2
    34. bInterfaceClass 255 Vendor Specific Class
    35. bInterfaceSubClass 255 Vendor Specific Subclass
    36. bInterfaceProtocol 255 Vendor Specific Protocol
    37. iInterface 0
    38. Endpoint Descriptor:
    39. bLength 7
    40. bDescriptorType 5
    41. bEndpointAddress 0x81 EP 1 IN
    42. bmAttributes 2
    43. Transfer Type Bulk
    44. Synch Type None
    45. Usage Type Data
    46. wMaxPacketSize 0x0040 1x 64 bytes
    47. bInterval 1
    48. Endpoint Descriptor:
    49. bLength 7
    50. bDescriptorType 5
    51. bEndpointAddress 0x02 EP 2 OUT
    52. bmAttributes 2
    53. Transfer Type Bulk
    54. Synch Type None
    55. Usage Type Data
    56. wMaxPacketSize 0x0040 1x 64 bytes
    57. bInterval 1
    Display All


    My strace log is attached strace_log.zip

    The post was edited 1 time, last by Starefossen ().