communicating with a LPC1768 as a HID via python -
background: evaluating replacing ftdi+fpga+ram cortex chip , playing around lpc1768 dev card.
flashing led? [x] communications via virtual comms port [x]
now looking @ communicating via libusb (either cdc or hid... evaluating)
i started trying example: https://developer.mbed.org/cookbook/usbhid-bindings- & usbhid_testcase program compiles , runs.
the issue on python side (using linux example & libusb).
the 1st issue py script has:
mbed_vendor_id = 0x1234 mbed_product_id = 0x0006
equally 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 same product , vendor id. however... lsusb lists nxp chipset @ different location.
bus 003 device 008: id 0d28:0204 nxp lpc1768
issuing: lsusb -vvv -d 0x0d28:0204 can see 4 devices card exposes (good) , matched 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 dev populated with:
dev[0] <configuration 1: 500 ma> dev[0][(0,0)] <interface 0: mass storage> [0] <endpoint 0x82: bulk in> [1] <endpoint 0x2: bulk out> [2] <endpoint 0x0: control out> dev[0][(1,0)] <interface 1: cdc communication> [0] <endpoint 0x83: interrupt in> [1] <endpoint 0x0: control out> dev[0][(2,0)] <interface 2: cdc data> [0] <endpoint 0x4: bulk out> [1] <endpoint 0x84: bulk in> [2] <endpoint 0x0: control out> dev[0][(3,0)] <interface 3: human interface device> [0] <endpoint 0x81: interrupt in> [1] <endpoint 0x1: interrupt out> [2] <endpoint 0x0: control out>
so 0 mass storage -> python script example wouldn't work. have been trying communicate via dev[0][3,0] , specifying endpoint dev[0][3,0][0] can write reads dev[0][3,0][1] return 0's though mbed code meant provide random data.
any idea's ?
the usb test case code uses usb controller on lpc1768 ic, not mbed board's interface chip. code uses pin 31 , 32 on mbed board. hope helps.
Comments
Post a Comment