This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52 DK JLink debugging in ubuntu

Hi.

Quest to get the toolchain working under ubuntu continues.

I've done the eclipse and jlink config as explained in the nrf51 linux tutorial (with of course keeping mind that I should use 52 packages). I can make build under eclipse, but I cannot attach the device for debugging.


Message from Eclipse:

SEGGER J-Link GDB Server V5.10u Command Line Version

JLinkARM.dll V5.10u (DLL compiled Mar 17 2016 19:06:19)

-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      localhost only
Generate logfile:              off
Verify download:               on
Init regs on start:            on
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 nRF52
Target interface:              SWD
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
Connecting to J-Link failed. Connected correctly?
GDBServer will be closed...
Shutting down...

**************************

lsusb shows SEGGER device:

Bus 004 Device 002: ID 8087:8000 Intel Corp. 
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8008 Intel Corp. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader
Bus 001 Device 002: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
Bus 001 Device 010: ID 046d:c52e Logitech, Inc. MK260 Wireless Combo Receiver
Bus 001 Device 027: ID 1366:1015 SEGGER 
Bus 001 Device 006: ID 5986:0268 Acer, Inc 
Bus 001 Device 005: ID 8087:07dc Intel Corp. 
Bus 001 Device 014: ID 1199:a001 Sierra Wireless, Inc. 
Bus 001 Device 009: ID 0557:2221 ATEN International Co., Ltd Winbond Hermon
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

**************

dmesg:

[4510002.975124] usb 1-2: USB disconnect, device number 26
[4510003.007271] FAT-fs (sdb): unable to read boot sector to mark fs as dirty
[4510004.480854] usb 1-2: new high-speed USB device number 27 using xhci_hcd
[4510004.609642] usb 1-2: config 1 interface 1 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64
[4510004.609646] usb 1-2: config 1 interface 1 altsetting 0 bulk endpoint 0x4 has invalid maxpacket 64
[4510004.610019] usb 1-2: New USB device found, idVendor=1366, idProduct=1015
[4510004.610021] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[4510004.610023] usb 1-2: Product: J-Link
[4510004.610024] usb 1-2: Manufacturer: SEGGER
[4510004.610025] usb 1-2: SerialNumber: 000682343799
[4510009.615033] cdc_acm 1-2:1.0: ttyACM1: USB ACM device
[4510009.615719] usb-storage 1-2:1.3: USB Mass Storage device detected
[4510009.615849] scsi host17: usb-storage 1-2:1.3
[4510010.615899] scsi 17:0:0:0: Direct-Access     SEGGER   MSD Volume       1.00 PQ: 0 ANSI: 4
[4510010.616151] sd 17:0:0:0: Attached scsi generic sg2 type 0
[4510010.616352] sd 17:0:0:0: [sdb] 21829 512-byte logical blocks: (11.1 MB/10.6 MiB)
[4510010.616534] sd 17:0:0:0: [sdb] Write Protect is off
[4510010.616536] sd 17:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[4510010.616701] sd 17:0:0:0: [sdb] No Caching mode page found
[4510010.616703] sd 17:0:0:0: [sdb] Assuming drive cache: write through
[4510010.619531]  sdb:
[4510010.620405] sd 17:0:0:0: [sdb] Attached SCSI removable disk
[4510010.833404] systemd-hostnamed[7429]: Warning: nss-myhostname is not installed. Changing the local hostname might make it unresolveable. Please install nss-myhostname!

*******************************

To me it looks like it's a problem with the Jlink device being detected as SCSI device. I found an issue from '13 with 51 series board under linux with similar problem.

Any ideas how to solve this?

Parents
  • Hi,

    Since the Segger debugger includes a "drag and drop" drive for .hex files, it shall enumerate parts of it as a SCSI drive. I get the same print outs in my dmesg.

    It seems that it has some issues enumerating at your end:

    [4510004.609642] usb 1-2: config 1 interface 1 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64
    [4510004.609646] usb 1-2: config 1 interface 1 altsetting 0 bulk endpoint 0x4 has invalid maxpacket 64
    

    If you run JLinkExe from command line (should be in $PATH), it will force a firmware update if available. Could you try this (and ensure that it finishes properly) then power-cycle the board? Or maybe JlinkExe also have issues connecting to the board? If so, try to sudo it and see if that changes anything.

    Can you also ensure that the Segger udev rules are present? They should be located in /etc/udev/rules.d/99-jlink.rules and have atleast these three lines (will have many others, but this is the one for the nRF52-DK debugger):

    ACTION!="add", SUBSYSTEM!="usb_device", GOTO="jlink_rules_end"
    ATTR{idProduct}=="1015", ATTR{idVendor}=="1366", MODE="666"
    LABEL="jlink_rules_end"
    

    Cheers, Håkon

  • Ok, now the debugger works.

    HOX! NORDIC YOU NEED TO FIX THE FAMILY PACK 8.5.0!! HOX!

    Found ansver in the tutorial comments that some dude had to revert device family pack from 8.5.0 to 8.3.2 to get the debugger working. Also I had to change:

    Makefile CFLAGS += -Wall -Werror -O3 to CFLAGS += -Wall -Werror -O0 -g3
    Change the program counter from 0 to start of app (soft device starts from address 0) to (in my case) 0x1f000. This can be done in debug configurations -> GDB SEGGER J-Link Debugging -> you config -> startup page -> set program counter at -field.
    
Reply
  • Ok, now the debugger works.

    HOX! NORDIC YOU NEED TO FIX THE FAMILY PACK 8.5.0!! HOX!

    Found ansver in the tutorial comments that some dude had to revert device family pack from 8.5.0 to 8.3.2 to get the debugger working. Also I had to change:

    Makefile CFLAGS += -Wall -Werror -O3 to CFLAGS += -Wall -Werror -O0 -g3
    Change the program counter from 0 to start of app (soft device starts from address 0) to (in my case) 0x1f000. This can be done in debug configurations -> GDB SEGGER J-Link Debugging -> you config -> startup page -> set program counter at -field.
    
Children
No Data
Related