From: Ramon <ram...@gm...> - 2013-12-02 18:42:40
|
I'm using libusb in Qt to communicate with a PIC microcontroller, 18F2550. The thing is that it's working OK until I try to send or read more than three bytes. Why does it happen? I've tried using bulk_read transfer and interrupt_read. When I put the size of the buffer equal or less than three, then the transmission works perfectly, using bulk or interrupt. When this size is greater than three, then I'm getting buffer1 and buffer[2] OK, but the rest are wrong. The error that I'm getting is from timeout. As input I'm using endpoint 0x81. More information: The return value from the bulk or interrupt read is -116. The numbers that I'm sending from the PIC to the PC in the two first bytes ([0] and [1]) in hex is 0x02D6. With this number, buffer[0] = -42 (when it should be 0xD6 = 214) and buffer[1] = 2 that is correct. In the [2] and [3] bytes the number is 0x033D, and I get [2] = 61 = 0x3D. That is correct and [3] = -42??? (like [0]). And the fifth byte is 1, and the SW shows 2???. Might it be a problem in the microcontroller, because I'm programming it as an HID USB? -- View this message in context: http://libusb.6.n5.nabble.com/Why-do-I-get-an-error-when-read-or-write-more-than-3-bytes-using-libusb-to-communicate-with-a-PIC-18-tp5712666.html Sent from the LibUSB Dev mailing list archive at Nabble.com. |