cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID Barcode reader - keep disconnecting

Y CS
Associate II
Posted on August 15, 2017 at 12:27

Hi

I have a USB barcode reader that acts as HID keyboard. When I plug it in to a Windows 10 machine it identified as 'USB keyboard device' (under device Manager - keyboards) and works fine: if I open text file and scan codes - they are typed in to the text file as if I used a regular keyboard to type it in.

I have the STM32f4x9I-EVAL evaluation board and I built and run the USB_Host\HID_OS project for USBH-FS.

It is taken from 

STM32Cube_FW_F4_V1.16.0 

and I'm using it as it is without any configuration or code changes.

When I connect a Logitech USB keyboard to the eval board it works fine: show parameters and then shows the typed in keys on the display.

When I connect the barcode device, it seems to start working fine - it displays information communicated with it - Manufacturer, Product, Serial Number, etc... as can be seen in the attached picture, and identified as keyboard.

However, it right away disconnects (I verified the barcode reader is powered on)

When I dig into the drivers, it seems that the point of failure is in the USBH_Process (in USBH_core.c) under 'case HOST_CLASS_REQUEST:

The following call

status = phost->pActiveClass->Requests(phost);

returns status == USBH_BUSY endlessly until the device is disconnected.

When I examine the behavior of the same location with the working Logitech keyboard,  is also repeatedly returns  

USBH_BUSY but at some point it returns USBH_OK status and the state machine moves to HOST_CLASS state

Can I do any configuration changes (to the USB?) to make it work? is there any timeout somewhere I can increase?

Any idea of how to move on from here and what to debug/test in order to analyze this issue will be appreciated.

Thanks.

0 REPLIES 0