Add USB host support for the STM3240G-EVAL board

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5069 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-08-30 18:18:47 +00:00
parent 607217ec79
commit ab421ce3ce
21 changed files with 579 additions and 193 deletions
+62 -3
View File
@@ -853,7 +853,7 @@ STM3240G-EVAL-specific Configuration Options
want to do that?
CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
debug. Depends on CONFIG_DEBUG.
CONFIG_STM32_USBHOST_PKTDUMP - Dump all incoming and outgoing USB
CONFIG_STM32_USBHOST_PKTDUMP - Dump all incoming and outgoing USB
packets. Depends on CONFIG_DEBUG.
Configurations
@@ -1028,8 +1028,67 @@ Where <subdir> is one of the following:
CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
CONFIG_STM32_SYSCFG - Needed
CONFIG_SCHED_WORKQUEUE - Worker thread support is required
9. This configuration requires that jumper JP22 be set to enable RS-232
9. USB OTG FS Host Support. The following changes will enable support for
a USB host on the STM32F4Discovery, including support for a mass storage
class driver:
CONFIG_USBDEV=n - Make sure tht USB device support is disabled
CONFIG_USBHOST=y - Enable USB host support
CONFIG_STM32_OTGFS=y - Enable the STM32 USB OTG FS block
CONFIG_STM32_SYSCFG=y - Needed for all USB OTF FS support
CONFIG_SCHED_WORKQUEUE=y - Worker thread support is required for the mass
storage class driver.
CONFIG_NSH_ARCHINIT=y - Architecture specific USB initialization
is needed for NSH
CONFIG_FS_FAT=y - Needed by the USB host mass storage class.
With those changes, you can use NSH with a FLASH pen driver as shown
belong. Here NSH is started with nothing in the USB host slot:
NuttShell (NSH) NuttX-x.yy
nsh> ls /dev
/dev:
console
null
ttyS0
After inserting the FLASH drive, the /dev/sda appears and can be
mounted like this:
nsh> ls /dev
/dev:
console
null
sda
ttyS0
nsh> mount -t vfat /dev/sda /mnt/stuff
nsh> ls /mnt/stuff
/mnt/stuff:
-rw-rw-rw- 16236 filea.c
And files on the FLASH can be manipulated to standard interfaces:
nsh> echo "This is a test" >/mnt/stuff/atest.txt
nsh> ls /mnt/stuff
/mnt/stuff:
-rw-rw-rw- 16236 filea.c
-rw-rw-rw- 16 atest.txt
nsh> cat /mnt/stuff/atest.txt
This is a test
nsh> cp /mnt/stuff/filea.c fileb.c
nsh> ls /mnt/stuff
/mnt/stuff:
-rw-rw-rw- 16236 filea.c
-rw-rw-rw- 16 atest.txt
-rw-rw-rw- 16236 fileb.c
To prevent data loss, don't forget to un-mount the FLASH drive
before removing it:
nsh> umount /mnt/stuff
11. This configuration requires that jumper JP22 be set to enable RS-232
operation.
nsh2: