This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MDK450 USB HID Data Reports not working after link restore.

Previously I have been successfully using the USB Device HID code as featured in the
Keil Real time Library (RL ARM 4.22). I have been running our own data protocols sending 64 byte reports every 2ms. This has been done with the usbd_STM32F2xx_FS.c driver matching our Cortex processor.

We are now trying to upgrade to MDK450, which has different USB HID report handling.
I have managed to get the IN/OUT report data stream working by:-
a) Using the report type "USBD_HID_REQ_EP_INT" in the function usbd_hid_get_report().
b) Calling function usbd_hid_get_report_trigger(), once to enable the first report.

The problem I am having is the data path does not recover after a USB link disconnect/
re-connect sequence. After re-connection, the USB appears to connect up except the
IN Reports are All NAK'd on the USB Trace. This is the same as on startup, where
a call to function usbd_hid_get_report_trigger() allows the IN reports to work
correctly.

In the older versions of the USB HID RL code, the report processing continued after link
re-connect without any extra code or processing.

I have tried 2 approaches to data recovery:-
1) Detecting carrier recovery and calling function usbd_hid_get_report_trigger() once. (also trying various levels of reinitialisation).
2) Calling function usbd_hid_get_report_trigger() every n seconds to see if data recovers.

For a simple test, I used the Keil Demo project from:-
C:\Keil\ARM\Boards\Keil\MCBSTM32F200\RL\USB\Device\HID\HID.uvproj

I modified the Demo slightly to send a rolling count and call the function usbd_hid_get_report_trigger() every few seconds. The demo code did not recover from a link disconnect & recovery.

Has anyone had any success getting the MDK430 HID USB RL code to recover from link breaks?

Has anyone seen any further code documentation beyond the reference to the simple demo
mentioned above? (This only shows Async setup of IN Reports).

Parents
  • > In the older versions of the USB HID RL code, the report processing continued after link
    re-connect without any extra code or processing.

    It was done in this part of the code of older version.

    usbuser.c
    
    __task void USB_Core (void) {
    #if (USB_CONFIGURE_EVENT || USB_INTERFACE_EVENT || USB_FEATURE_EVENT)
      U16 evt;
    #endif
    
      for (;;) {
    
        os_evt_wait_or(0xFFFF, 0xFFFF);         /* Wait for an Event */
    
    #if (USB_CONFIGURE_EVENT || USB_INTERFACE_EVENT || USB_FEATURE_EVENT)
        evt = os_evt_get();                     /* Get Event Flags */
    #endif
    
    #if USB_CONFIGURE_EVENT
        if (evt & USB_EVT_SET_CFG) {
          if (USB_Configuration) {              /* Check if USB is configured */
            GetInReport();                                         // <------
            USB_WriteEP(HID_EP_IN, &InReport, sizeof(InReport));   // <------
          }
        }
    #endif
    ...
    

    I don't yet examine MDK450 examples, but I suppose similar code should be there.
    It is a good place to call usbd_hid_get_report_trigger() for the first report.

    Tsuneo

Reply
  • > In the older versions of the USB HID RL code, the report processing continued after link
    re-connect without any extra code or processing.

    It was done in this part of the code of older version.

    usbuser.c
    
    __task void USB_Core (void) {
    #if (USB_CONFIGURE_EVENT || USB_INTERFACE_EVENT || USB_FEATURE_EVENT)
      U16 evt;
    #endif
    
      for (;;) {
    
        os_evt_wait_or(0xFFFF, 0xFFFF);         /* Wait for an Event */
    
    #if (USB_CONFIGURE_EVENT || USB_INTERFACE_EVENT || USB_FEATURE_EVENT)
        evt = os_evt_get();                     /* Get Event Flags */
    #endif
    
    #if USB_CONFIGURE_EVENT
        if (evt & USB_EVT_SET_CFG) {
          if (USB_Configuration) {              /* Check if USB is configured */
            GetInReport();                                         // <------
            USB_WriteEP(HID_EP_IN, &InReport, sizeof(InReport));   // <------
          }
        }
    #endif
    ...
    

    I don't yet examine MDK450 examples, but I suppose similar code should be there.
    It is a good place to call usbd_hid_get_report_trigger() for the first report.

    Tsuneo

Children
  • Thanks for the input Tsuno.

    I sent a modified version of the MDK450 HID device demo App,
    which exhibited the problem, to Keil/ARM support.
    They came back with a fixed version of the USB library.
    (USB_CS3.lib file (25/04/1012)).

    My system now works OK. The new file should be in the next MDK release.