summaryrefslogtreecommitdiff
path: root/nuttx/configs/nucleo-f401re
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-04-22 16:04:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-04-22 16:04:14 -0600
commitd3a5286ad907438ff5490d61ab2dcccd3d941baa (patch)
treecfac0ec82a350334a496b9c9bf08208a5ed838c3 /nuttx/configs/nucleo-f401re
parent7452bdd9201311c1ccf299252bea2aa1768a553d (diff)
downloadpx4-nuttx-d3a5286ad907438ff5490d61ab2dcccd3d941baa.tar.gz
px4-nuttx-d3a5286ad907438ff5490d61ab2dcccd3d941baa.tar.bz2
px4-nuttx-d3a5286ad907438ff5490d61ab2dcccd3d941baa.zip
Nucleo-F401RE update from Frank Bennett
Diffstat (limited to 'nuttx/configs/nucleo-f401re')
-rw-r--r--nuttx/configs/nucleo-f401re/README.txt49
-rw-r--r--nuttx/configs/nucleo-f401re/src/nucleo-f401re.h61
-rw-r--r--nuttx/configs/nucleo-f401re/src/stm32_spi.c35
-rw-r--r--nuttx/configs/nucleo-f401re/src/stm32_wireless.c8
4 files changed, 126 insertions, 27 deletions
diff --git a/nuttx/configs/nucleo-f401re/README.txt b/nuttx/configs/nucleo-f401re/README.txt
index fe1d527f1..e20fd7088 100644
--- a/nuttx/configs/nucleo-f401re/README.txt
+++ b/nuttx/configs/nucleo-f401re/README.txt
@@ -1,21 +1,24 @@
README
======
-This README discusses issues unique to NuttX configurations for the ST NucleoF401RE board
-from ST Micro (http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN1810/PF258797)
+This README discusses issues unique to NuttX configurations for the ST NucleoF401RE board
+from ST Micro (http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN1810/PF258797)
- Microprocessor: 32-bit ARM Cortex M4 at 84MHz STM32F104RE
+ Microprocessor: 32-bit ARM Cortex M4 at 84MHz STM32F104RE
Memory: 512 KB Flash and 96 KB SRAM
I/O Pins Out: 37, 17 On the Connector
Network: TI CC3000 Wifi Module
ADCs: 1 (at 12-bit resolution)
Peripherals: 10 timers, 2 I2Cs, 2 SPI ports, 3 USARTs, 1 led
Other: Sleep, stop, and standby modes; serial wire debug and JTAG interfaces
+ Expansion I/F Ardino and Morpho Headers
- It breaks out the Tx, Rx to connect to a FTDI TTL-232RG-VREG3V3-WE for the console and
- wires in the spark LEDs and serial flash to the same I/O as the sparkcore. It has a Jlink
- compatible Jtag connector on it.
+ Uses a STM32F103 to provide a ST-Link for programming, debug similar to the OpenOcd
+ FTDI function - USB to JTAG front-end.
+
+ Wireless WIFI + SD Card SDIO via a "CC3000 WiFi Arduino Shield" added card
+ RS232 console support via a "RS232 Arduino Shield" added card
Contents
========
@@ -27,9 +30,8 @@ Contents
- NuttX OABI "buildroot" Toolchain
- NXFLAT Toolchain
- Hardware
- - Core Pin out
- - LED
- Button
+ - LED
- USARTS and Serial Consoles
- LQFP64
- DFU and JTAG
@@ -56,7 +58,7 @@ GNU Toolchain Options
4. Raisonance GNU toolchain, or
5. The NuttX buildroot Toolchain (see below).
- All testing has been conducted using the CodeSourcery toolchain for Linux.
+ All testing has been conducted using the CodeSourcery toolchain for Linux.
To use the Atollic, devkitARM, Raisonance GNU, or NuttX buildroot toolchain,
you simply need to add one of the following configuration options to your
.config (or defconfig) file:
@@ -89,7 +91,7 @@ GNU Toolchain Options
directory. If you use a Windows toolchain, you should get in the habit of
making like this:
- V=1 make clean_context all 2>&1 |tee mout
+ V=1 make clean_context all 2>&1 |tee mout
An alias in your .bashrc file might make that less painful.
@@ -202,8 +204,9 @@ NuttX EABI "buildroot" Toolchain
1. You must have already configured Nuttx in <some-dir>/nuttx.
- cd tools
- ./configure.sh stm32_tiny/<sub-dir>
+ $ (cd tools; ./configure.sh nucleo-f401re/nsh)
+ $ make qconfig
+ $ V=1 make context all 2>&1 | tee mout
2. Download the latest buildroot package into <some-dir>
@@ -287,7 +290,7 @@ NXFLAT Toolchain
DFU and JTAG
============
- Enbling Support for the DFU Bootloader
+ Enabling Support for the DFU Bootloader
--------------------------------------
The linker files in these projects can be configured to indicate that you
will be loading code using STMicro built-in USB Device Firmware Upgrade (DFU)
@@ -309,7 +312,7 @@ DFU and JTAG
For Linux or Mac:
----------------
- While on Linux or Mac,
+ While on Linux or Mac,
$ lsusb
Bus 003 Device 061: ID 0483:374b STMicroelectronics
@@ -342,6 +345,20 @@ DFU and JTAG
Hardware
========
+ GPIO
+ ----
+ SERIAL_TX=PA_2 USER_BUTTON=PC_13
+ SERIAL_RX=PA_3 LED1 =PA_5
+
+ A0=PA_0 D0=PA_3 D8 =PA_9
+ A1=PA_1 D1=PA_2 D9 =PC_7
+ A2=PA_4 D2=PA_10 WIFI_CS=D10=PB_6 SPI_CS
+ A3=PB_0 WIFI_INT=D3=PB_3 D11=PA_7 SPI_MOSI
+ A4=PC_1 SDCS=D4=PB_5 D12=PA_6 SPI_MISO
+ A5=PC_0 WIFI_EN=D5=PB_4 LED1=D13=PA_5 SPI_SCK
+ LED2=D6=PB_10 I2C1_SDA=D14=PB_9 Probe
+ D7=PA_8 I2C1_SCL=D15=PB_8 Probe
+
Buttons
-------
B1 USER: the user button is connected to the I/O PC13 (pin 2) of the STM32
@@ -405,12 +422,12 @@ Configurations
Build it with
- make distclean;(cd tools;./configure.sh nucleo-f401re/nsh)
+ make distclean;(cd tools;./configure.sh nucleo-f401re/nsh)
then run make menuconfig if you wish to customize things.
or
-
+
$ make qconfig
N.B. Memory is tight, both Flash and RAM are taxed. If you enable
diff --git a/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h b/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h
index a46149158..8e4c5d0e0 100644
--- a/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h
+++ b/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h
@@ -44,7 +44,7 @@
* Digital pin 4: Card Select for SD card
* Digital pin 5: WiFi enable
* Digital pin 10: Chip Select for WiFi
- * Digital pins 11, 12, 13 for SPI communication (both WiFi and SD).
+ * Digital pins 11, 12, 13 for SPI communication (both WiFi and SD).
* Digital pin 11:
* Digital pin 12:
* Digital pin 13:
@@ -56,22 +56,70 @@
#define GPIO_WIFI_CS (GPIO_PORTB | GPIO_PIN6 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
#if defined(CONFIG_CC3000_PROBES)
-# define GPIO_D0 (GPIO_PORTB | GPIO_PIN7 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
-# define GPIO_D1 (GPIO_PORTB | GPIO_PIN6 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
+# define GPIO_D14 (GPIO_PORTB | GPIO_PIN9 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
+# define GPIO_D15 (GPIO_PORTB | GPIO_PIN8 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
#else
# define GPIO_D0 (GPIO_PORTA | GPIO_PIN3 | GPIO_INPUT | GPIO_PULLUP | GPIO_EXTI)
# define GPIO_D1 (GPIO_PORTA | GPIO_PIN2 | GPIO_INPUT | GPIO_PULLUP | GPIO_EXTI)
# define GPIO_D2 (GPIO_PORTA | GPIO_PIN10 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
-# define GPIO_D8 (GPIO_PORTA | GPIO_PIN9 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
-
# define GPIO_A0 (GPIO_PORTA | GPIO_PIN0 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
# define GPIO_A1 (GPIO_PORTA | GPIO_PIN1 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
# define GPIO_A2 (GPIO_PORTA | GPIO_PIN4 | GPIO_INPUT | GPIO_PULLUP )
# define GPIO_A3 (GPIO_PORTB | GPIO_PIN0 | GPIO_INPUT | GPIO_PULLUP )
#endif
-#ifndef __ASSEMBLY__
+/* External interrupts */
+
+#define GPIO_EXTI_MPU_DRDY (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTD|GPIO_PIN15)
+
+/* Data ready pins off */
+
+#define GPIO_EXTI_MPU_DRDY_OFF (GPIO_INPUT|GPIO_PULLDOWN|GPIO_EXTI|GPIO_PORTD|GPIO_PIN15)
+
+/* SPI1 off */
+
+#define GPIO_SPI1_MOSI_OFF (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTA|GPIO_PIN7)
+#define GPIO_SPI1_MISO_OFF (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTA|GPIO_PIN6)
+#define GPIO_SPI1_SCK_OFF (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTA|GPIO_PIN5)
+
+/* SPI1 chip selects off */
+
+#define GPIO_SPI_CS_WIFI_OFF \
+ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_SPEED_2MHz|GPIO_PORTB|GPIO_PIN6)
+#define GPIO_SPI_CS_SD_CARD_OFF \
+ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_SPEED_2MHz|GPIO_PORTB|GPIO_PIN5)
+#define GPIO_SPI_CS_FRAM \
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN10)
+#define GPIO_SPI_CS_MPU \
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN2)
+
+/* SPI chip selects */
+
+#define GPIO_SPI_CS_WIFI \
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN13)
+#define GPIO_SPI_CS_SD_CARD \
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN15)
+
+/* Devices on the onboard bus.
+ *
+ * Note that these are unshifted addresses.
+ */
+
+#define NUCLEO_I2C_OBDEV_LED 0x55
+#define NUCLEO_I2C_OBDEV_HMC5883 0x1e
+
+/* User GPIOs
+ *
+ * GPIO0-1 are for probing WIFI status
+ */
+
+#define GPIO_GPIO0_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN8)
+#define GPIO_GPIO1_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN9)
+#define GPIO_GPIO0_OUTPUT \
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN8)
+#define GPIO_GPIO1_OUTPUT \
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN9)
/************************************************************************************
* Public Functions
@@ -109,5 +157,4 @@ void stm32_usbinitialize(void);
void board_led_initialize(void);
#endif
-#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_NUCLEO_F401RE_SRC_NUCLEO_F401RE_H */
diff --git a/nuttx/configs/nucleo-f401re/src/stm32_spi.c b/nuttx/configs/nucleo-f401re/src/stm32_spi.c
index 6118b81d0..b61c54a24 100644
--- a/nuttx/configs/nucleo-f401re/src/stm32_spi.c
+++ b/nuttx/configs/nucleo-f401re/src/stm32_spi.c
@@ -92,6 +92,14 @@
void weak_function stm32_spiinitialize(void)
{
#ifdef CONFIG_STM32_SPI1
+ stm32_configgpio(GPIO_SPI_CS_WIFI);
+ stm32_configgpio(GPIO_SPI_CS_SD_CARD);
+ stm32_configgpio(GPIO_SPI_CS_MPU);
+
+ /* De-activate all peripherals, required for some peripheral state machines */
+
+ stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);
+ stm32_configgpio(GPIO_EXTI_MPU_DRDY);
#endif
#ifdef CONFIG_STM32_SPI2
@@ -134,6 +142,33 @@ void weak_function stm32_spiinitialize(void)
void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
{
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ switch (devid)
+ {
+ case SPIDEV_WIRELESS:
+ /* Making sure the other peripherals are not selected */
+
+ stm32_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
+ stm32_gpiowrite(GPIO_SPI_CS_SD_CARD, true);
+ stm32_gpiowrite(GPIO_SPI_CS_MPU, true);
+ break;
+
+ case SPIDEV_MMCSD:
+ /* Making sure the other peripherals are not selected */
+
+ stm32_gpiowrite(GPIO_SPI_CS_WIFI, true);
+ stm32_gpiowrite(GPIO_SPI_CS_SD_CARD, !selected);
+ stm32_gpiowrite(GPIO_SPI_CS_MPU, true);
+ break;
+
+ case SPIDEV_EXTDEV:
+ /* Making sure the other peripherals are not selected */
+
+ stm32_gpiowrite(GPIO_SPI_CS_WIFI, true);
+ stm32_gpiowrite(GPIO_SPI_CS_SD_CARD, true);
+ stm32_gpiowrite(GPIO_SPI_CS_MPU, !selected);
+ break;
+ }
}
uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
diff --git a/nuttx/configs/nucleo-f401re/src/stm32_wireless.c b/nuttx/configs/nucleo-f401re/src/stm32_wireless.c
index 139b60e52..3fe923d02 100644
--- a/nuttx/configs/nucleo-f401re/src/stm32_wireless.c
+++ b/nuttx/configs/nucleo-f401re/src/stm32_wireless.c
@@ -284,10 +284,10 @@ int wireless_archinitialize(size_t max_rx_size)
DEBUGASSERT(CONFIG_CC3000_DEVMINOR == 0);
#ifdef CONFIG_CC3000_PROBES
- stm32_configgpio(GPIO_D0);
- stm32_configgpio(GPIO_D1);
- stm32_gpiowrite(GPIO_D0, 1);
- stm32_gpiowrite(GPIO_D1, 1);
+ stm32_configgpio(GPIO_D7);
+ stm32_configgpio(GPIO_D15);
+ stm32_gpiowrite(GPIO_D7, 1);
+ stm32_gpiowrite(GPIO_D15, 1);
#endif
/* Get an instance of the SPI interface */