frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

NCS supporting new embedded device - what software is needed on the embedded device ?

Hi,

I'm wondering if there is some documentation around how to support a new embedded device (in my specific case a MIPS64 based architecture) to use the Movidius NCS. I'm fine with hosting all the development environment on a Ubuntu machine, but wondering what essential parts would need to be ported to an embedded system to add NCS support and being able to deploy and use a trained network?

Any pointer or advice would be highly appreciated.

Thanks
Andreas

Comments

  • 11 Comments sorted by Votes Date Added
  • Some experience sharing for to enable NCS on Nvidia TX2.
    1. First step, to build libmvnc.so.0 library. Go to directory ${NCSDK}/api/src and type make. The makefile is ready to use Ubuntu's ARM Gcc.
    2. Deploy ncs library and mvcmd file into TX2 system. Copy libmvnc.so.0 and MvNCAPI.mvcmd to /usr/local/lib/mvnc/ under TX2.
    3. Under TX2, create a soft-link of libmvnc.so.0 to /usr/local/lib/libmvnc.so
    4. Then, we can build hello_ncs_cpp to test the environment and NCS. The hello_ncs_cpp file can be build from ${NCSDK}/examples/apps/hello_ncs_cpp.

  • edited March 6 Vote Up0Vote Down

    Thanks for the pointers! I was able to get libmvnc and also the hello_ncs_cpp cross compiled for my embedded target platform.

    When plugging the NC-Stick to the target platform is shows in lsusb as:
    Bus 001 Device 008: ID 03e7:2150

    When I run the hello_ncs_cpp binary I'm getting the following error message after ~15-20 seconds:

    Error - Could not open NCS device.
    mvncStatus value: -2

    After that, lsusb shows the stick as:
    Bus 001 Device 009: ID 03e7:f63b

    What am I missing here? Any help is appreciated!

    Thanks
    Andreas

  • @Andreas Hi Andreas. The NCS initially enumerates as a USB 2.0 device. When the device is used, it re-enumerates as a USB 3.0 device. After it finishes doing whatever it is doing, it re-enumerates again as a USB 2.0 device.

    Here is my dmesg log from plugging in the NCS and run the hello_ncs_cpp binary. Note the idProduct numbers.

    [ 3173.450813] usb 1-2.1: new high-speed USB device number 17 using xhci_hcd
    [ 3173.551884] usb 1-2.1: New USB device found, idVendor=03e7, idProduct=2150
    [ 3173.551888] usb 1-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 3173.551891] usb 1-2.1: Product: Movidius MA2X5X
    [ 3173.551894] usb 1-2.1: Manufacturer: Movidius Ltd.
    [ 3173.551896] usb 1-2.1: SerialNumber: 03e72150
    [ 3177.200794] usb 1-2.1: USB disconnect, device number 17
    [ 3177.294967] usb 2-2.1: new SuperSpeed USB device number 10 using xhci_hcd
    [ 3177.315999] usb 2-2.1: New USB device found, idVendor=03e7, idProduct=f63b
    [ 3177.316002] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 3177.316003] usb 2-2.1: Product: VSC Loopback Device
    [ 3177.316004] usb 2-2.1: Manufacturer: Movidius
    [ 3177.316005] usb 2-2.1: SerialNumber: 1DF761CDF42613
    [ 3177.441123] usb 2-2.1: USB disconnect, device number 10
    [ 3177.570726] usb 1-2.1: new high-speed USB device number 18 using xhci_hcd
    [ 3177.675591] usb 1-2.1: New USB device found, idVendor=03e7, idProduct=2150
    [ 3177.675596] usb 1-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 3177.675599] usb 1-2.1: Product: Movidius MA2X5X
    [ 3177.675602] usb 1-2.1: Manufacturer: Movidius Ltd.

    Looking at your lsusb log, it seems like the NCS device successfully enumerates as a USB 2.0 device and re-enumerates as a USB 3.0 device. However it seems like an error occurs during the final step of re-enumerating as a USB 2.0 device. Can you post your dmesg log here? Thanks.

  • edited March 6 Vote Up0Vote Down

    Hi Tome,

    thanks for the quick answer - I just tried the steps again and got the following entries in the dmesg log:

        [2941935.021194] usb 3-1: new high-speed USB device number 2 using xhci-hcd
        [2941971.892826] usb 3-1: USB disconnect, device number 2
        [2941972.207432] usb 3-1: new high-speed USB device number 3 using xhci-hcd
    

    The first line, when the NC-Stick is connected the next line when starting the hello_ncs_cpp binary and the last line when the hello_ncs_cpp terminates.

    The platform I'm using is a mips64 router board with an OpenWRT derivative (Linux 3.10.20 kernel).

    To rule out any problem with the NC-Stick I was trying on a x86_64 Ubuntu 16.04 box and it works just fine. So there must be some problem in the usb handling ...

    Any idea how to narrow down the problem?

    Thanks again for your help!
    Andreas

  • @Andreas Strange that your dmesg log doesn't show the device switching over to USB 3.0 even though your device's post-crash idProduct from lsusb matched mine from my dmesg log.

    Try this: Go to your ncsdk/api/src folder. There should be a file called usb_boot.c. After line 49, add this debug line: libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_DEBUG);

    So the original is:

    void __attribute__ ((constructor)) usb_library_load()
    {
        initialized = !libusb_init(NULL);
    }
    

    After the change:

    void __attribute__ ((constructor)) usb_library_load()
    {
        initialized = !libusb_init(NULL);
        libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_DEBUG);
    }
    

    This may print out a lot of text, but if there is an issue with libusb, it should show up.

  • Thanks for the advise - I was able to generate the USB debuglog and also set the
    mvnc_loglevel to >2 to get some logs from the library as well.

    The mvnc log looks like this:

    Device 0 Address: 1 - VID/PID 03e7:2150
    Starting wait for connect with 2000ms timeout
    Found Address: 1 - VID/PID 03e7:2150
    Found EP 0x81 : max packet size is 512 bytes
    Found EP 0x01 : max packet size is 512 bytes
    Found and opened device
    Performing bulk write of 865724 bytes...
    Successfully sent 865724 bytes of data in 148.201078 ms (5.570936 MB/s)
    Boot successful, device address 1
    Found Address: 1 - VID/PID 03e7:f63b
    found, but cannot get status
    [...]

    The last two lines repeat ~2400 times and then the hello_ncs_cpp terminates with
    Error - Could not open NCS device.
    mvncStatus value: -2

    I copied the USB debuglog at the following link: https://1drv.ms/u/s!An0AFErUAIdRg5VC2-6epsDDtSH8-Q
    Please be aware that I kept the mvnc log messages in there as well - IMHO this helps to find the right parts of the extensive log ...

    On first glace, I was not seeing any error messages - so I'm wondering if there is anything I can do to tweak the USB handling to get the device to work ...

    One more thing - here the dmesg and lsusb output captured before starting the hello_ncp_cpp binary.

    `dmesg
    [3001786.557609] usb 3-1: new high-speed USB device number 24 using xhci-hcd
    
    :~/movidius# lsusb
    Bus 003 Device 024: ID 03e7:2150
    Bus 001 Device 001: ID 1d6b:0002
    Bus 002 Device 001: ID 1d6b:0003
    Bus 003 Device 001: ID 1d6b:0002
    Bus 004 Device 001: ID 1d6b:0003
    
    
    :~/movidius# ./hello_ncs_cpp 2> usbdebug.log
    Error - Could not open NCS device.
        mvncStatus value: -2
    root@R2AP001647:~/movidius# 
    `
    

    Thanks
    Andreas

  • @Andreas I could not see any obvious errors from that log. Can you try connecting a USB 2.0 hub to your system and connecting the NCS device to the hub?

  • @Tome_at_Intel - just tried a USB hub - no success :-(.

    While debugging some more and cross referencing with my development PC something dawned to me - my embedded target system is configured as big endian and the status values coming back from the NCS are little endian ...

    For example in the following line it's checking on the status of the NCS

    if (!usblink_getmyriadstatus(f, &status) && status == MYRIAD_WAITING) {

    reading the value in status through usb_read() from the NCS.
    MYRIAD_WAITING is defined as 0x22, while reading the status value from the NCS on the big endian system yields 0x22000000.

    Guess have to do some homework to find all those endian issues ...

    Thanks again for your help getting to the root cause ...!

  • @Andreas You're welcomed. If you find success with your project, please come back and let us know.

  • edited March 9 Vote Up0Vote Down

    It may be an incomplete opinion,
    USB 2.0/3.0 HUB = Is it a Self-Powered USB 2.0/3.0 hub?

  • My post was a complete mistake post.
    Ignore because POST can not be deleted.

Sign In or Register to comment.