Page 1 of 2

STM32 USB Host?

Posted: Tue Sep 11, 2012 10:08 am
by mobyfab
Hi,

I was wondering, did anyone ever use the STM32's OTG USB as Host on ChibiOS?

There are a bunch of examples provided by ST but nothing on Chibi. Does even Chibi has support for the Host mode?

I was thinking about self programming using a USB flash stick via a bootloader, or connecting to FTDI's serial to USB chipsets.

Thanks.

Re: STM32 USB Host?

Posted: Tue Sep 11, 2012 10:32 am
by Giovanni
Hi,

ChibiOS does not support a host driver, it could be added but I still haven't analyzed the problem, so fa I am not sure about how a host-USB API should look like.

Giovanni

Re: STM32 USB Host?

Posted: Tue Sep 11, 2012 11:43 am
by mobyfab
Thas was a fast answer :)

I guess the only option is to use the FW lib right now.

Thanks !

Re: STM32 USB Host?

Posted: Mon Mar 04, 2013 12:15 am
by billr
It's been awhile since this topic was covered, so I thought I'd bring it forward and ask if OTG USB host was coming anytime soon. I have a need to connect a USB keyboard to one of the USB ports on a STM32F405 and would really rather not dive into the STM libraries to figure out how to get them working. A composite device with mass storage and HID would be ideal, but at this point I just need the host side of a HID interface.

Re: STM32 USB Host?

Posted: Mon Mar 04, 2013 8:58 am
by Giovanni
Hi,

Still no news about an USB host subsystem.

Giovanni

Re: STM32 USB Host?

Posted: Mon Apr 22, 2013 12:18 am
by inca
FWIW:
http://www.mikroe.com/news/view/565/new ... -released/

The libraries are hosted on libstock, here is the host mode version:
http://www.libstock.com/projects/view/5 ... st-library

I have just come across this after bringing it up in #chibios on freenode.org. Tectu mentioned there being a need for it after I asked how hard it would be to do the FATFS demo on a USB flash drive instead of SPI MMC SD card.

I am not sure what HCI(s) are implemented in the Mikroe library.

Re: STM32 USB Host?

Posted: Mon Apr 22, 2013 3:31 am
by billr
Thanks for the pointers. The libraries appear to be available only in binary form, compiled with the mikroC compiler. I don't know what the likelihood of being able to link them with gcc is. If source were available, it'd be a lot easier.

Re: STM32 USB Host?

Posted: Mon Apr 22, 2013 4:28 pm
by inca
My apologies regarding the broken libraries, that's what I get for writing a post with one foot out the door.

I would like to continue the discussion regarding a USB Host driver for ChibiOS. What HCI do we seek to implement first?

Can we borrow code from older BSD or Linux that makes sense for ChibiOS or at least as documentation for what functionality actually requires implementation for operation of host mode usb?

Cheers.

Re: STM32 USB Host?

Posted: Mon Apr 22, 2013 5:34 pm
by Giovanni
The implementation is not that important, the first step would be defining an API simple yet complete enough. Second step a reference implementation then several high level driver (mass storage, CDC etc).

Giovanni

Re: STM32 USB Host?

Posted: Mon Apr 22, 2013 10:14 pm
by inca
Here is a nice presentation slide deck by Hans Petter Selasky in 2010 on the FreeBSD USB Stack
This is the YouTube of the presentation for the slide deck. It is high-level and useful for the general to technical audience.
USBDI(9) Kernel Developer's Man Page for HPS's USB stack.

For the brave only, official Documents are here.

Excerpts from the slide deck:
USB has 4 quality of service categories for data transfer
● ISOCHRONOUS (fixed rate and no retransmit)
● INTERRUPT (fixed rate and retransmit)
● CONTROL (non-fixed rate and retransmit)
● BULK (non-fixed rate and retransmit)

Symmetric API for Host and Device mode and supported USB transfer types.

Code: Select all

● Blocking calls
  – usbd_transfer_setup()
    ● pre-allocation of resources yields
      – reduced execution latency
      – reduced CPU usage
  – usbd_transfer_unsetup()
  – usbd_transfer_drain()
● Non-blocking calls
  – usbd_transfer_start()
  – usbd_transfer_stop()