TM STM32F4xx Libraries  v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
TM_USB_MSC_HOST

USB MSC HOST library for STM32F4xx devices - http://stm32f4-discovery.com/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/ - http://stm32f4-discovery.com/2014/08/library-29-usb-msc-host-usb-flash-drive-stm32f4xx-devices. More...

Modules

 TM_USB_MSC_HOST_Typedefs
 Library Typedefs.
 
 TM_USB_MSC_HOST_Functions
 Library Functions.
 

Detailed Description

USB MSC HOST library for STM32F4xx devices - http://stm32f4-discovery.com/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/ - http://stm32f4-discovery.com/2014/08/library-29-usb-msc-host-usb-flash-drive-stm32f4xx-devices.

This library allows you to read and write data to USB mass storage devices.

It works in USB FS or USB HS in FS mode.

By default, library works in USB FS mode (for STM32F4-Discovery board). If you want to use this on STM32F429-Discovery board, you have to activate USB HS in FS mode. Activate this with lines below in your defines.h file:

//Activate USB HS in FS mode
#define USE_USB_OTG_HS
Pinout
USB         |STM32F4xx FS mode              |STM32F4xx HS in FS mode    |Notes
            |STM32F4-Discovery              |STM32F429-Discovery
                
Data +      PA12                            PB15                        Data+ for USB, standard and used pin
Data -      PA11                            PB14                        Data- for USB, standard and used pin
ID          PA10                            PB12                        ID pin, used on F4 and F429 discovery boards, not needed if you don't like it
VBUS        PA9                             PB13                        VBUS pin, used on F4 and F429 discovery board for activating USB chip.
                                                                        You have to use VBUS on discovery boards, but on nucleo, it's ok with only Data+ and Data- pins

Disable necessary pins

USB technically needs only Data+ and Data- pins. Also, ID pin can be used, but it is not needed.

Disable ID PIN

If you need pin for something else, where ID is located, you can disable this pin for USB. Add lines below in your defines.h file:

//Disable ID pin
#define USB_MSC_HOST_DISABLE_ID

Disable VBUS PIN

VBUS pin is located on Discovery boards, to activate USB chip on board. If you are working with Discovery boards, then you need this pin, otherise USB will not work. But if you are working on other application (or Nucleo board), you only need Data+ and Data- pins. To disable VBUS pin, add lines below in your defines.h file:

//Disable VBUS pin
#define USB_MSC_HOST_DISABLE_VBUS

Now, we have initialized USB, we have to enable it for FATFS too. Open your project defines.h file and add line below to activate FatFS for USB.

//Activate FatFS library for USB communication
#define FATFS_USE_USB       1

Too see, how to use FatFS with USB, open file tm_stm32f4_fatfs.h and check it's manual


Changelog
 Version 1.0
  - First release
Dependencies
 - STM32F4xx
 - defines.h
 - USB HOST stack
 - TM FATFS library