Versions Compared

Key

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

Table of Contents
maxLevel3
minLevel2
indent20px

...

On the target side, the user configures the application through the app_usbd_cfg.h file.   Table - Application Preprocessor Constants lists a few preprocessor constants that must be defined.

Anchor
Table - Application Preprocessor Constants
Table - Application Preprocessor Constants

Panel
borderWidth0
titleTable - Application Preprocessor Constants


Preprocessor ConstantsDescriptionDefault Value
APP_CFG_USBD_ENEnables µC/USB Device in the application.DEF_ENABLED
APP_CFG_USBD_MSC_ENEnables MSC in the application.DEF_ENABLED



If RAMDisk storage is used, ensure that the associated storage layer files are included in the project and configure the following constants located in app_usbd_cfg.h and listed in Table - RAM Disk Preprocessor Constants.

Anchor
Table - RAM Disk Preprocessor Constants
Table - RAM Disk Preprocessor Constants

Panel
borderWidth0
titleTable - RAM Disk Preprocessor Constants


Preprocessor ConstantsDescriptionDefault Value
USBD_RAMDISK_CFG_NBR_UNITSNumber of RAMDISK units.1
USBD_RAMDISK_CFG_BLK_SIZERAMDISK block size.512
USBD_RAMDISK_CFG_NBR_BLKSRAMDISK number of blocks.4096
USBD_RAMDISK_CFG_BASE_ADDRRAMDISK base address in memory. This constant is used to define the data area of the RAMDISK. If it is defined with a value different from 0, RAMDISK’s data area will be set from this base address directly. If it is equal to 0, RAMDISK’s data area will be represented as a table from the program’s data area.0



If µC/FS storage is used, ensure that the associated µC/FS storage layer files are included in the project and configure the following constants listed in Table - uC/FS Preprocessor Constants:

Anchor
Table - uC/FS Preprocessor Constants
Table - uC/FS Preprocessor Constants

Panel
borderWidth0
titleTable - uC/FS Preprocessor Constants


Preprocessor ConstantDescriptionDefault Value
APP_CFG_FS_ENEnables µC/FS in the applicationDEF_ENABLED
APP_CFG_FS_DEV_CNTFile system device count.1
APP_CFG_FS_VOL_CNTFile system volume count.1
APP_CFG_FS_FILE_CNTFile system file count.2
APP_CFG_FS_DIR_CNTFile system directory count.1
APP_CFG_FS_BUF_CNTFile system buffer count.(2 * APP_CFG_FS_VOL_CNT)
APP_CFG_FS_DEV_DRV_CNTFile system device driver count.1
APP_CFG_FS_WORKING_DIR_CNTFile system working directory count.0
APP_CFG_FS_MAX_SEC_SIZEFile system max sector size.512
APP_CFG_FS_RAM_NBR_SECFile system number of RAM sectors.8192
APP_CFG_FS_RAM_SEC_SIZEFile system RAM sector size.512
APP_CFG_FS_NBR_TESTFile system number of tests.10
APP_CFG_FS_IDE_ENEnables IDE device in file system.DEF_DISABLED
APP_CFG_FS_MSC_ENEnables MSC device in file system.DEF_DISABLED
APP_CFG_FS_NOR_ENEnables NOR device in file system.DEF_DISABLED
APP_CFG_FS_RAM_ENEnables RAM device in file system.DEF_ENABLED
APP_CFG_FS_SD_ENEnables SD device in file system.DEF_DISABLED
APP_CFG_FS_SD_CARD_ENEnables SD card device in file system.DEF_ENABLED



MSC Host Application

To test the µC/USB-Device stack with MSC, the user can use for instance the Windows Explorer as a USB Host application on a Windows PC.

When the device configured for the MSC demo is connected to the PC, Windows loads the appropriate drivers as shown in Figure - MSC Device Driver Detection on Windows Host.

Anchor
Figure - MSC Device Driver Detection on Windows Host
Figure - MSC Device Driver Detection on Windows Host

Panel
borderWidth0
titleFigure - MSC Device Driver Detection on Windows Host

MSC Device Driver Detection on Windows HostImage Added


Open a Windows Explorer and a removable disk appears as shown in Figure - MSC Device on Windows 7 Explorer. If the MSC demo is modified to configure a mass storage device composed of multiple logical units as shown in Listing - MSC Initialization, Windows Explorer will show a removable disk icon per logical unit.

Anchor
Figure - MSC Device on Windows 7 Explorer
Figure - MSC Device on Windows 7 Explorer

Panel
borderWidth0
titleFigure - MSC Device on Windows 7 Explorer

MSC Device on Windows 7 ExplorerImage Added


When you open the removable disk, if it is the first time the MSC device is connected to the PC and is not formatted, Windows will ask to format it to handle files on the mass storage. When formatting, choose the File System you want. In embedded systems, the most widespread file system is the FAT.

...

The MSC class supports the removable storage eject option offered by any major operating systems.  shows Figure - Windows Removable Storage Eject Option Example shows an example of Eject option available in Windows Explorer. When you right-click on the removable disk, you can choose the Eject option. Eject option will send to the mass storage device some special SCSI commands. The mass storage device will stop the access to the storage. Hence, Windows will modify the removable disk icon by removing the size information. If you double-click on the icon after the eject operation, Windows will display a message saying that no disk is inserted. After an eject operation, you cannot reactivate the removable media. The only way is to disconnect the device and reconnect it so that Windows will re-enumerate it and refresh the Windows explorer's content.

Anchor
Figure - Windows Removable Storage Eject Option Example
Figure - Windows Removable Storage Eject Option Example

Panel
borderWidth0
titleFigure - Windows Removable Storage Eject Option Example

Windows Removable Storage Eject Option ExampleImage Added