Anyone used JLink on Linux

  • Anyone used JLink on Linux

    I am trying to use the JLink Linux driver on Fedora 8 and I am unable to connect to the device
    J-Link>usb 0
    Connecting to J-Link via USB (Port: 0)
    Can not connect to J-Link via USB.
    J-Link>usb 1
    Connecting to J-Link via USB (Port: 1)
    Can not connect to J-Link via USB.
    J-Link>usb 2
    Connecting to J-Link via USB (Port: 2)
    Can not connect to J-Link via USB.
    J-Link>usb 3
    Connecting to J-Link via USB (Port: 3)
    Can not connect to J-Link via USB.
    J-Link>

    Any help suggestion would be appreciated.
  • Please be aware that J-Link for Linux has only beta status.

    I just tried it under Debian Linux w/o problems:

    J-Link>usb 0
    Connecting to J-Link via USB (Port: 0)
    Info: CP15.0.0: 0x41069265: ARM, Architecure 5TEJ
    Info: CP15.0.1: 0x1D152152: ICache: 16kB (4*128*32), DCache: 16kB (4*128*32)
    DLL version V3.75t, compiled Dec 10 2007 10:27:45
    Firmware: J-Link compiled Mar 3 2008 19:52:16 ARM Rev.5
    Hardware: V5.30
    S/N : 1
    Feature(s) : JFlash, RDI, FlashBP, FlashDL, GDB
    VTarget = 3.300V
    Info: TotalIRLen = 4, IRPrint = 0x01
    JTAG speed: 30 kHz
    Info: CP15.0.0: 0x41069265: ARM, Architecure 5TEJ
    Info: CP15.0.1: 0x1D152152: ICache: 16kB (4*128*32), DCache: 16kB (4*128*32)
    Found 1 JTAG device, Total IRLen = 4:
    Id of device #0: 0x07926031
    Found ARM with core Id 0x07926031 (ARM9)
    J-Link>


    Please ensure that USB is working correctly in your linux machine.
    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 was/am having the same problem on Ubuntu 7.10. It is a permissions problem with accessing the USB device. If I run the J-Link script as root (e.g. sudo ./start), I have no problems accessing the USB device. What is odd to me is that my current permissions give me read/write access to all my other USB devices, just not the J-Link. There is definitely a way to change the permissions to give normal users access to a particular device, I just don't know how to do it. Hope this helps.
  • The issues is that Ubuntu uses udev for USB device support. You need to create a udev rule that tells Linux what permissions to give the programmer when it is detected. First, use "lsusb -v" to get the Product ID and Vendor ID of the programmer. The device should be listed with an iManufacturer of "SEGGER" in the list. I'm using the SAM-ICE, so my idProduct is 0101 and my idVendor is 1366. Once you have these numbers you can create the rule. Make a file in /etc/udev/rules.d/ using this convention: 45-<name>.rules. I called my rule 45-samice.rules and it worked fine. The file must include the following information:

    Source Code

    1. BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="kcontrol_rules_end"
    2. SYSFS{idProduct}=="0101", SYSFS{idVendor}=="1366", MODE="664", GROUP="plugdev"
    3. LABEL="kcontrol_rules_end"


    You also need to ensure that you are in the group plugdev so that you have permissions for usb plugging with udev. The MODE can be changed if you like, just be sure to give owner and group full access.

    I hope this helps,
    Evan Buchanan
    Design Engineer
    Ciholas Technologies (ciholas.com)
  • Sorry to bring this back from the brink, but the info in this thread
    helped me successfully get the IAR version of the SEGGER J-Link working
    under Fedora 10.

    I have an x86_64 machine, so first I had to install libusb.i386

    Running the JLink software as root works regardless, so the issue was to get it running as a regular user.
    I took the above udev rule and modified it accordingly (notice the "usb_endpoint" and the RUN directive):

    Source Code

    1. BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_endpoint", GOTO="kcontrol_rules_end"
    2. SUBSYSTEM=="usb_endpoint", ATTRS{idProduct}=="0101", ATTRS{idVendor}=="1366", MODE="0666", GROUP="usbusergroup", RUN+="/usr/local/bin/chk_jlink"
    3. LABEL="kcontrol_rules_end"


    The 'RUN' directive is necessary to set /dev/bus/usb/PORT/ADDRESS permissions along with /dev/usb_endpointPORT.ADDRESS_epNN
    The script is as follows:

    Shell-Script

    1. #!/bin/bash
    2. GROUP="usbusergroup"
    3. # Get the bus directory
    4. BUS_DIR=`echo $DEVNAME | sed -e "s|/dev/usbdev\([0-9]*\).\([0-9]*\)_.*|\1 \2|" | awk '{printf "%03d/%03d",$1,$2}'`
    5. FULL_PATH=/dev/bus/usb/$BUS_DIR
    6. # Set permissions for FULL_PATH
    7. chgrp -f --preserve-root $GROUP $FULL_PATH
    8. chmod 0664 $FULL_PATH
    9. exit 0
    Display All


    Thanks again for all the help and good luck! :thumbsup:
    Piotrek