summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-03-14 12:35:17 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-03-14 12:35:17 -0600
commite7017b30ce181934cb79c1aa0b8d27e9f26659a9 (patch)
tree143d9f8f8f2d8b12c51c19b9317dc479bf158a84
parent52c35c351f39bb7e95753364b9d758effaac9178 (diff)
downloadnuttx-e7017b30ce181934cb79c1aa0b8d27e9f26659a9.tar.gz
nuttx-e7017b30ce181934cb79c1aa0b8d27e9f26659a9.tar.bz2
nuttx-e7017b30ce181934cb79c1aa0b8d27e9f26659a9.zip
SAM4E-EK: NSH configuration now has DMA-based SPI and AT25 Serial FLASH suported enabled by default
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/configs/sam4e-ek/README.txt99
-rw-r--r--nuttx/configs/sam4e-ek/nsh/defconfig55
3 files changed, 146 insertions, 12 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 058a62a3d..90d9e0851 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -6998,4 +6998,6 @@
HSMCI block driver (2014-3-13).
* arch/arm/src/sam34/sam_dmac.c and sam_spi.c: Fixes to DMA in general
and to SPI in particular (2014-3-14).
- \ No newline at end of file
+ * configs/sam4e-ek/nsh: DMA-based SPI and a FAT file system on the
+ AT25 Serial FLASH are now supported by default in the NSH configuration
+ (2014-3-14).
diff --git a/nuttx/configs/sam4e-ek/README.txt b/nuttx/configs/sam4e-ek/README.txt
index d8e7669fa..d1b8af274 100644
--- a/nuttx/configs/sam4e-ek/README.txt
+++ b/nuttx/configs/sam4e-ek/README.txt
@@ -20,6 +20,7 @@ Contents
- LEDs
- Serial Console
- Networking Support
+ - AT25 Serial FLASH
- SAM4E-EK-specific Configuration Options
- Configurations
@@ -343,8 +344,8 @@ Serial Console
By default serial console is configured for 115000, 8-bit, 1 stop bit, and
no parity.
-Networking
-==========
+Networking Support
+==================
Networking support via the can be added to NSH by selecting the following
configuration options.
@@ -502,6 +503,89 @@ Networking
a network because additional time will be required to fail with timeout
errors.
+AT25 Serial FLASH
+=================
+
+ Connections
+ -----------
+
+ Both the SAM4E-EK include an Atmel AT25DF321A, 32-megabit, 2.7-volt
+ SPI serial flash. The SPI
+ connection is as follows:
+
+ ------ ------- ---------------
+ SAM4E AT25 SAM4E
+ GPIO PIN FUNCTION
+ ------ ------- ---------------
+ PA13 SI MOSI
+ PA12 SO MIS0
+ PA14 SCK SPCK
+ PA5 /CS NPCS3 (pulled high externally)
+ ------ ------- ---------------
+
+ Configuration
+ -------------
+
+ Support for the serial FLASH can be enabled in these configurations. These
+ are the relevant configuration settings. These settings (1) Enable SPI0,
+ (2) Enable DMAC0 to support DMA transfers on SPI for best performance,
+ (3) Enable the AT25 Serial FLASH, and (3) Set up NuttX to configure the
+ file system on the AT25 FLASH:
+
+ System Type -> ATSAM3/4 Peripheral Support
+ CONFIG_SAM34_SPI0=y : Enable SPI0
+ CONFIG_SAM34_DMAC0=y : Enable DMA controller 0
+
+ System Type -> SPI device driver options
+ CONFIG_SAM34_SPI_DMA=y : Use DMA for SPI transfers
+ CONFIG_SAM34_SPI_DMATHRESHOLD=4 : Don't DMA for small transfers
+
+ Device Drivers -> SPI Driver Support
+ CONFIG_SPI=y : Enable SPI support
+ CONFIG_SPI_EXCHANGE=y : Support the exchange method
+
+ Device Drivers -> Memory Technology Device (MTD) Support
+ CONFIG_MTD=y : Enable MTD support
+ CONFIG_MTD_AT25=y : Enable the AT25 driver
+ CONFIG_AT25_SPIMODE=0 : Use SPI mode 0
+ CONFIG_AT25_SPIFREQUENCY=20000000 : Use SPI frequency 12MHz
+
+ The AT25 is capable of operation at 20MHz. However, if you experience
+ any issues with the AT25, then lower this frequency may give more
+ predictable performance.
+
+ File Systems -> FAT
+ CONFIG_FS_FAT=y : Enable and configure FAT
+ CONFIG_FAT_LCNAMES=y : Upper/lower case names
+ CONFIG_FAT_LFN=y : Long file name support (See NOTE)
+ CONFIG_FAT_MAXFNAME=32 : Limit filename sizes to 32 bytes
+
+ NOTE: Use care if you plan to use FAT long file name feature in a product;
+ There are issues with certain Microsoft patents on the long file name
+ technology.
+
+ Application Configuration -> NSH Library
+ CONFIG_NSH_ARCHINIT=y : NSH board-initialization
+
+ Board Selection
+ CONFIG_SAM4EEK_AT25_AUTOMOUNT=y : Mounts AT25 for NSH
+ CONFIG_SAM4EEK_AT25_FTL=y : Create block driver for FAT
+
+ You can then format the AT25 FLASH for a FAT file system and mount the
+ file system at /mnt/at25 using these NSH commands:
+
+ nsh> mkfatfs /dev/mtdblock0
+ nsh> mount -t vfat /dev/mtdblock0 /mnt/at25
+
+ Then you an use the FLASH as a normal FAT file system:
+
+ nsh> echo "This is a test" >/mnt/at25/atest.txt
+ nsh> ls -l /mnt/at25
+ /mnt/at25:
+ -rw-rw-rw- 16 atest.txt
+ nsh> cat /mnt/at25/atest.txt
+ This is a test
+
SAM4E-EK-specific Configuration Options
=======================================
@@ -793,7 +877,12 @@ Configurations
CONFIG_NSH_DHCPC=y : Tells NSH to use DHCPC, not
: the fixed addresses
- 4. This configuration has been used for verifying the touchscreen on
+ 4. This configuration has the DMA-based SPI0 and AT25 Serial FLASH
+ support enabled by default. This can be easily disabled or
+ reconfigured (See see the configuration settings and usage notes
+ above in the section entitled "AT25 Serial FLASH").
+
+ 5. This configuration has been used for verifying the touchscreen on
on the SAM4E-EK LCD. With these modifications, you can include the
touchscreen test program at apps/examples/touchscreen as an NSH built-in
application. You can enable the touchscreen and test by modifying the
@@ -837,7 +926,7 @@ Configurations
CONFIG_DEBUG_VERBOSE=y : Enable verbose debug output
CONFIG_DEBUG_INPUT=y : Enable debug output from input devices
- 4. Enabling HSMCI support. The SAM3U-KE provides a an SD memory card
+ 6. Enabling HSMCI support. The SAM3U-KE provides a an SD memory card
slot. Support for the SD slot can be enabled with the following
settings:
@@ -868,3 +957,5 @@ Configurations
has been verified. HSMCI and touchscreen have not been tested (the
above notes came from the SAM3U-EK and have not been yet been tested
on the SAM4E-EK).
+ 2014-3-14: The DMA-based SPI appears to be functional and can be used
+ to support a FAT file system on the AT25 Serial FLASH.
diff --git a/nuttx/configs/sam4e-ek/nsh/defconfig b/nuttx/configs/sam4e-ek/nsh/defconfig
index 7add460a3..22c2c0b7f 100644
--- a/nuttx/configs/sam4e-ek/nsh/defconfig
+++ b/nuttx/configs/sam4e-ek/nsh/defconfig
@@ -188,7 +188,8 @@ CONFIG_ARCH_CHIP_SAM4E=y
# CONFIG_SAM34_CMCC is not set
# CONFIG_SAM34_DACC is not set
# CONFIG_SAM34_EIC is not set
-# CONFIG_SAM34_DMAC0 is not set
+CONFIG_SAM34_DMAC0=y
+# CONFIG_SAM34_DMAC1 is not set
CONFIG_SAM34_EMAC=y
# CONFIG_SAM34_HSMCI is not set
# CONFIG_SAM34_NAND is not set
@@ -197,7 +198,7 @@ CONFIG_SAM34_EMAC=y
# CONFIG_SAM34_RTC is not set
# CONFIG_SAM34_RTT is not set
# CONFIG_SAM34_SMC is not set
-# CONFIG_SAM34_SPI0 is not set
+CONFIG_SAM34_SPI0=y
# CONFIG_SAM34_TC0 is not set
# CONFIG_SAM34_TC1 is not set
# CONFIG_SAM34_TC2 is not set
@@ -231,6 +232,12 @@ CONFIG_SAM34_USART1=y
#
#
+# AT91SAM3/4 SPI device driver options
+#
+CONFIG_SAM34_SPI_DMA=y
+CONFIG_SAM34_SPI_DMATHRESHOLD=4
+
+#
# AT91SAM3/4 EMAC device driver options
#
CONFIG_SAM34_EMAC_NRXBUFFERS=16
@@ -256,7 +263,7 @@ CONFIG_SAM34_EMAC_ISETH0=y
#
# CONFIG_ARCH_NOINTC is not set
# CONFIG_ARCH_VECNOTIRQ is not set
-# CONFIG_ARCH_DMA is not set
+CONFIG_ARCH_DMA=y
CONFIG_ARCH_HAVE_IRQPRIO=y
# CONFIG_CUSTOM_STACK is not set
# CONFIG_ADDRENV is not set
@@ -325,6 +332,8 @@ CONFIG_NSH_MMCSDMINOR=0
#
CONFIG_SAM4EEK_96MHZ=y
# CONFIG_SAM4EEK_120MHZ is not set
+CONFIG_SAM4EEK_AT25_AUTOMOUNT=y
+CONFIG_SAM4EEK_AT25_FTL=y
#
# RTOS Features
@@ -404,7 +413,11 @@ CONFIG_DEV_NULL=y
# CONFIG_PWM is not set
# CONFIG_ARCH_HAVE_I2CRESET is not set
# CONFIG_I2C is not set
-# CONFIG_SPI is not set
+CONFIG_SPI=y
+# CONFIG_SPI_OWNBUS is not set
+CONFIG_SPI_EXCHANGE=y
+# CONFIG_SPI_CMDDATA is not set
+# CONFIG_SPI_BITBANG is not set
# CONFIG_I2S is not set
# CONFIG_RTC is not set
# CONFIG_WATCHDOG is not set
@@ -415,7 +428,33 @@ CONFIG_DEV_NULL=y
# CONFIG_INPUT is not set
# CONFIG_LCD is not set
# CONFIG_MMCSD is not set
-# CONFIG_MTD is not set
+CONFIG_MTD=y
+
+#
+# MTD Configuration
+#
+# CONFIG_MTD_PARTITION is not set
+# CONFIG_MTD_BYTE_WRITE is not set
+# CONFIG_MTD_CONFIG is not set
+# CONFIG_MTD_CONFIG_RAM_CONSOLIDATE is not set
+
+#
+# MTD Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+# CONFIG_RAMMTD is not set
+# CONFIG_MTD_AT24XX is not set
+CONFIG_MTD_AT25=y
+CONFIG_AT25_SPIMODE=0
+CONFIG_AT25_SPIFREQUENCY=20000000
+# CONFIG_MTD_AT45DB is not set
+# CONFIG_MTD_M25P is not set
+# CONFIG_MTD_SMART is not set
+# CONFIG_MTD_RAMTRON is not set
+# CONFIG_MTD_SST25 is not set
+# CONFIG_MTD_SST25XX is not set
+# CONFIG_MTD_SST39FV is not set
+# CONFIG_MTD_W25 is not set
CONFIG_NETDEVICES=y
#
@@ -584,8 +623,9 @@ CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
-# CONFIG_FAT_LCNAMES is not set
-# CONFIG_FAT_LFN is not set
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
# CONFIG_FS_FATTIME is not set
# CONFIG_FAT_DMAMEMORY is not set
# CONFIG_NFS is not set
@@ -918,6 +958,7 @@ CONFIG_NSH_MAX_ROUNDTRIP=20
#
# FLASH Erase-all Command
#
+# CONFIG_SYSTEM_FLASH_ERASEALL is not set
#
# NxPlayer media player library / command Line