arpruss / USBComposite_stm32f1

USB Composite library for STM32F1 (HID, Serial, MIDI and XBox360 controller)
Other
382 stars 76 forks source link

RawHid example #47

Closed nikthefix closed 4 years ago

nikthefix commented 4 years ago

Hi, Using Simple HID Write utility and other similar utilities I find that the looped back data are incremented by 1 - so if I send 01, 02, 03, 04 hex the maplemini sends back 02, 03, 03, 04.. I've looked through the libs and I can't see the source of this shift. Could you point me in the right direction? If I send buffered data one-way from maple to pc then all is fine so my issue seems to be maple reception of SET REPORT.

Thanks for the great work.

arpruss commented 4 years ago

Are you sending a packet of exactly 300 bytes?

nikthefix commented 4 years ago

I'm limited to 64 bytes for rx and tx buffers (Simple HID Write creates exception if buffers are set higher) and sending 64+1 reports. I've tried 4 byte reports too. I'm using Windows 10. Any unused report bytes are stuffed with '01' and not '00'.

Thanks

nikthefix commented 4 years ago

Additionally, all your other examples using any form of HID work perfectly for me.

nikthefix commented 4 years ago

Solved:

The problem was line 55 in the sketch

for (int i=0;i<RXSIZE;i++) buf[i]++;

It's not needed.

arpruss commented 4 years ago

Yes, this is intentional: it's to check that the host side isn't just listening to itself, but is actually receiving processed data from the other side.

nikthefix commented 4 years ago

Ah I see. Terrific. Thanks.

On Fri, Jan 17, 2020 at 6:43 PM arpruss notifications@github.com wrote:

Yes, this is intentional: it's to check that the host side isn't just listening to itself, but is actually receiving processed data from the other side.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arpruss/USBComposite_stm32f1/issues/47?email_source=notifications&email_token=AKUUVMMJJEESHZW7LZNFL2DQ6H365A5CNFSM4KHDAL5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJITJHQ#issuecomment-575747230, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKUUVMP34TUZUWJI2RQRPH3Q6H365ANCNFSM4KHDAL5A .