Keil Logo

Technical Support

On-Line Manuals

RL-ARM User's Guide (MDK v4)

RL-RTX RL-FlashFS RL-TCPnet RL-CAN RL-USB RL-USB for USB Device Applications RL-USB Device Library RL-USB Device Features RL-USB Device Software Stack RL-USB Device Functions RL-USB Device Source Files RL-USB Device Configuration Audio Device (ADC) Options Communication Device (CDC) - ACM Options Human Interface Device (HID) Options Mass Storage Device (MSC) Options Create USB Device Applications Create ADC Applications Create CDC ACM Applications Create HID Applications Create MSC Applications Create Composite Applications Test USB Device Applications Compliance Tests Test HID Client Application RL-USB for USB Host Applications RL-USB Host Library RL-USB Host Features RL-USB Host Software Stack RL-USB Host Functions RL-USB Host Source Files RL-USB Host Configuration Host Controller Driver Selection Host Controller Driver Configuration Host Class Driver Selection Create USB Host Applications Create USB Host HID Applications HID_Kbd Example Create USB Host MSC Applications Create USB Host Class Driver RL-USB Host Constants and Structures Error constants Speed constants Transaction Packet Type constants Transaction Error Type constants USB Request Block structure (USBH_URB) Endpoint structure (USBH_EP) Driver Capabilites structure (USBH_HCI_CAP) Device Class Instance structure (USBH_DCI) Host Controller Instance structure (USBH_HCI) Host Controller Driver structure (USBH_HCD) USB Concepts USB Transfer Rates USB Network Basic Communication Model USB Protocol Control Transfer Interrupt Transfer Isochronous Transfer Bulk Transfer Descriptors Device Configuration Device Descriptor Configuration Descriptor Interface Descriptor Endpoint Descriptor Device Qualifier Descriptor Example Programs Library Reference Appendix

Create USB Host MSC Applications

Create USB Host MSC Applications shows how to create a USB Host application that supports the mass storage class using the RL-USB Library.

Include into the project and configure the following RL-USB Host Source Files:

  1. The USB library that matches the device core:
    USB_CM1.lib - for Cortex-M1 devices.
    USB_CM3.lib - for Cortex-M3 devices.
    USB_ARM_L.lib - for ARM7 or ARM9 devices.
  2. The FlashFile library that matches the device core:
    FS_CM3.lib - for Cortex-M3 devices.
    FS_ARM_L.lib - for ARM7 or ARM9 devices.
  3. usbh_ohci_device family.c - to configure the device hardware layer for devices with OHCI host controllers or usbh_device family.c - to configure the device hardware layer for devices with Custom host controllers.
  4. usb_config.c - to configure the USB system.
  5. File_Config.c - to configure the USB Flash Drive.
  6. fs_usbh_msc.c - to adapt the code to the application needs.
  7. main file.c - to initialize the USB Host from main().
    ..
    usbh_init(0);                                            // initialize USB Host Controller 0
    while(1) {
      ..
      usbh_engine(0);                                        // check for new devices
      ..
    }
    

Several µVision USB Host MSD projects can be used as a template for creating new USB Host MSD applications. The files can be edited directly or using the µVision Configuration Wizard.

  1. Copy all files from any folder \ARM\Boards\Vendor\Board\RL\USB\Host\MSD_File to a new folder and open the *.uvproj project with µVision.
  2. Open the file usb_config.c and enable USB Host x.

For USB Host devices that support OHCI:

  1. Select the option OHCI in Controller Interface.
    Config OHCI Controller
  2. In the Class Configuration section, set Mass Storage Device Class (MSC).
  3. Open the file usbh_ohci_device family.c and set the USB Host OHCI Settings.
    Config OHCI Settings

For USB Host devices that support a Custom USB Host Controller:

  1. Select the option Custom in Controller Interface.
    Config Custom Controller
  2. In the Class Configuration section, set Mass Storage Device Class (MSC).

Continue configuring the USB Flash Drive. Option details are explained in USB Flash Drive.

  1. Open the file File_Config.c, enable the option USB Flash Drive.
    USB Flash Drive
  2. Define the File System Cache size.
  3. Enable Default Drive [U0:].

Finally, modify the file fs_usbh_msc.c to suite the application requirements.

Note

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.