Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3
minLevel2
indent20px

...

Copy the files from the application template and configuration folders into your application as illustrated in Figure - Copying Template Files 101318748.

Anchor
Figure - Copying Template Files
Figure - Copying Template Files

...

Modify the device configuration file (usbd_cfg.c) as needed for your application. See Listing - Device Configuration Template 101318748 below for details.

Anchor
Listing - Device Configuration Template
Listing - Device Configuration Template

...

Modify the driver configuration (usbd_dev_cfg.c) as needed for your controller. See Listing - Driver Configuration Template 101318748 below for details.

Anchor
Listing - Driver Configuration Template
Listing - Driver Configuration Template

...

Modify USB Application Initialization Code

Listing - App_USBD_Init() in app_usbd.c shows the code that you should modify based on your specific configuration done previously. You should modify the parts that are highlighted by the text in bold. The code snippet is extracted from the function App_USBD_Init() defined in app_usbd.c. The complete initialization sequence performed by App_USBD_Init() is presented in Listing - App_USBD_Init() in app_usbd.c.

Anchor
Listing - App_USBD_Init() in app_usbd.c
Listing - App_USBD_Init() in app_usbd.c

...

Panel
bgColor#f0f0f0

(1) Include the USB driver BSP header file that is specific to your board. This file can be found in the following folder: \Micrium\Software\uC-USB-Device\Drivers\<controller>\BSP\<board name>

(2) Initialize the USB device stack’s internal variables, structures and core RTOS port.

(3) Specify the address of the device configuration structure that you modified in the section "Modify Device Configuration".

(4) Specify the address of the Bus Event callbacks structure. See section Bus Event Callback Structure for more details on this structure.

(5) Specify the address of the driver’s API structure. The driver’s API structure is defined in the driver’s header file named usbd_drv_<controller>.h.

(6) Specify the address of the driver configuration structure that you modified in the section "Modify Driver Configuration".

(7) Specify the address of the driver’s BSP API structure. The driver’s BSP API structure is defined in the driver’s BSP header file named usbd_bsp_<controller>.h.

(8) If the device controller supports high-speed, create a high-speed configuration for the specified device.

...

First, include the following files in your project from the µC/USB-Device source code distribution, as indicated in Figure - µC/USB-Device Source Code.

Anchor
Figure - µC/USB-Device Source Code
Figure - µC/USB-Device Source Code

...

\Micrium\Software\uC-USB-Device-V4\

...

\Micrium\Software\uC-USB-Device-V4\Class\MSC\Storage\<storage name>

...

Panel
borderWidth0
titleTable - USB Class Application Configuration References


µC/USB-Device ClassApplication Configuration page
Audio ClassUsing the Audio Class Demo Application
Communications Device Class (CDC) Abstract Control Model (ACM)Using the ACM Subclass Demo Application
Communications Device Class (CDC) Ethernet Emulation Model (EEM)CDC EEM Demo Application
Human Interface Device Class (HID)Using the HID Class Demo Application
Mass Storage Class (MSC)Using the MSC Demo Application
Personal Healthcare Device Class (PHDC)Using the PHDC Demo Application
Vendor ClassUsing the Vendor Class Demo Application


...

Every USB class also needs to have certain constants defined to work correctly. Table - USB Class Configuration References101318748 presents the section to refer to based on the USB class.

...