General Category > General Discussion

Clears a halt state from receiving usb host status "USBHOST_EP_HALTED"



I modified the sample code "USBHostHID.c" in project USBHostHID.

In my code, I want to scan data using barcode scanner first and then transmit the scanned data through SPI using VNC2. I wrote barcode scanner and SPI transmission into two functions. Barcode scanner function excutes first then spi function excutes after it. And then go back to barcode scanner function for scanning second data, then spi function for second data, and so on.

I can scan the first data successfully and transmit the first data via SPI interface successfully. When I scan the second data with barcode scanner during the first data transmission through SPI interface, it shows the message "USB Read Failed - code 0A
" after completing the first data transmission.

The usb status message 0x0A denotes "USBHOST_EP_HALTED". I looked over the documents "Vinculum II User Guide" and tryed to clear the halt state on the USB Host controller using the following codes:

hc_iocb.handle.ep = epCtrl;
hc_iocb.set = &desc_dev;
vos_dev_ioctl(hUSBHOST_1, &hc_iocb);

However, it doesn't work. Are there any suggestions to clear the halted endpoint in the USB Host Controller? Or anything that I missed or any configuration that I need to do?

Thank you for your kind help!



FTDI Community:
Hi Yvonne,

This can happen when the HID device is toggling DATA0/DATA1 without handshakes from the host. HID devices can do that sometimes, it’s even mentioned in the USB spec. You need to do a ClearFeature endpoint halt on the interrupt endpoint before reading it again.

In the code you are using to clear the halt state, the endpoint should be the interrupt endpoint instead of epCtrl in line 2. If you change this, it should clear the halted endpoint.

Best Regards

FTDI Community


[0] Message Index

Go to full version