Hi

I am developing a HID device on the STM32F102. My HID device sends input
reports and also has to process output reports from the host. The input
reports are 32 bytes and the output reports vary in length from 1-4 bytes

I based this code on the HID example & modified it to register a control
callback for class requests. That seems to work & I receive the reports
with the expected data.

I also registered a callback in the call to usbd_ep_setup(). There are a
lot more input reports sent than output reports received.

This all seems to work except for the input report sent immediately
after receiving an output report. In this case the data in the input
report is incorrect.

I have a USB analyser logging the data on the bus & what I see is
(packets truncated for clarity):

19 00 00 00 ...        32 byte Input Report (OK)

2A 00                  2  byte Output Report (OK)

2A 00 C3 C3 ...        32 byte Input Report (Bad - should be 19 00 ...)

19 00 00 00 ...        32 byte Input Report (OK)

19 00 00 00 ...        32 byte Input Report (OK)

19 00 00 00 ...        32 byte Input Report (OK)

2A 00                  2  byte Output Report (OK)

2A 00 C3 C3 ...        32 byte Input Report (Bad - should be 19 00 ...)

19 00 00 00 ...        32 byte Input Report (OK)

19 00 00 00 ...        32 byte Input Report (OK)

19 00 00 00 ...        32 byte Input Report (OK)

So it looks like the output report is overwriting the input report data.

Is it correct to use the register endpoint call back to generate the
report and write it to the endpoint? The code looks like this:

static void hid_data_tx_cb(usbd_device *usbd_dev, u8 ep)
{
        (void)ep;
        unsigned char InputReport[0x20];
        GetReport(InputReport);
        usbd_ep_write_packet(usbd_dev, 0x81, InputReport, 0x20);        
}

Has anybody else had problems like this?

Thanks

Karl



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
libopencm3-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

Reply via email to