ARM-software / CMSIS_5

CMSIS Version 5 Development Repository
http://arm-software.github.io/CMSIS_5/index.html
Apache License 2.0
1.33k stars 1.08k forks source link

LPC-Link2 Communication Issue with VirtualBox #613

Open philmcm opened 5 years ago

philmcm commented 5 years ago

Hi, Hoping for some assistance in rectifying an issue using LPC-Link2 with VirtualBox. Host: Pop!OS 18.04 LTS Guest OS: Ubuntu 16.04 Xenial under Vagrant.

Summary:

  1. The LPC-Link2 works correctly on the host Linux OS directly.
  2. The LPC-Link2 with CMSIS-DAP does NOT work correctly under VirtualBox.
  3. The LPC-Link2 with alternate JLink software works correctly under VirtualBox.
  4. Other DAPLINK interfaces (e.g. NXP Kinetis freedom boards) work correctly under VirtualBox.

I have taken USBMON captures at the host with both the non-VirtualBox (working) configuration and VirtualBox (not working) configurations. These are shown below. It looks like the DAP capability request is being sent from the VM but the LPC-Link2 will not respond correctly to it. In fact, the LPC-Link2 continues to send empty data until the board is disconnected.

Any help in rectifying or letting me know where to continue looking would be much appreciated. I'd be pleased to provide any additional info or additional testing as required.

On Local Linux (no VirtualBox)

phil@pop-os:~/kinetis$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 006: ID 1fc9:0090 NXP Semiconductors
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 2232:1024 Silicon Motion 
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

phil@pop-os:~/kinetis$ openocd -f interface/cmsis-dap.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (JTAG)
Info : CMSIS-DAP: FW Version = 1.10
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.

Communication works correctly. (ignore failure message, this is related to not setting interface speed in openocd. You can observe correct response to the "00f0" capability request below, the line starting with 000113, which inducates support for SWD and JTAG)

phil@pop-os:~/kinetis$ sudo cat /sys/kernel/debug/usb/usbmon/3u > ~/usb.novm.out 
phil@pop-os:~/kinetis$ cat ~/usb.novm.out 
ffff883b8ae52f00 3349649709 S Ii:3:006:1 -115:8 1024 <
ffff883b9c751540 3349708212 S Io:3:006:1 -115:8 64 = 00f00000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b9c751540 3349708738 C Io:3:006:1 0:8 64 >
ffff883b8ae52f00 3349708782 C Ii:3:006:1 0:8 1024 = 00011300 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b9c751540 3349708898 S Io:3:006:1 -115:8 64 = 02020000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52f00 3349709199 S Ii:3:006:1 -115:8 1024 <
ffff883b9c751540 3349709723 C Io:3:006:1 0:8 64 >
ffff883b8ae52f00 3349709780 C Ii:3:006:1 0:8 1024 = 02020000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b9c751540 3349709863 S Io:3:006:1 -115:8 64 = 00040000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52f00 3349710185 S Ii:3:006:1 -115:8 1024 <
ffff883b9c751540 3349710723 C Io:3:006:1 0:8 64 >
ffff883b8ae52f00 3349710780 C Ii:3:006:1 0:8 1024 = 0005312e 31300000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b9c751540 3349710864 S Io:3:006:1 -115:8 64 = 00ff0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52f00 3349711144 S Ii:3:006:1 -115:8 1024 <
ffff883b9c751540 3349711725 C Io:3:006:1 0:8 64 >
ffff883b8ae52f00 3349711781 C Ii:3:006:1 0:8 1024 = 00020004 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b9c751540 3349711867 S Io:3:006:1 -115:8 1024 = 00fe0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52f00 3349712147 S Ii:3:006:1 -115:8 1024 <
ffff883b9c751540 3349712753 C Io:3:006:1 0:8 1024 >
ffff883b8ae52f00 3349712784 C Ii:3:006:1 0:8 1024 = 00010400 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b9c751540 3349712821 S Io:3:006:1 -115:8 1024 = 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52f00 3349713136 S Ii:3:006:1 -115:8 1024 <
ffff883b9c751540 3349713751 C Io:3:006:1 0:8 1024 >
ffff883b8ae52f00 3349713781 C Ii:3:006:1 0:8 1024 = 108f0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b9c751540 3349713870 S Io:3:006:1 -115:8 1024 = 11000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52f00 3349714147 S Ii:3:006:1 -115:8 1024 <
ffff883b9c751540 3349714746 C Io:3:006:1 0:8 1024 >
ffff883b8ae52f00 3349714788 C Ii:3:006:1 0:8 1024 = 11ff312e 31300000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52f00 3349715232 S Ii:3:006:1 -115:8 1024 <
ffff883b8ae52f00 3349716642 C Ii:3:006:1 -2:8 0
phil@pop-os:~/kinetis$ 

