Background: I am evaluating replacing an FTDI+FPGA+RAM with a Cortex chip and I am playing around with a LPC1768 dev card.
flashing LED? [x]
communications via a virtual comms port [x]
Now I am looking at communicating via libUSB (either CDC or HID… evaluating)
I started by trying this example: https://developer.mbed.org/cookbook/USBHID-bindings- & the USBHID_TestCase program compiles and runs.
The issue is on the python side (using the linux example & libUSB).
The 1st issue was the py script has:
mbed_vendor_id = 0x1234 mbed_product_id = 0x0006
equally the mbed USBDevice:USBHID has:
USBHID(uint8_t output_report_length = 64, uint8_t input_report_length = 64, uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0006, uint16_t product_release = 0x0001, bool connect = true);
ie the same product and vendor ID. However… lsusb lists the NXP chipset at a different location.
Bus 003 Device 008: ID 0d28:0204 NXP LPC1768
issuing: lsusb -vvv -d 0x0d28:0204 I can see 4 devices that this card exposes (good) and this is matched by a simple python testcase
import usb mbed_vendor_id = 0x0d28 mbed_product_id = 0x0204 dev = usb.core.find(idVendor=mbed_vendor_id,idProduct=mbed_product_id)
checking what dev is now populated with:
dev <CONFIGURATION 1: 500 mA> dev[(0,0)] <INTERFACE 0: Mass Storage>  <ENDPOINT 0x82: Bulk IN>  <ENDPOINT 0x2: Bulk OUT>  <ENDPOINT 0x0: Control OUT> dev[(1,0)] <INTERFACE 1: CDC Communication>  <ENDPOINT 0x83: Interrupt IN>  <ENDPOINT 0x0: Control OUT> dev[(2,0)] <INTERFACE 2: CDC Data>  <ENDPOINT 0x4: Bulk OUT>  <ENDPOINT 0x84: Bulk IN>  <ENDPOINT 0x0: Control OUT> dev[(3,0)] <INTERFACE 3: Human Interface Device>  <ENDPOINT 0x81: Interrupt IN>  <ENDPOINT 0x1: Interrupt OUT>  <ENDPOINT 0x0: Control OUT>
so 0 is mass storage -> the python script from the example wouldn’t work. I have been trying to communicate via dev[3,0] and by specifying an endpoint as dev[3,0] I can write but reads from dev[3,0] always return 0’s even though the mbed code is meant to provide a random data.
Any idea’s ?