aboutsummaryrefslogtreecommitdiff
path: root/nuttx/configs/pic32mx7mmb
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-06-03 20:05:44 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-06-03 20:05:44 +0000
commit2d80d4285eb7805b7dc7b5fba590a9a5fb766651 (patch)
treeb8f7b119b13d5243084377e2e596ee43a2178843 /nuttx/configs/pic32mx7mmb
parentdf97ce92a49aafeeba1a9e51240d3b1ad33698e1 (diff)
downloadpx4-firmware-2d80d4285eb7805b7dc7b5fba590a9a5fb766651.tar.gz
px4-firmware-2d80d4285eb7805b7dc7b5fba590a9a5fb766651.tar.bz2
px4-firmware-2d80d4285eb7805b7dc7b5fba590a9a5fb766651.zip
PIC32 USB mass storage device works; USB and MSC are now enabled by default in the PIC32MX7 MMB configuration
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4801 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/configs/pic32mx7mmb')
-rw-r--r--nuttx/configs/pic32mx7mmb/README.txt85
-rw-r--r--nuttx/configs/pic32mx7mmb/nsh/appconfig52
-rw-r--r--nuttx/configs/pic32mx7mmb/nsh/defconfig6
-rw-r--r--nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h1
4 files changed, 96 insertions, 48 deletions
diff --git a/nuttx/configs/pic32mx7mmb/README.txt b/nuttx/configs/pic32mx7mmb/README.txt
index 197602c7a..4d9e42d11 100644
--- a/nuttx/configs/pic32mx7mmb/README.txt
+++ b/nuttx/configs/pic32mx7mmb/README.txt
@@ -579,22 +579,49 @@ Where <subdir> is one of the following:
CONFIG_PIC32MX_SPI1=y
CONFIG_NSH_ARCHINIT=y
- USB Configurations.
- ------------------
- Several USB device configurations can be enabled and included
- as NSH built-in built in functions. USB is *not* enabled by default.
+ The SD card can be mounted from the NSH command line as follows:
- To use USB device, connect the starter kit to the host using a cable
- with a Type-B micro-plug to the starter kit’s micro-A/B port J5, located
- on the bottom side of the starter kit. The other end of the cable
- must have a Type-A plug. Connect it to a USB host. Jumper JP2 should be
- removed.
+ nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard
+ nsh> ls -l /mnt/sdcard
+ /mnt/sdcard:
+ -rw-rw-rw- 16 ATEST.TXT
+ -rw-rw-rw- 21170 TODO
+ -rw-rw-rw- 22 ANOTHER.TXT
+ -rw-rw-rw- 22 HI2148.TXT
+ -rw-rw-rw- 16 HiFromNotePad.txt
- All USB device configurations require the following basic setup in
- your NuttX configuration file to enable USB device support:
+ USB Configurations.
+ ------------------
+ USB device support is enabled by default in this configuration.
+ The following settings are defined by default (and can be set
+ to 'n' to disabled USB device support).
CONFIG_USBDEV=y : Enable basic USB device support
CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
+ CONFIG_USBMSC=y : USB supports a mass storage device.
+
+ In this configuration, NSH will support the following commands:
+
+ msconn : Connect the mass storage device, exportint the SD
+ card as the USB mass storage logical unit.
+ msdis : Disconnect the USB mass storage device
+
+ NOTE: The SD card should *not* be mounted under NSH *and* exported
+ by the mass storage device!!! That can result in corruption of the
+ SD card format. This is the sequence of commands that you should
+ used to work the the SD card safely:
+
+ mount -t vfat /dev/mmcsd0 /mnt/sdcard : Mount the SD card initially
+ ...
+ umount /mnt/sdcard : Unmount the SD card before connecting
+ msconn : Connect the USB MSC
+ ...
+ msdis : Disconnect the USB MSC
+ mount -t vfat /dev/mmcsd0 /mnt/sdcard : Re-mount the SD card
+ ...
+
+ Other USB other device configurations can be enabled and
+ included as NSH built-in built in functions.
examples/usbterm - This option can be enabled by uncommenting
the following line in the appconfig file:
@@ -603,6 +630,7 @@ Where <subdir> is one of the following:
And by enabling one of the USB serial devices:
+ CONFIG_USBMSC=n : Disable USB mass storage device.
CONFIG_PL2303=y : Enable the Prolifics PL2303 emulation
CONFIG_CDCACM=y : or the CDC/ACM serial driver (not both)
@@ -613,12 +641,9 @@ Where <subdir> is one of the following:
and defining the following in your .config file:
+ CONFIG_USBMSC=n : Disable USB mass storage device.
CONFIG_CDCACM=y : Enable the CDCACM device
- examples/usbstorage - There are some hooks in the appconfig file
- to enable the USB mass storage device. However, this device cannot
- work until support for the SD card is also incorporated.
-
Networking Configurations.
--------------------------
Networking is enabled by default in this configuration:
@@ -714,34 +739,8 @@ Where <subdir> is one of the following:
NOTE: This modification should be considered experimental. IN the
little testing I have done with it, it appears functional. But the
logic has not been stressed and there could still be lurking issues.
-
- Update. The following was added to the top-level TODO list:
-
- Title: PIC32 USB DRIVER DOES NOT WORK WITH MASS STORAGE CLASS
- Description: The PIC32 USB driver either crashes or hangs when used with
- the mass storage class when trying to write files to the target
- storage device. This usually works with debug on, but does not
- work with debug OFF (implying some race condition?)
-
- Here are some details of what I see in debugging:
-
- 1. The USB MSC device completes processing of a read request
- and returns the read request to the driver.
- 2. Before the MSC device can even begin the wait for the next
- driver, many packets come in at interrupt level. The MSC
- device goes to sleep (on pthread_cond_wait) with all of the
- read buffers ready (16 in my test case).
- 3. The pthread_cond_wait() does not wake up. This implies
- a problem with pthread_con_wait(?). But in other cases,
- the MSC device does wake up, but then immediately crashes
- because its stack is bad.
- 4. If I force the pthread_cond_wait to wake up (by using
- pthread_cond_timedwait instead), then the thread wakes
- up and crashes with a bad stack.
-
- So far, I have no clue why this is failing.
- Status: Open
- Priority: High
+ (There is a bug associated with this configuration listed in the
+ top-level TODO list).
Adding LCD and graphics support to the nsh configuration:
--------------------------------------------------------
diff --git a/nuttx/configs/pic32mx7mmb/nsh/appconfig b/nuttx/configs/pic32mx7mmb/nsh/appconfig
index ebad7a87f..3479fd504 100644
--- a/nuttx/configs/pic32mx7mmb/nsh/appconfig
+++ b/nuttx/configs/pic32mx7mmb/nsh/appconfig
@@ -33,15 +33,54 @@
#
############################################################################
+############################################################################
# Path to example in apps/examples containing the user_start entry point
+############################################################################
CONFIGURED_APPS += examples/nsh
+############################################################################
# The NSH application library
+############################################################################
CONFIGURED_APPS += system/readline
CONFIGURED_APPS += nshlib
+############################################################################
+# USB device configurations
+############################################################################
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+
+# USB Mass Storage Class device configurations
+
+ifeq ($(CONFIG_USBMSC),y)
+ CONFIGURED_APPS += examples/usbstorage
+else
+
+# USB CDC/ACM serial device configurations
+
+ifeq ($(CONFIG_CDCACM),y)
+# Comment out to enable the examples/usbterm built-in
+ CONFIGURED_APPS += examples/cdcacm
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+#else
+
+# Prolifics PL2303 emulation configurations
+
+ifeq ($(CONFIG_PL2303),y)
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif # CONFIG_PL2303
+endif # CONFIG_CDCACM
+endif # CONFIG_USBMSC
+endif # CONFIG_PIC32MX_USBDEV
+
+############################################################################
+# Networking configurations
+############################################################################
+
# Networking libraries.
# Uncomment netutils/ftpc to include an FTP client library
# Uncomment netutils/ftpd to include an FTP server library
@@ -58,8 +97,7 @@ CONFIGURED_APPS += netutils/telnetd
endif
endif
-# Applications configured as an NX built-in commands
-
+# Networking applications configured as an NX built-in commands
# Uncomment examples/ftpc to include the FTP client example
# Uncomment examples/ftpd to include the FTP daemon example
@@ -68,6 +106,16 @@ ifeq ($(CONFIG_NET),y)
#CONFIGURED_APPS += examples/ftpd
endif
+############################################################################
+# Other Applications that can be configured as an NX built-in commands
+############################################################################
+
+# The I2C tool
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
# Uncomment to select a graphics example
ifeq ($(CONFIG_NX),y)
diff --git a/nuttx/configs/pic32mx7mmb/nsh/defconfig b/nuttx/configs/pic32mx7mmb/nsh/defconfig
index 9105e946e..8138fbd28 100644
--- a/nuttx/configs/pic32mx7mmb/nsh/defconfig
+++ b/nuttx/configs/pic32mx7mmb/nsh/defconfig
@@ -161,7 +161,7 @@ CONFIG_PIC32MX_FLASH=n
CONFIG_PIC32MX_BMX=n
CONFIG_PIC32MX_DMA=n
CONFIG_PIC32MX_CHE=n
-CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBDEV=y
CONFIG_PIC32MX_USBHOST=n
CONFIG_PIC32MX_CAN1=n
CONFIG_PIC32MX_CAN2=n
@@ -868,7 +868,7 @@ CONFIG_INPUT_STMPE811=n
# CONFIG_USBDEV_TRACE_NRECORDS
# Number of trace entries to remember
#
-CONFIG_USBDEV=n
+CONFIG_USBDEV=y
CONFIG_USBDEV_ISOCHRONOUS=n
CONFIG_USBDEV_DUALSPEED=n
CONFIG_USBDEV_SELFPOWERED=y
@@ -1008,7 +1008,7 @@ CONFIG_CDCACM_CONSOLE=n
# CONFIG_USBMSC_REMOVABLE
# Select if the media is removable
#
-CONFIG_USBMSC=n
+CONFIG_USBMSC=y
CONFIG_USBMSC_EP0MAXPACKET=64
CONFIG_USBMSC_EPBULKOUT=1
CONFIG_USBMSC_EPBULKIN=2
diff --git a/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h b/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h
index f44e04258..6c9987da9 100644
--- a/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h
+++ b/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h
@@ -41,6 +41,7 @@
****************************************************************************/
#include <nuttx/config.h>
+#include <nuttx/compiler.h>
/****************************************************************************
* Pre-Processor Definitions