FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: Clears a halt state from receiving usb host status "USBHOST_EP_HALTED"  (Read 13063 times)

Yvonne

  • Newbie
  • *
  • Posts: 12
    • View Profile

Hello,

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.ioctl_code = VOS_IOCTL_USBHOST_DEVICE_CLEAR_HOST_HALT;
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!

Yvonne



 
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: Clears a halt state from receiving usb host status "USBHOST_EP_HALTED"
« Reply #1 on: November 29, 2022, 01:57:33 PM »

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
Logged