In VirtualBox (but keeping USBMON in same position on the host)

On the VM

vagrant@ubuntu-xenial:~$ openocd -f interface/cmsis-dap.cfg
Open On-Chip Debugger 0.10.0+dev-00920-g6ea4372 (2019-06-23-11:11)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: CMSIS-DAP command CMD_INFO failed.

vagrant@ubuntu-xenial:~$ 

On the Host

phil@pop-os:~/kinetis$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 007: ID 1fc9:0090 NXP Semiconductors 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 2232:1024 Silicon Motion 
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
phil@pop-os:~/kinetis$ sudo cat /sys/kernel/debug/usb/usbmon/3u > ~/usb.vm.out
^C
phil@pop-os:~/kinetis$ wc -l ~/usb.vm.out
1006 /home/phil/usb.vm.out
phil@pop-os:~/kinetis$ head -30 ~/usb.vm.out
ffff883b8ae526c0 3916360551 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae52540 3916398115 S Io:3:007:1 -115:8 64 = 00f00000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffff883b8ae52540 3916398523 C Io:3:007:1 0:8 64 >
ffff883b8ae526c0 3916398633 C Ii:3:007:1 0:8 0
ffff883b94ed6b40 3916399999 S Ii:3:007:1 -115:8 1024 <
ffff883b94ed6b40 3916400637 C Ii:3:007:1 0:8 0
ffff883b8ae526c0 3916401993 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae526c0 3916402639 C Ii:3:007:1 0:8 0
ffff883b8ae52540 3916403941 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae52540 3916404671 C Ii:3:007:1 0:8 0
ffff883b8ae52840 3916405969 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae52840 3916406669 C Ii:3:007:1 0:8 0
ffff883b8ae52900 3916407959 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae52900 3916408708 C Ii:3:007:1 0:8 0
ffff883b8ae52e40 3916410056 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae52e40 3916410707 C Ii:3:007:1 0:8 0
ffff883b8ae520c0 3916412060 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae520c0 3916412633 C Ii:3:007:1 0:8 0
ffff883b8ae520c0 3916413934 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae520c0 3916414672 C Ii:3:007:1 0:8 0
ffff883b94ed6b40 3916416068 S Ii:3:007:1 -115:8 1024 <
ffff883b94ed6b40 3916416670 C Ii:3:007:1 0:8 0
ffff883b94ed60c0 3916417941 S Ii:3:007:1 -115:8 1024 <
ffff883b94ed60c0 3916418662 C Ii:3:007:1 0:8 0
ffff883b94ed6540 3916419899 S Ii:3:007:1 -115:8 1024 <
ffff883b94ed6540 3916420669 C Ii:3:007:1 0:8 0
ffff883b807dde40 3916421936 S Ii:3:007:1 -115:8 1024 <
ffff883b807dde40 3916422641 C Ii:3:007:1 0:8 0
ffff883b8ae520c0 3916423997 S Ii:3:007:1 -115:8 1024 <
ffff883b8ae520c0 3916424708 C Ii:3:007:1 0:8 0
phil@pop-os:~/kinetis$ 

The "jabberring" from the LPC-Link2 continues indefinitely and the capture file becomes very large, requires disconnection and reconnection to stop. The LPC-Link seems to have become stuck in some sort of loop as a result of the Capabilities request when sent from VirtualBox.

JonatanAntoni commented 5 years ago

Hi @philmcm,

we will take a look into the report you provided.

I'd suggest to get in touch with NXP as well because the specific LPC-Link2 software is not maintained by the CMSIS team.

Cheers, Jonatan