STM32 USB Host?

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

STM32 USB Host?

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 USB Host?

Post 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
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: STM32 USB Host?

Post by mobyfab »

Thas was a fast answer :)

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

Thanks !
billr
Posts: 12
Joined: Sun Feb 24, 2013 8:36 pm

Re: STM32 USB Host?

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 USB Host?

Post by Giovanni »

Hi,

Still no news about an USB host subsystem.

Giovanni
inca
Posts: 37
Joined: Mon Apr 22, 2013 12:08 am

Re: STM32 USB Host?

Post 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.
billr
Posts: 12
Joined: Sun Feb 24, 2013 8:36 pm

Re: STM32 USB Host?

Post 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.
inca
Posts: 37
Joined: Mon Apr 22, 2013 12:08 am

Re: STM32 USB Host?

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 USB Host?

Post 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
inca
Posts: 37
Joined: Mon Apr 22, 2013 12:08 am

Re: STM32 USB Host?

Post 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()
Post Reply