From 70c33928d85601ecc2d7979e25ba0fe12436fc49 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 13 Sep 2014 07:28:14 -0600 Subject: [PATCH] Add STM32F4Discovery configuration with the STM32F4DIS-BB base board --- configs/stm32f4discovery/Kconfig | 21 ++++++--- configs/stm32f4discovery/README.txt | 7 ++- configs/stm32f4discovery/include/board.h | 56 ++++++++++++++++++++---- 3 files changed, 70 insertions(+), 14 deletions(-) diff --git a/configs/stm32f4discovery/Kconfig b/configs/stm32f4discovery/Kconfig index 7ea87512bd..1247836052 100644 --- a/configs/stm32f4discovery/Kconfig +++ b/configs/stm32f4discovery/Kconfig @@ -5,8 +5,15 @@ if ARCH_BOARD_STM32F4_DISCOVERY +config STM32F4DISBB + bool "STM32F4DIS-BB base board" + default n + ---help--- + Select if you are using the STM32F4DIS-BB base board with the + STM32F4Discovery. + config PM_BUTTONS - bool "PM Button support" + bool "PM button support" default n depends on PM && ARCH_IRQBUTTONS ---help--- @@ -17,21 +24,24 @@ config PM_BUTTON_ACTIVITY default 10 depends on PM_BUTTONS ---help--- - The activity weight to report to the power management subsystem when a button is pressed. + The activity weight to report to the power management subsystem when + a button is pressed. config PM_ALARM_SEC int "PM_STANDBY delay (seconds)" default 15 depends on PM && RTC_ALARM ---help--- - Number of seconds to wait in PM_STANDBY before going to PM_STANDBY mode. + Number of seconds to wait in PM_STANDBY before going to PM_STANDBY + mode. config PM_ALARM_NSEC int "PM_STANDBY delay (nanoseconds)" default 0 depends on PM && RTC_ALARM ---help--- - Number of additional nanoseconds to wait in PM_STANDBY before going to PM_STANDBY mode. + Number of additional nanoseconds to wait in PM_STANDBY before going + to PM_STANDBY mode. config PM_SLEEP_WAKEUP bool "PM_SLEEP wake-up alarm" @@ -52,6 +62,7 @@ config PM_SLEEP_WAKEUP_NSEC default 0 depends on PM && RTC_ALARM ---help--- - Number of additional nanoseconds to wait in PM_SLEEP before going to PM_STANDBY mode. + Number of additional nanoseconds to wait in PM_SLEEP before going to + PM_STANDBY mode. endif diff --git a/configs/stm32f4discovery/README.txt b/configs/stm32f4discovery/README.txt index ce312d3ca7..e4f135c0d2 100644 --- a/configs/stm32f4discovery/README.txt +++ b/configs/stm32f4discovery/README.txt @@ -356,9 +356,14 @@ USART6 Default USART/UART Configuration -------------------------------- -USART2 is enabled in all configurations (see */defconfig). RX and TX are +USART2 is enabled in most configurations (see */defconfig). RX and TX are configured on pins PA3 and PA2, respectively (see include/board.h). +These pins selections, however, conflict with Ethernet pin usage on the +STM32F4DIS-BB base board. The STM32F4DIS-BB base board provides RS-232 +drivers and a DB9 connector for USART6. USART6 is the preferred serial +console for use with the STM32F4DIS-BB. + Timer Inputs/Outputs ==================== diff --git a/configs/stm32f4discovery/include/board.h b/configs/stm32f4discovery/include/board.h index f3c5831876..6795ab52ee 100644 --- a/configs/stm32f4discovery/include/board.h +++ b/configs/stm32f4discovery/include/board.h @@ -1,8 +1,7 @@ /************************************************************************************ * configs/stm32f4discovery/include/board.h - * include/arch/board/board.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -209,12 +208,27 @@ /* UART2: * * The STM32F4 Discovery has no on-board serial devices, but the console is - * brought out to PA2 (TX) and PA3 (RX) for connection to an external serial device. - * (See the README.txt file for other options) + * brought out to PA2 (TX) and PA3 (RX) for connection to an external serial + * device. (See the README.txt file for other options) + * + * These pins selections, however, conflict with pin usage on the STM32F4DIS-BB. */ -#define GPIO_USART2_RX GPIO_USART2_RX_1 -#define GPIO_USART2_TX GPIO_USART2_TX_1 +#ifdef CONFIG_STM32F4DISBB +# define GPIO_USART2_RX GPIO_USART2_RX_1 +# define GPIO_USART2_TX GPIO_USART2_TX_1 +#endif + +/* UART6: + * + * The STM32F4DIS-BB base board provides RS-232 drivers and a DB9 connector + * for USART6. This is the preferred serial console for use with the STM32F4DIS-BB. + */ + +#ifdef CONFIG_STM32F4DISBB +# define GPIO_USART6_RX GPIO_USART6_RX_1 +# define GPIO_USART6_TX GPIO_USART6_TX_1 +#endif /* PWM * @@ -238,6 +252,31 @@ #define GPIO_TIM8_CH1IN GPIO_TIM8_CH1IN_1 #define GPIO_TIM8_CH2IN GPIO_TIM8_CH2IN_1 +/* Ethernet *************************************************************************/ + + +#if defined(CONFIG_STM32F4DISBB) && defined(CONFIG_STM32_ETHMAC) + /* RMII interface to the LAN8720 PHY */ + +# ifndef CONFIG_STM32_RMII +# error CONFIG_STM32_RMII must be defined +# endif + + /* Clocking is provided by an external 25Mhz XTAL */ + +# ifndef CONFIG_STM32_RMII_EXTCLK +# error CONFIG_STM32_RMII_EXTCLK must be defined +# endif + + /* Pin disambiguation */ + +# define GPIO_ETH_RMII_TX_EN GPIO_ETH_RMII_TX_EN_1 +# define GPIO_ETH_RMII_TXD0 GPIO_ETH_RMII_TXD0_1 +# define GPIO_ETH_RMII_TXD1 GPIO_ETH_RMII_TXD1_1 +# define GPIO_ETH_PPS_OUT GPIO_ETH_PPS_OUT_1 + +#endif + /************************************************************************************ * Public Data ************************************************************************************/ @@ -247,7 +286,8 @@ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -260,7 +300,7 @@ extern "C" { * * Description: * All STM32 architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured + * is called early in the initialization -- after all memory has been configured * and mapped but before any devices have been initialized. * ************************************************************************************/