From 441cfb82db9a64ed288b85183b2ced694019002f Mon Sep 17 00:00:00 2001
From: patacongo
Date: Mon, 24 Sep 2012 18:57:38 +0000
Subject: [PATCH] Corrections for SD card on Shenzhou board
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5183 42af7a65-404d-4744-a932-0658087f49c3
---
Documentation/NuttX.html | 13 +++++++++----
arch/arm/src/stm32/stm32_idle.c | 6 ++++--
configs/shenzhou/README.txt | 13 +++++++++++--
configs/shenzhou/nsh/defconfig | 10 +++++-----
configs/shenzhou/src/shenzhou-internal.h | 2 +-
configs/shenzhou/src/up_mmcsd.c | 2 +-
configs/shenzhou/src/up_nsh.c | 4 ++--
configs/shenzhou/src/up_spi.c | 19 ++++++++++---------
drivers/Kconfig | 2 +-
9 files changed, 44 insertions(+), 27 deletions(-)
diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index b51b5e7b32..84e0024ef8 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -1789,7 +1789,7 @@
Not all features have been verified.
Support for FAT file system on an an SD card had been verified.
The ENC28J60 network is functional (but required lifting the chip select pin on the W25x16 part).
- Customizations for the v3 version of the Wildfire board a selectable (but untested).
+ Customizations for the v3 version of the Wildfire board are selectable (but untested).
@@ -1820,15 +1820,20 @@
STATUS:
Configurations for the basic OS test and NSH are available and verified.
+ Networking is functional.
- Shenzhou
- Work is underway as of this writing to port NuttX to the Shenzhou development board (See www.armjishu.com) featuring the STMicro STM32F107VCT MCU.
- If all goes according to plan, this port should be verified and avaialble in NuttX-6.22.
+ Shenzhou IV
+ Work is underway as of this writing to port NuttX to the Shenzhou IV development board (See www.armjishu.com) featuring the STMicro STM32F107VCT MCU.
+ If all goes according to plan, this port should be verified and available in NuttX-6.22.
STATUS:
In progress.
+ The following have been verified:
+ (1) Basic Cortex-M3 port,
+ (2) Ethernet,
+ (3) On-board LEDs
diff --git a/arch/arm/src/stm32/stm32_idle.c b/arch/arm/src/stm32/stm32_idle.c
index 0b69ff6485..83a6808c58 100644
--- a/arch/arm/src/stm32/stm32_idle.c
+++ b/arch/arm/src/stm32/stm32_idle.c
@@ -195,8 +195,10 @@ void up_idle(void)
* Enable DMA1 or DMA2 clocks in the RCC_AHBENR register before
* executing the WFI/WFE instruction."
*
- * Here the workaround is just don't go into SLEEP mode for the connectivity
- * line parts if Ethernet is enabled.
+ * Here the workaround is just to avoid SLEEP mode for the connectivity
+ * line parts if Ethernet is enabled. The errate recommends a more
+ * general solution: Enabling DMA1/2 clocking in stm32f10xx_rcc.c if the
+ * STM32107 Ethernet peripheral is enabled.
*/
#if !defined(CONFIG_STM32_CONNECTIVITYLINE) || !defined(CONFIG_STM32_ETHMAC)
diff --git a/configs/shenzhou/README.txt b/configs/shenzhou/README.txt
index e929f2b8ba..23535e8d9c 100644
--- a/configs/shenzhou/README.txt
+++ b/configs/shenzhou/README.txt
@@ -2,8 +2,17 @@ README
======
This README discusses issues unique to NuttX configurations for the Shenzhou
-development board from www.armjishu.com featuring the STMicro STM32F107VCT
-MCU. On-board features:
+IV development board from www.armjishu.com featuring the STMicro STM32F107VCT
+MCU. As of this writing, there are five models of the Shenzhou board:
+
+ 1. Shenzhou I (STM32F103RB)
+ 2. Shenzhou II (STM32F103VC)
+ 3. Shenzhou III (STM32F103ZE)
+ 4. Shenzhou IV (STM32F107VC)
+ 5. Shenzhou king ((STM32F103ZG, core board + IO expansion board)).
+
+Support is currently provided for the Shenzhou IV only. Features of the
+Shenzhou IV board include:
- STM32F107VCT
- 10/100M PHY (DM9161AEP)
diff --git a/configs/shenzhou/nsh/defconfig b/configs/shenzhou/nsh/defconfig
index 0a699d334d..3528f6d605 100644
--- a/configs/shenzhou/nsh/defconfig
+++ b/configs/shenzhou/nsh/defconfig
@@ -233,7 +233,7 @@ CONFIG_ARCH_HAVE_BUTTONS=y
CONFIG_ARCH_HAVE_IRQBUTTONS=y
CONFIG_NSH_MMCSDMINOR=0
CONFIG_NSH_MMCSDSLOTNO=0
-CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSPIPORTNO=1
#
# Board-Specific Options
@@ -315,7 +315,7 @@ CONFIG_ARCH_HAVE_I2CRESET=y
CONFIG_SPI=y
# CONFIG_SPI_OWNBUS is not set
CONFIG_SPI_EXCHANGE=y
-CONFIG_SPI_CMDDATA=y
+# CONFIG_SPI_CMDDATA is not set
CONFIG_RTC=y
# CONFIG_RTC_DATETIME is not set
# CONFIG_RTC_HIRES is not set
@@ -388,7 +388,7 @@ CONFIG_NET_BUFSIZE=562
CONFIG_NET_TCP=y
CONFIG_NET_TCP_CONNS=40
CONFIG_NET_MAX_LISTENPORTS=40
-# CONFIG_NET_TCP_READAHEAD_BUFSIZE=562
+CONFIG_NET_TCP_READAHEAD_BUFSIZE=562
CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
CONFIG_NET_TCP_RECVDELAY=0
CONFIG_NET_TCPBACKLOG=y
@@ -401,7 +401,7 @@ CONFIG_NET_ICMP_PING=y
# CONFIG_NET_PINGADDRCONF is not set
# CONFIG_NET_IGMP is not set
CONFIG_NET_STATISTICS=y
-# CONFIG_NET_RECEIVE_WINDOW=562
+CONFIG_NET_RECEIVE_WINDOW=562
CONFIG_NET_ARPTAB_SIZE=16
# CONFIG_NET_ARP_IPIN is not set
@@ -877,7 +877,7 @@ CONFIG_NSH_NESTDEPTH=3
# CONFIG_NSH_DISABLEBG is not set
CONFIG_NSH_CONSOLE=y
# CONFIG_NSH_CONDEV is not set
-# CONFIG_NSH_ARCHINIT is not set
+CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_TELNET=y
CONFIG_NSH_TELNETD_PORT=23
CONFIG_NSH_TELNETD_DAEMONPRIO=100
diff --git a/configs/shenzhou/src/shenzhou-internal.h b/configs/shenzhou/src/shenzhou-internal.h
index b5fb4e35c0..0dc3b067e6 100644
--- a/configs/shenzhou/src/shenzhou-internal.h
+++ b/configs/shenzhou/src/shenzhou-internal.h
@@ -230,7 +230,7 @@
* PN NAME SIGNAL NOTES
* -- ---- -------------- -------------------------------------------------------------------
* 53 PB14 SD_CD Active low: Pulled high
- * 58 PD11 SD_CS
+ * 58 PD11 SD_CS Active low: Pulled high
*/
#define GPIO_SD_CD (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTB|GPIO_PIN14)
diff --git a/configs/shenzhou/src/up_mmcsd.c b/configs/shenzhou/src/up_mmcsd.c
index daa1498178..531fbfd7e3 100644
--- a/configs/shenzhou/src/up_mmcsd.c
+++ b/configs/shenzhou/src/up_mmcsd.c
@@ -67,7 +67,7 @@
/* Can't support MMC/SD features if mountpoints are disabled */
-#ifndef CONFIG_DISABLE_MOUNTPOINT
+#ifdef CONFIG_DISABLE_MOUNTPOINT
# undef HAVE_MMCSD
#endif
diff --git a/configs/shenzhou/src/up_nsh.c b/configs/shenzhou/src/up_nsh.c
index e6126ba4d2..685281f5da 100644
--- a/configs/shenzhou/src/up_nsh.c
+++ b/configs/shenzhou/src/up_nsh.c
@@ -116,7 +116,7 @@
/* Can't support W25 features if mountpoints are disabled */
-#if defined(CONFIG_DISABLE_MOUNTPOINT)
+#ifdef CONFIG_DISABLE_MOUNTPOINT
# undef HAVE_W25
#endif
@@ -194,7 +194,7 @@ int nsh_archinitialize(void)
/* Initialize the SPI-based MMC/SD slot */
#ifdef HAVE_MMCSD
- ret = stm32_sdinitialze(CONFIG_NSH_MMCSDMINOR);
+ ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
message("nsh_archinitialize: Failed to initialize MMC/SD slot %d: %d\n",
diff --git a/configs/shenzhou/src/up_spi.c b/configs/shenzhou/src/up_spi.c
index ce6a1f75e9..8f74c92f78 100644
--- a/configs/shenzhou/src/up_spi.c
+++ b/configs/shenzhou/src/up_spi.c
@@ -60,18 +60,18 @@
/* Enables debug output from this file (needs CONFIG_DEBUG too) */
-#undef SPI_DEBUG /* Define to enable debug */
-#undef SPI_VERBOSE /* Define to enable verbose debug */
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_SPI
+#endif
-#ifdef SPI_DEBUG
+#ifdef CONFIG_DEBUG_SPI
# define spidbg lldbg
-# ifdef SPI_VERBOSE
+# ifdef CONFIG_DEBUG_VERBOSE
# define spivdbg lldbg
# else
# define spivdbg(x...)
# endif
#else
-# undef SPI_VERBOSE
# define spidbg(x...)
# define spivdbg(x...)
#endif
@@ -103,15 +103,16 @@ void weak_function stm32_spiinitialize(void)
/* SPI1 connects to the SD CARD and to the SPI FLASH */
#ifdef CONFIG_STM32_SPI1
- stm32_configgpio(GPIO_SD_CS);
- stm32_configgpio(GPIO_FLASH_CS);
+ stm32_configgpio(GPIO_SD_CS); /* SD card chip select */
+ stm32_configgpio(GPIO_SD_CD); /* SD card detect */
+ stm32_configgpio(GPIO_FLASH_CS); /* FLASH chip select */
#endif
/* SPI3 connects to TFT LCD and the RF24L01 2.4G wireless module */
#ifdef CONFIG_STM32_SPI3
- stm32_configgpio(GPIO_LCD_CS);
- stm32_configgpio(GPIO_WIRELESS_CS);
+ stm32_configgpio(GPIO_LCD_CS); /* LCD chip select */
+ stm32_configgpio(GPIO_WIRELESS_CS); /* Wireless chip select */
#endif
}
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 32d127aa43..ea218a5925 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -151,7 +151,7 @@ config SPI_EXCHANGE
config SPI_CMDDATA
bool "SPI CMD/DATA"
- default y
+ default n
---help---
Devices on the SPI bus require out-of-band support to distinguish command
transfers from data transfers. Such devices will often support either 9-bit