BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: FT90X USBH BOMS Example - USBH_finalise() missing?  (Read 15413 times)

A.STARR@NIWA.CO.NZ

  • Newbie
  • *
  • Posts: 6
    • View Profile
FT90X USBH BOMS Example - USBH_finalise() missing?
« on: May 05, 2021, 03:40:16 AM »

Hi all,

I'm developing a product using the FT908 that serves as a bridge between a sensor (that emulates a USB flash drive) and an SDI-12 recorder. I need to be able to deactivate the USB host port, and I see there is a function in the documentation for doing this: USBH_finalise(). It has a prototype in the ft900_usbh.h header file, but the function itself is not in usbh.c. I've tried using sys_disable(sys_device_usb_host), but this doesn't seem to have any effect.

Can anyone shed any light here?

Thanks in advance!
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 770
    • View Profile
Re: FT90X USBH BOMS Example - USBH_finalise() missing?
« Reply #1 on: May 05, 2021, 04:57:18 PM »

Hello,

I checked this and also couldn't see the source code.

I will ask for this to be added into the APIs.

Something like the following sequence in USBH_finalise() would be required to deactivate the USB Host:

{
// Remove all devices/interfaces/endpoints from root hub.
usbh_hub_port_remove(NULL, 1);
usbh_hw_disable_int();
interrupt_detach(interrupt_usb_host);

CRITICAL_SECTION_BEGIN
               usbh_intr_xfer = 0;
               usbh_intr_port = 0;
CRITICAL_SECTION_END

// Clear Status Register
usbh_hw_clrsts();
usbh_hw_stop();
usbh_hw_reset();
sys_disable(sys_device_usb_host);
}

Please test this out and provide any feedback.
You can modify the source APIs to add this.
See BRT TN 002 Modifying FT9xx API Functions for details on how to do this.
Simply copy the source .c into your project and it will override the library version.

To activate the USB host port again, you would then perform USBH_initialise().

Best Regards,
BRT Community
Logged

A.STARR@NIWA.CO.NZ

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: FT90X USBH BOMS Example - USBH_finalise() missing?
« Reply #2 on: May 06, 2021, 01:53:28 AM »

Thanks very much, this worked fine.

Just a note: I had to enable the compliation of the usbh_hw_disable_int() function in usbh.c, by changing the preceding #if 0 to #if 1

Thanks again
Logged