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

JLink serial (ttyACM0 over usb) drops out, usb device re-enumerates but ttyACM isn't found

I'm using three nrf52840-dk's, from an ubuntu 16.04 x64 host. 

  • JLink v6.30b
  • nrfjprog v9.7.2

I can program and interact with two boards fine, with zero of the failures below.  However, the third board is having problems.  This may be the first time I've tried to use the board, and it's always possible there is a HW issue.  I'm hoping to understand what, if any, steps there may be to bring the board back (eg, is there FW on the Jlink or nrf52 side that could possibly be in a bad state that I could fix without scrapping the board).  I've tried different cables; also as mentioned my two other boards work fine.

The problems is that any attempt to write to the ttyACM cause the part to disconnect.

On the board I'm seeing issues:

  1. plug in via USB. 
    1. Enumerates fine as both Mass-storage (seems to work fine) and Abstract control module serial (/dev/ttyACM0).
  2. Run, for example:  
    1. `nrfjprog -f nrf52 -e --log`
  3. The next message on both `dmesg` and `/var/log/syslog` is: 
    1. "Usb disconnect"
  4. This is followed by the device re-enumerating ... BUT the ttyACM and filesystem do not come back
  5. I can unplug and re-plug the device, and my pc enumerates both the ttyACM and the mass-storage

nrfjprog log:

--------------------------------------------------------------------------------
nrfjprog -f 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 timed out - Can not execute firmware update'.
FUNCTION: close_dll.
FUNCTION: close_dll.
developer@7a2d4d5d225c:~/nRF5_tools/nrf5_sdk/examples/ble_peripheral/ble_app_hts/pca10056/s140/armgcc$ exit
exit

