summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-04-29 08:10:27 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-04-29 08:10:27 -0600
commit2daf1a660ea70ebebe3b7d62fb6f838679fa1ad7 (patch)
tree4a387e268d2e98f64315fcf13a1e680051a5d6c6
parentdd5d0e16185a285863dec303d8a0dd4aa13211b4 (diff)
downloadnuttx-2daf1a660ea70ebebe3b7d62fb6f838679fa1ad7.tar.gz
nuttx-2daf1a660ea70ebebe3b7d62fb6f838679fa1ad7.tar.bz2
nuttx-2daf1a660ea70ebebe3b7d62fb6f838679fa1ad7.zip
Nucleo-F401RE: Board GPIOs updated by Frank Bennett
-rw-r--r--nuttx/configs/nucleo-f401re/README.txt6
-rw-r--r--nuttx/configs/nucleo-f401re/include/board.h8
-rw-r--r--nuttx/configs/nucleo-f401re/src/nucleo-f401re.h37
-rw-r--r--nuttx/configs/nucleo-f401re/src/stm32_io.c27
-rw-r--r--nuttx/configs/nucleo-f401re/src/stm32_wireless.c8
5 files changed, 46 insertions, 40 deletions
diff --git a/nuttx/configs/nucleo-f401re/README.txt b/nuttx/configs/nucleo-f401re/README.txt
index e20fd7088..bf9423dce 100644
--- a/nuttx/configs/nucleo-f401re/README.txt
+++ b/nuttx/configs/nucleo-f401re/README.txt
@@ -350,8 +350,8 @@ Hardware
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
+ A0=PA_0 USART2RX D0=PA_3 D8 =PA_9
+ A1=PA_1 USART2TX 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
@@ -359,6 +359,8 @@ Hardware
LED2=D6=PB_10 I2C1_SDA=D14=PB_9 Probe
D7=PA_8 I2C1_SCL=D15=PB_8 Probe
+ From: https://mbed.org/platforms/ST-Nucleo-F401RE/
+
Buttons
-------
B1 USER: the user button is connected to the I/O PC13 (pin 2) of the STM32
diff --git a/nuttx/configs/nucleo-f401re/include/board.h b/nuttx/configs/nucleo-f401re/include/board.h
index 9f4c00fe3..c14f3d38a 100644
--- a/nuttx/configs/nucleo-f401re/include/board.h
+++ b/nuttx/configs/nucleo-f401re/include/board.h
@@ -204,11 +204,11 @@
/* UARTs */
-#define GPIO_USART1_RX GPIO_USART1_RX_1 /* Console in from IO */
-#define GPIO_USART1_TX 0 /* USART1 is RX-only */
+#define GPIO_USART1_RX GPIO_USART1_RX_1 /* PA_10 */
+#define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB_6 */
-#define GPIO_USART2_RX GPIO_USART2_RX_2
-#define GPIO_USART2_TX GPIO_USART2_TX_2
+#define GPIO_USART2_RX GPIO_USART2_RX_1 /* PA_3 */
+#define GPIO_USART2_TX GPIO_USART2_TX_1 /* PA_2 */
#define GPIO_USART2_RTS GPIO_USART2_RTS_2
#define GPIO_USART2_CTS GPIO_USART2_CTS_2
diff --git a/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h b/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h
index 1ceefbb30..02f08a910 100644
--- a/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h
+++ b/nuttx/configs/nucleo-f401re/src/nucleo-f401re.h
@@ -22,7 +22,7 @@
* - When the I/O is LOW, the LED is off.
*/
-#define GPIO_LD2 (GPIO_PORTA | GPIO_PIN13 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
+#define GPIO_LD2 (GPIO_PORTA | GPIO_PIN5 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
/* Buttons
*
@@ -40,34 +40,37 @@
*
* +5V
* GND
- * Digital pin 3: IRQ for WiFi
- * 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 pin 11:
- * Digital pin 12:
- * Digital pin 13:
- * Even if optional 6-pin SPI header is used, these pins are unavailable for other use.
+ * SERIAL_TX=PA_2 USER_BUTTON=PC_13
+ * SERIAL_RX=PA_3 LD2=PA_5
+ *
+ * Analog Digital
+ * A0=PA_0 USART2RX D0=PA_3 D8 =PA_9
+ * A1=PA_1 USART2TX 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 SD_CS=D4=PB_5 D12=PA_6 SPI_MISO
+ * A5=PC_0 WIFI_EN=D5=PB_4 LD2=D13=PA_5 SPI_SCK
+ * LED2=D6=PB_10 I2C1_SDA=D14=PB_9 WIFI Probe
+ * D7=PA_8 I2C1_SCL=D15=PB_8 WIFI Probe
+ *
+ * mostly from: https://mbed.org/platforms/ST-Nucleo-F401RE/
+ *
*/
#define GPIO_WIFI_INT (GPIO_PORTB | GPIO_PIN3 | GPIO_INPUT | GPIO_PULLUP | GPIO_EXTI)
#define GPIO_WIFI_EN (GPIO_PORTB | GPIO_PIN4 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_PULLUP | GPIO_SPEED_50MHz)
#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_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_D0 (GPIO_PORTA | GPIO_PIN3 | GPIO_INPUT | GPIO_PULLUP )
+# define GPIO_D1 (GPIO_PORTA | GPIO_PIN2 | GPIO_OUTPUT_CLEAR | GPIO_PULLUP )
# define GPIO_D2 (GPIO_PORTA | GPIO_PIN10 | 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
/* SPI1 off */
@@ -85,9 +88,9 @@
/* SPI chip selects */
#define GPIO_SPI_CS_WIFI \
- (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN13)
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN6)
#define GPIO_SPI_CS_SD_CARD \
- (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN15)
+ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN5)
/* Devices on the onboard bus.
*
diff --git a/nuttx/configs/nucleo-f401re/src/stm32_io.c b/nuttx/configs/nucleo-f401re/src/stm32_io.c
index 856cb9788..520d4af82 100644
--- a/nuttx/configs/nucleo-f401re/src/stm32_io.c
+++ b/nuttx/configs/nucleo-f401re/src/stm32_io.c
@@ -119,13 +119,14 @@ void up_ioinit(void)
*/
up_leds(0,0,0,0);
- stm32_configgpio(GPIO_A0); /* Probes */
- stm32_configgpio(GPIO_A1); /* Probes */
- stm32_configgpio(GPIO_A2); /* Smart Config */
- stm32_configgpio(GPIO_A3); /* not used */
- stm32_configgpio(GPIO_D0); /* Sw 1 */
- stm32_configgpio(GPIO_D1); /* Sw 2 */
- stm32_configgpio(GPIO_D2); /* Activate */
+ stm32_configgpio(GPIO_A0); /* Probes */
+ stm32_configgpio(GPIO_A1); /* Probes */
+ stm32_configgpio(GPIO_A2); /* Smart Config */
+ stm32_configgpio(GPIO_A3); /* not used */
+ stm32_configgpio(GPIO_BTN_USER); /* Sw 1 */
+ stm32_configgpio(GPIO_D0); /* USART2 RX*/
+ stm32_configgpio(GPIO_D1); /* uSART2 TX*/
+ stm32_configgpio(GPIO_D2); /* Activate */
}
/****************************************************************************
@@ -138,10 +139,10 @@ void up_ioinit(void)
uint8_t up_read_inputs(void)
{
uint8_t bits = 0;
- bits |= stm32_gpioread(GPIO_D0) == 0 ? 1 : 0;
- bits |= stm32_gpioread(GPIO_D1) == 0 ? 2 : 0;
- bits |= stm32_gpioread(GPIO_A2) == 0 ? 4 : 0;
- bits |= stm32_gpioread(GPIO_A3) == 0 ? 8 : 0;
+ bits |= stm32_gpioread(GPIO_D14) == 0 ? 1 : 0;
+ bits |= stm32_gpioread(GPIO_D15) == 0 ? 2 : 0;
+ bits |= stm32_gpioread(GPIO_A2) == 0 ? 4 : 0;
+ bits |= stm32_gpioread(GPIO_A3) == 0 ? 8 : 0;
return bits;
}
@@ -183,11 +184,11 @@ xcpt_t up_irqio(int id, xcpt_t irqhandler)
if (id == 0)
{
- oldhandler = stm32_gpiosetevent(GPIO_D0, true, true, true, irqhandler);
+ oldhandler = stm32_gpiosetevent(GPIO_D14, true, true, true, irqhandler);
}
else if (id == 1)
{
- oldhandler = stm32_gpiosetevent(GPIO_D1, true, true, true, irqhandler);
+ oldhandler = stm32_gpiosetevent(GPIO_D15, true, true, true, irqhandler);
}
return oldhandler;
diff --git a/nuttx/configs/nucleo-f401re/src/stm32_wireless.c b/nuttx/configs/nucleo-f401re/src/stm32_wireless.c
index 3fe923d02..cf5809443 100644
--- a/nuttx/configs/nucleo-f401re/src/stm32_wireless.c
+++ b/nuttx/configs/nucleo-f401re/src/stm32_wireless.c
@@ -243,12 +243,12 @@ static bool probe(FAR struct cc3000_config_s *state,int n, bool s)
{
if (n == 0)
{
- stm32_gpiowrite(GPIO_D0, s);
+ stm32_gpiowrite(GPIO_D14, s);
}
if (n == 1)
{
- stm32_gpiowrite(GPIO_D1, s);
+ stm32_gpiowrite(GPIO_D15, s);
}
return true;
@@ -284,9 +284,9 @@ int wireless_archinitialize(size_t max_rx_size)
DEBUGASSERT(CONFIG_CC3000_DEVMINOR == 0);
#ifdef CONFIG_CC3000_PROBES
- stm32_configgpio(GPIO_D7);
+ stm32_configgpio(GPIO_D14);
stm32_configgpio(GPIO_D15);
- stm32_gpiowrite(GPIO_D7, 1);
+ stm32_gpiowrite(GPIO_D14, 1);
stm32_gpiowrite(GPIO_D15, 1);
#endif