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

Flashing the nRF52 DK fails on Ubuntu VM

Hi Nordic Team,

I'm trying to setup a gcc/eclipse based environment according to gustavovelascoh.wordpress.com/.../ on Linux/Ubuntu 16.04.1 64Bit. The Ubuntu system lives in a VirtualBox (Version 5.2.8 r121009 (Qt5.6.2)) VM on a Windows 10 host. I've managed to get to step 1.4.1 at which the erase fails.

Here is information regarding nrfjprog and the generated .log file

$ nrfjprog -v
nrfjprog version: 9.7.2
JLinkARM.dll version: 6.22g

nrfjprog --family nRF52 -e
ERROR: JLinkARM DLL reported an error. Try again. If error condition
ERROR: persists, run the same command again with argument --log, contact Nordic
ERROR: Semiconductor and provide the generated log.log file to them.

--------------------------------------------------------------------------------
nrfjprog --family nRF52 -e --log
nrfjprog verion 9.7.2
--------------------------------------------------------------------------------
FUNCTION: open_dll.
FUNCTION: open_dll.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: enum_emu_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_with_snr.
FUNCTION: connect_to_emu_without_snr.
FUNCTION: enum_emu_snr.
Updating firmware:  J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 12 2018 16:05:20
Replacing firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12
JLinkARM.dll OpenEx returned error 'Communication timeout. Emulator did not re-enumerate.'.
FUNCTION: close_dll.
FUNCTION: close_dll.

I've created a USB handthrough (tried USB 1.1 and USB 3.0) for the JLink device and the drag'n'drop flashing of the blinky example works fine, as far as I can tell.

Output of lsusb:


Bus 001 Device 004: ID 1366:1015 SEGGER
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Output of dmesg:


[   76.126718] usb 1-1: new full-speed USB device number 3 using ohci-pci
[   76.607664] usb 1-1: config 1 interface 2 altsetting 0 endpoint 0x81 has invalid maxpacket 512, setting to 64
[   76.607671] usb 1-1: config 1 interface 2 altsetting 0 endpoint 0x2 has invalid maxpacket 512, setting to 64
[   76.607677] usb 1-1: config 1 interface 3 altsetting 0 endpoint 0x85 has invalid maxpacket 512, setting to 64
[   76.607683] usb 1-1: config 1 interface 3 altsetting 0 endpoint 0x6 has invalid maxpacket 512, setting to 64
[   76.627878] usb 1-1: New USB device found, idVendor=1366, idProduct=1015
[   76.627888] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   76.627896] usb 1-1: Product: J-Link
[   76.627903] usb 1-1: Manufacturer: SEGGER
[   76.627910] usb 1-1: SerialNumber: 000682979556
[   76.639263] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
[   76.658075] usb-storage 1-1:1.3: USB Mass Storage device detected
[   76.658337] scsi host3: usb-storage 1-1:1.3
[   77.702070] scsi 3:0:0:0: Direct-Access     SEGGER   MSD Volume       1.00 PQ: 0 ANSI: 4
[   77.704100] sd 3:0:0:0: Attached scsi generic sg2 type 0
[   77.720483] sd 3:0:0:0: [sdb] 21829 512-byte logical blocks: (11.2 MB/10.7 MiB)
[   77.745834] sd 3:0:0:0: [sdb] Write Protect is off
[   77.745838] sd 3:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[   77.770045] sd 3:0:0:0: [sdb] No Caching mode page found
[   77.770050] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[   77.989866]  sdb:
[   78.086032] sd 3:0:0:0: [sdb] Attached SCSI removable disk

I've copied the 99-jlink.rules to /etc/udev/rules.d/.

I then decided to run "sudo JLinkExe" to update the firmware separately, but it failed with the same error message as in the nrfjprog log.

I also tried to manually flash the latest firmware image found at www.nordicsemi.com/.../52275

I tried a newer version (6.30j) of JLink too, but with the same results ...

Information on the board itself:
nRF52 Dev Kit ( https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK )
PCA10040
1.2.1
2017.48

Any ideas on what I do wrong / should do different?

Best,

lhochstetter

Edit:
I should add that I connected the board "directly" through a USB cable, i.e. plugged in a USB cable in the appropriate port on the board.
/Edit

  • Update:

    I found a workaroud:

    I installed the JLink v630k software on the Win10 Host and it was able to flash the firmware without issues.

    The nrfjprog tool in the Ubuntu VM can now properly talk to the board as far as I can tell.

    I haven't figured out where the real issue lies.

    I can faintly recall a hackathon where I briefly worked with JLink, a Ubuntu VM, and a Nordic Dev Kit to program a Ruuvi Tag.  If I recall correctly I had similar issues (no connection from the JLink in the VM to the Nordic Dev Kit) because a driver wasn't properly loaded in the Ubuntu VM - unfortunately I don't remember the details of the fix.

  • Hi,

    I am not completely understanding how far you got at resolving this issue on your own, and how well the workaround you are mentioning is working. Running the development environment in a virtual machine is not something we are testing extensively, and Eclipse is not an officially supported development environment. You have to debug your own setup since it's a combination none of us here have been working with as far as I can tell. I will, of course, help you out to the best of my ability, so let me know how far you have gotten.

    For now, I wanted to show you the setup I am running when doing Linux work. I am not using Eclipse and nrfjprog, but rather running it all though JLink and Segger Embedded Studio. With the correct USB settings in VirtualBox, I am able to compile, flash and debug nRF5 devices connected through USB.

     

    Here is the setup I am running with examples of Segger Embedded studio debugging and JLink running as intended.

    Best regards,
    Rune Holmgren

  • Hi,

    and thanks for the input!

    About the workaround: it works fine i.e. using a "direct" (no hand through to the VM) connection to the nRF52 DevKit using the host Win10 in order to update the firmware.

    I've tested the "blinky" example using the VM (compiled using gcc and erased, flashed, and resetted using nrfjprog) and it works just fine!

    Best,

    lhochstetter

Related