As above, immediately after executing the nrfjprog, the device disconnects, then re-enumerates (but, apparently in a problematic state as ttyACM0 doesn't return)

kernel: [1116808.385970] usb 1-5.1: USB disconnect, device number 64
udisksd[2229]: Cleaning up mount point /media/mike/JLINK1 (device 8:16 no longer exist)
kernel: [1116808.422544] FAT-fs (sdb): unable to read boot sector to mark fs as dirty
kernel: [1116808.654667] usb 1-5.1: new high-speed USB device number 65 using xhci_hcd
mtp-probe: checking bus 1, device 65: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.1"
mtp-probe: bus: 1, device: 65 was not an MTP device
kernel: [1116808.755452] usb 1-5.1: New USB device found, idVendor=1366, idProduct=0101
kernel: [1116808.755454] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: [1116808.755455] usb 1-5.1: Product: J-Link
kernel: [1116808.755455] usb 1-5.1: Manufacturer: SEGGER
kernel: [1116808.755456] usb 1-5.1: SerialNumber: 000683350409
wpa_supplicant[1618]: wlp2s0: CTRL-EVENT-SCAN-FAILED ret=-100

What can i do to triage / possibly fix this?

Parents
  • Hi,

    I suspect this might be the reason for the stability issues you're seeing:

    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 timed out - Can not execute firmware update'.

    Have you tried upgrading the fw using segger's "JLinkExe" program? If you installed their .deb package, it should be in your $PATH.

     

    Best regards,

    Håkon

  • It doesn't look like JLink knows about nrf52840 yet ??

    Side note - I have googled around several times for this, but cannot find any good/current docs/tutorials for the native Segger utilities.  I understand Nordic uses these under the hood .. but please if you need me to run them, pass me an appropriate command line.  Thank you!

    $ JLinkExe -device nrf52840 -if swd -speed 1000 
    > connect
    
    SEGGER J-Link Commander V6.30b (Compiled Feb  2 2018 18:38:58)
    DLL version V6.30b, compiled Feb  2 2018 18:38:53
    
    J-Link connection not established yet but required for command.
    Connecting to J-Link via USB...O.K.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 12 2018 16:05:20
    Hardware version: V1.00
    S/N: 683889153
    VTref = 3.300V
    The selected device "NRF52840" is unknown to this version of the J-Link software.
    
    Please make sure that at least the core J-Link shall connect to, is selected.
    Proper device selection is required to use the J-Link internal flash loaders
    for flash download or unlimited flash breakpoints.
    
    For some devices which require a special handling, selection of the correct device is important.
    No valid device has been selected.
    

  • Also, I just noticed a new Segger version has been released; v6.30c (above is v6.30b).

    The error is identical with the new revC

  • I had adapted the above JLinkExe command line from the script (I believe @Hakon) linked folks to in a different question, https://github.com/ssfrr/nrfjprog.sh/blob/master/nrfjprog.sh

    If i change the --device param from nrf52840 to just nrf52, the connect does work.  It appears that simple commands like reset do as well.

    What is the JLinkExe command to erase / re-flash the 52840?

    Thank you for your help.

  • Hi,

    Try connecting with device profile "nrf52840_xxaa".

    It looks like your firmware has already been updated successfully:

    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 12 2018 16:05:20

    You can now write "?" for help, and use commands like "loadfile /path/to/hex.hex" to program the device and "erase" to erase the flash.

    I suspect that nrfjprog will also work now that the fw has been updated.

    Cheers,

    Håkon

Reply
  • Hi,

    Try connecting with device profile "nrf52840_xxaa".

    It looks like your firmware has already been updated successfully:

    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 12 2018 16:05:20

    You can now write "?" for help, and use commands like "loadfile /path/to/hex.hex" to program the device and "erase" to erase the flash.

    I suspect that nrfjprog will also work now that the fw has been updated.

    Cheers,

    Håkon

Children
  • Hi Hakon - Re-running with the profile you suggest has slightly different output, but the same end-result of the device dropping off / re-enumerating on USB.   nrf52840_xxaa is recognized; connecting to it looks like it's trying to flash segger bits automatically (presumably this is fw on the seggar part; i'm not familiar with any of that)

    $ JLinkExe -device nrf52840_xxaa -if swd -speed 1000
    
    SEGGER J-Link Commander V6.30c (Compiled Feb  9 2018 17:22:34)
    DLL version V6.30c, compiled Feb  9 2018 17:22:28
    
    Connecting to J-Link via USB...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
    FAILED: Communication timed out - Can not execute firmware update
    J-Link>
    

  • Are you running linux in a VM or native?

    Have you tried running JLinkExe as root, or updating the firmware on a windows PC?

  • I've tried native-linux, and in a docker container with the necessary devices and permissions mapped. 

    FWIW, my normal workflow is from a docker container, as it makes tasks such as rolling new versions, sharing a consistent dev env amoung the team, and standing up automated test boxes trivial compared to local install.  From within a container, i've had no problem with other boards.

    I'll look around for a box i can install windows on.  Is there a preferred version?

  • I tracked down a windows PC, and installed Segger Embedded Studio latest (3,34) along with SDK 14.2.0

    Flashing and running the example works on both board-A (I wasn't having issues on linux with this board)  AND  on board-B.

    This made me curious if somehow the windows toolchain had put the board back into a good state ... so I tried both on linux again.

    • Board B: still fails, usb disconnect occurs, device re-enumerates but ACM doesn't come back without power cycle
    • Board A: programs/run as normal (no change)

    unfortunately i just switch to Win; I'll be using pc-ble-driver with a linux host plus other other Linux-specific work.

  • Since SES worked on Windows, i tried it on Linux.  I installed it in a docker container per usual

    • PITA as your installer does not support a text mode.  Can this please be submitted as a feature request?  All installers should support text mode.
    • Note also, since it's a gui program, X must be mapped in.  Obviously this doesn't leverage anything 'sandboxing' as in some container use cases - the reason we attempt to put tools in a container is, as mentioned earlier, repeatability, makes bringing new engineers/computers/test-nodes trivial

    Anyway, Both Board-A and Board-B flash and run find under SES Linux, in a container.

    What's the difference between these two flows?  nrf-commandline-tools using JLink differently than SES?  Definitely seems like a problem outside my machine .. although I'm not so sure about how i can make a "bug-jar" for you.

Related