2019-08-19 17:16:08 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* boards/arm/stm32/stm32f4discovery/include/board.h
|
2012-01-11 14:01:26 +01:00
|
|
|
*
|
2018-05-20 00:12:21 +02:00
|
|
|
* Copyright (C) 2012, 2014-2016, 2018 Gregory Nutt. All rights reserved.
|
2012-01-11 14:01:26 +01:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2019-08-19 17:16:08 +02:00
|
|
|
****************************************************************************/
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2019-08-19 17:16:08 +02:00
|
|
|
#ifndef __BOARDS_ARM_STM32_STM32F4DISCOVERY_INCLUDE_BOARD_H
|
|
|
|
#define __BOARDS_ARM_STM32_STM32F4DISCOVERY_INCLUDE_BOARD_H
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2019-08-19 17:16:08 +02:00
|
|
|
/****************************************************************************
|
2012-01-11 14:01:26 +01:00
|
|
|
* Included Files
|
2019-08-19 17:16:08 +02:00
|
|
|
****************************************************************************/
|
2012-01-11 14:01:26 +01:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2012-08-29 19:41:43 +02:00
|
|
|
|
2012-01-11 14:01:26 +01:00
|
|
|
#ifndef __ASSEMBLY__
|
2015-09-19 15:56:50 +02:00
|
|
|
# include <stdint.h>
|
|
|
|
# include <stdbool.h>
|
2012-01-11 14:01:26 +01:00
|
|
|
#endif
|
2012-08-29 19:41:43 +02:00
|
|
|
|
2019-09-28 17:55:31 +02:00
|
|
|
/* Do not include STM32-specific header files here */
|
|
|
|
|
2019-08-19 17:16:08 +02:00
|
|
|
/****************************************************************************
|
2015-04-08 17:15:17 +02:00
|
|
|
* Pre-processor Definitions
|
2019-08-19 17:16:08 +02:00
|
|
|
****************************************************************************/
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* Clocking *****************************************************************/
|
2019-09-28 17:55:31 +02:00
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* The STM32F4 Discovery board features a single 8MHz crystal.
|
|
|
|
* Space is provided for a 32kHz RTC backup crystal, but it is not stuffed.
|
2012-01-11 14:01:26 +01:00
|
|
|
*
|
|
|
|
* This is the canonical configuration:
|
|
|
|
* System Clock source : PLL (HSE)
|
2020-05-11 23:51:21 +02:00
|
|
|
* SYSCLK(Hz) : 168000000 Determined by PLL
|
|
|
|
* configuration
|
2012-01-11 14:01:26 +01:00
|
|
|
* HCLK(Hz) : 168000000 (STM32_RCC_CFGR_HPRE)
|
|
|
|
* AHB Prescaler : 1 (STM32_RCC_CFGR_HPRE)
|
|
|
|
* APB1 Prescaler : 4 (STM32_RCC_CFGR_PPRE1)
|
|
|
|
* APB2 Prescaler : 2 (STM32_RCC_CFGR_PPRE2)
|
2012-11-01 16:31:10 +01:00
|
|
|
* HSE Frequency(Hz) : 8000000 (STM32_BOARD_XTAL)
|
2012-01-11 14:01:26 +01:00
|
|
|
* PLLM : 8 (STM32_PLLCFG_PLLM)
|
|
|
|
* PLLN : 336 (STM32_PLLCFG_PLLN)
|
|
|
|
* PLLP : 2 (STM32_PLLCFG_PLLP)
|
2012-08-15 19:58:54 +02:00
|
|
|
* PLLQ : 7 (STM32_PLLCFG_PLLQ)
|
2020-05-11 23:51:21 +02:00
|
|
|
* Main regulator output voltage : Scale1 mode Needed for high speed
|
|
|
|
* SYSCLK
|
2012-01-11 14:01:26 +01:00
|
|
|
* Flash Latency(WS) : 5
|
|
|
|
* Prefetch Buffer : OFF
|
|
|
|
* Instruction cache : ON
|
|
|
|
* Data cache : ON
|
|
|
|
* Require 48MHz for USB OTG FS, : Enabled
|
|
|
|
* SDIO and RNG clock
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* HSI - 16 MHz RC factory-trimmed
|
|
|
|
* LSI - 32 KHz RC
|
2012-11-01 16:31:10 +01:00
|
|
|
* HSE - On-board crystal frequency is 8MHz
|
2012-01-11 14:01:26 +01:00
|
|
|
* LSE - 32.768 kHz
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define STM32_BOARD_XTAL 8000000ul
|
|
|
|
|
|
|
|
#define STM32_HSI_FREQUENCY 16000000ul
|
|
|
|
#define STM32_LSI_FREQUENCY 32000
|
|
|
|
#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
|
|
|
|
#define STM32_LSE_FREQUENCY 32768
|
|
|
|
|
|
|
|
/* Main PLL Configuration.
|
|
|
|
*
|
|
|
|
* PLL source is HSE
|
|
|
|
* PLL_VCO = (STM32_HSE_FREQUENCY / PLLM) * PLLN
|
2012-11-01 16:31:10 +01:00
|
|
|
* = (8,000,000 / 8) * 336
|
2012-01-11 14:01:26 +01:00
|
|
|
* = 336,000,000
|
|
|
|
* SYSCLK = PLL_VCO / PLLP
|
|
|
|
* = 336,000,000 / 2 = 168,000,000
|
|
|
|
* USB OTG FS, SDIO and RNG Clock
|
|
|
|
* = PLL_VCO / PLLQ
|
|
|
|
* = 48,000,000
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define STM32_PLLCFG_PLLM RCC_PLLCFG_PLLM(8)
|
|
|
|
#define STM32_PLLCFG_PLLN RCC_PLLCFG_PLLN(336)
|
|
|
|
#define STM32_PLLCFG_PLLP RCC_PLLCFG_PLLP_2
|
2012-08-15 19:58:54 +02:00
|
|
|
#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(7)
|
2012-01-11 14:01:26 +01:00
|
|
|
|
|
|
|
#define STM32_SYSCLK_FREQUENCY 168000000ul
|
|
|
|
|
|
|
|
/* AHB clock (HCLK) is SYSCLK (168MHz) */
|
|
|
|
|
|
|
|
#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
|
|
|
|
#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
|
|
|
|
#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
|
|
|
|
|
|
|
|
/* APB1 clock (PCLK1) is HCLK/4 (42MHz) */
|
|
|
|
|
|
|
|
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */
|
|
|
|
#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4)
|
|
|
|
|
|
|
|
/* Timers driven from APB1 will be twice PCLK1 */
|
|
|
|
|
|
|
|
#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
#define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
|
|
|
|
|
|
|
/* APB2 clock (PCLK2) is HCLK/2 (84MHz) */
|
|
|
|
|
|
|
|
#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */
|
|
|
|
#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
|
|
|
|
|
|
|
|
/* Timers driven from APB2 will be twice PCLK2 */
|
|
|
|
|
|
|
|
#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
2012-01-16 18:20:09 +01:00
|
|
|
#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
|
|
|
#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
|
|
|
#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
|
|
|
#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
2012-01-11 14:01:26 +01:00
|
|
|
|
|
|
|
/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
|
2014-04-14 00:22:22 +02:00
|
|
|
* otherwise frequency is 2xAPBx.
|
2012-01-11 14:01:26 +01:00
|
|
|
* Note: TIM1,8 are on APB2, others on APB1
|
|
|
|
*/
|
|
|
|
|
2016-06-03 19:38:59 +02:00
|
|
|
#define BOARD_TIM1_FREQUENCY STM32_HCLK_FREQUENCY
|
|
|
|
#define BOARD_TIM2_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
|
|
|
#define BOARD_TIM3_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
|
|
|
#define BOARD_TIM4_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
|
|
|
#define BOARD_TIM5_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
|
|
|
#define BOARD_TIM6_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
|
|
|
#define BOARD_TIM7_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
|
|
|
#define BOARD_TIM8_FREQUENCY STM32_HCLK_FREQUENCY
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2014-09-20 20:55:23 +02:00
|
|
|
/* SDIO dividers. Note that slower clocking is required when DMA is disabled
|
|
|
|
* in order to avoid RX overrun/TX underrun errors due to delayed responses
|
|
|
|
* to service FIFOs in interrupt driven mode. These values have not been
|
|
|
|
* tuned!!!
|
|
|
|
*
|
|
|
|
* SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SDIO_INIT_CLKDIV (118 << SDIO_CLKCR_CLKDIV_SHIFT)
|
|
|
|
|
|
|
|
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
|
|
|
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_SDIO_DMA
|
|
|
|
# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
|
|
|
#else
|
|
|
|
# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
|
|
|
|
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_SDIO_DMA
|
|
|
|
# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
|
|
|
#else
|
|
|
|
# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
|
|
|
#endif
|
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* LED definitions **********************************************************/
|
2019-09-28 17:55:31 +02:00
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs
|
|
|
|
* in any way. The following definitions are used to access individual LEDs.
|
2012-01-11 14:01:26 +01:00
|
|
|
*/
|
|
|
|
|
2015-11-01 17:53:34 +01:00
|
|
|
/* LED index values for use with board_userled() */
|
2012-01-11 14:01:26 +01:00
|
|
|
|
|
|
|
#define BOARD_LED1 0
|
|
|
|
#define BOARD_LED2 1
|
|
|
|
#define BOARD_LED3 2
|
|
|
|
#define BOARD_LED4 3
|
|
|
|
#define BOARD_NLEDS 4
|
|
|
|
|
|
|
|
#define BOARD_LED_GREEN BOARD_LED1
|
|
|
|
#define BOARD_LED_ORANGE BOARD_LED2
|
|
|
|
#define BOARD_LED_RED BOARD_LED3
|
|
|
|
#define BOARD_LED_BLUE BOARD_LED4
|
|
|
|
|
2015-11-01 17:53:34 +01:00
|
|
|
/* LED bits for use with board_userled_all() */
|
2012-01-11 14:01:26 +01:00
|
|
|
|
|
|
|
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
|
|
|
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
|
|
|
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
|
|
|
#define BOARD_LED4_BIT (1 << BOARD_LED4)
|
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on
|
|
|
|
* board the stm32f4discovery. The following definitions describe how NuttX
|
|
|
|
* controls the LEDs:
|
2012-01-11 14:01:26 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define LED_STARTED 0 /* LED1 */
|
|
|
|
#define LED_HEAPALLOCATE 1 /* LED2 */
|
|
|
|
#define LED_IRQSENABLED 2 /* LED1 + LED2 */
|
|
|
|
#define LED_STACKCREATED 3 /* LED3 */
|
|
|
|
#define LED_INIRQ 4 /* LED1 + LED3 */
|
|
|
|
#define LED_SIGNAL 5 /* LED2 + LED3 */
|
|
|
|
#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
|
|
|
|
#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
|
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* Button definitions *******************************************************/
|
2019-09-28 17:55:31 +02:00
|
|
|
|
2012-01-11 14:01:26 +01:00
|
|
|
/* The STM32F4 Discovery supports one button: */
|
|
|
|
|
|
|
|
#define BUTTON_USER 0
|
|
|
|
#define NUM_BUTTONS 1
|
|
|
|
#define BUTTON_USER_BIT (1 << BUTTON_USER)
|
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* Alternate function pin selections ****************************************/
|
2019-09-28 17:55:31 +02:00
|
|
|
|
2015-10-08 21:38:01 +02:00
|
|
|
/* CAN */
|
2015-10-07 04:54:02 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_STM32_FSMC
|
|
|
|
# define GPIO_CAN1_RX GPIO_CAN1_RX_3
|
|
|
|
# define GPIO_CAN1_TX GPIO_CAN1_TX_3
|
|
|
|
#endif
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2015-10-08 21:38:01 +02:00
|
|
|
#ifndef CONFIG_STM32_ETHMAC
|
|
|
|
# define GPIO_CAN2_RX GPIO_CAN2_RX_1
|
|
|
|
# define GPIO_CAN2_TX GPIO_CAN2_TX_1
|
|
|
|
#endif
|
|
|
|
|
2018-04-13 18:36:23 +02:00
|
|
|
/* USART2:
|
2012-01-11 14:01:26 +01:00
|
|
|
*
|
|
|
|
* The STM32F4 Discovery has no on-board serial devices, but the console is
|
2014-09-13 15:28:14 +02:00
|
|
|
* brought out to PA2 (TX) and PA3 (RX) for connection to an external serial
|
|
|
|
* device. (See the README.txt file for other options)
|
|
|
|
*
|
2020-05-11 23:51:21 +02:00
|
|
|
* These pins selections, however, conflict with pin usage on the
|
|
|
|
* STM32F4DIS-BB.
|
2012-01-11 14:01:26 +01:00
|
|
|
*/
|
|
|
|
|
2014-09-29 14:49:55 +02:00
|
|
|
#ifndef CONFIG_STM32F4DISBB
|
2018-05-26 23:59:00 +02:00
|
|
|
# define GPIO_USART2_RX GPIO_USART2_RX_1 /* PA3, P1 pin 13 */
|
|
|
|
# define GPIO_USART2_TX GPIO_USART2_TX_1 /* PA2, P1 pin 14 */
|
|
|
|
# define GPIO_USART2_CTS GPIO_USART2_CTS_1 /* PA0, P1 pin 11 */
|
|
|
|
# define GPIO_USART2_RTS GPIO_USART2_RTS_1 /* PA1, P1 pin 12 (conflict with USER button) */
|
2014-09-13 15:28:14 +02:00
|
|
|
#endif
|
|
|
|
|
2018-04-13 18:36:23 +02:00
|
|
|
/* USART3:
|
|
|
|
*
|
|
|
|
* Used in pseudoterm configuration and also with the BT860 HCI UART.
|
2018-04-16 01:15:48 +02:00
|
|
|
* RTS/CTS Flow control support is needed by the HCI UART.
|
2018-04-16 23:24:17 +02:00
|
|
|
*
|
|
|
|
* There are conflicts with the STM32F4DIS-BB Ethernet in this configuration
|
|
|
|
* when Ethernet is enabled:
|
|
|
|
*
|
|
|
|
* PB-11 conflicts with Ethernet TXEN
|
|
|
|
* PB-13 conflicts with Ethernet TXD1
|
|
|
|
*
|
|
|
|
* UART3 TXD and RXD are available on CON4 PD8 and PD8 of the STM32F4DIS-BB,
|
|
|
|
* respectively, but not CTS or RTS. For now we assume that Ethernet is not
|
|
|
|
* enabled if USART3 is used in a configuration with the STM32F4DIS-BB.
|
2018-04-13 18:36:23 +02:00
|
|
|
*/
|
2016-07-16 19:30:43 +02:00
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_USART3_TX GPIO_USART3_TX_1 /* PB10, P1 pin 34 (also MP45DT02 CLK_IN) */
|
|
|
|
#define GPIO_USART3_RX GPIO_USART3_RX_1 /* PB11, P1 pin 35 */
|
|
|
|
#define GPIO_USART3_CTS GPIO_USART3_CTS_1 /* PB13, P1 pin 37 */
|
|
|
|
#define GPIO_USART3_RTS GPIO_USART3_RTS_1 /* PB14, P1 pin 38 */
|
2016-07-16 19:30:43 +02:00
|
|
|
|
2018-04-13 18:36:23 +02:00
|
|
|
/* USART6:
|
2014-09-13 15:28:14 +02:00
|
|
|
*
|
|
|
|
* The STM32F4DIS-BB base board provides RS-232 drivers and a DB9 connector
|
2020-05-11 23:51:21 +02:00
|
|
|
* for USART6. This is the preferred serial console for use with the
|
|
|
|
* STM32F4DIS-BB.
|
2018-05-26 23:59:00 +02:00
|
|
|
*
|
2020-05-11 23:51:21 +02:00
|
|
|
* NOTE: CTS and RTS are not brought out to the RS-232 connector on the
|
|
|
|
* baseboard.
|
2014-09-13 15:28:14 +02:00
|
|
|
*/
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_USART6_RX GPIO_USART6_RX_1 /* PC7 (also I2S3_MCK and P2 pin 48) */
|
|
|
|
#define GPIO_USART6_TX GPIO_USART6_TX_1 /* PC6 (also P2 pin 47) */
|
2012-01-11 14:01:26 +01:00
|
|
|
|
|
|
|
/* PWM
|
|
|
|
*
|
2020-05-11 23:51:21 +02:00
|
|
|
* The STM32F4 Discovery has no real on-board PWM devices, but the board
|
|
|
|
* can be configured to output a pulse train using TIM4 CH2 on PD13.
|
2012-01-11 14:01:26 +01:00
|
|
|
*/
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_TIM4_CH2OUT GPIO_TIM4_CH2OUT_2
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2016-02-22 15:52:24 +01:00
|
|
|
/* RGB LED
|
|
|
|
*
|
|
|
|
* R = TIM1 CH1 on PE9 | G = TIM2 CH2 on PA1 | B = TIM3 CH3 on PB0
|
|
|
|
*/
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_TIM1_CH1OUT GPIO_TIM1_CH1OUT_2
|
|
|
|
#define GPIO_TIM2_CH2OUT GPIO_TIM2_CH2OUT_1
|
|
|
|
#define GPIO_TIM3_CH3OUT GPIO_TIM3_CH3OUT_1
|
2016-02-22 15:52:24 +01:00
|
|
|
|
2012-11-08 15:10:24 +01:00
|
|
|
/* SPI - There is a MEMS device on SPI1 using these pins: */
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1
|
|
|
|
#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1
|
|
|
|
#define GPIO_SPI1_SCK GPIO_SPI1_SCK_1
|
2012-01-11 14:01:26 +01:00
|
|
|
|
2018-05-20 00:12:21 +02:00
|
|
|
/* SPI DMA -- As used for I2S DMA transfer with the audio configuration */
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define DMACHAN_SPI1_RX DMAMAP_SPI1_RX_1
|
|
|
|
#define DMACHAN_SPI1_TX DMAMAP_SPI1_TX_1
|
2018-05-20 00:12:21 +02:00
|
|
|
|
2015-09-13 23:50:02 +02:00
|
|
|
/* SPI2 - Test MAX31855 on SPI2 PB10 = SCK, PB14 = MISO */
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_SPI2_MISO GPIO_SPI2_MISO_1
|
|
|
|
#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_1
|
|
|
|
#define GPIO_SPI2_SCK GPIO_SPI2_SCK_1
|
2015-09-13 23:50:02 +02:00
|
|
|
|
2019-10-18 04:38:16 +02:00
|
|
|
/* SPI2 DMA -- As used for MMC/SD SPI */
|
|
|
|
|
|
|
|
#define DMACHAN_SPI2_RX DMAMAP_SPI2_RX
|
|
|
|
#define DMACHAN_SPI2_TX DMAMAP_SPI2_TX
|
|
|
|
|
2018-05-20 00:12:21 +02:00
|
|
|
/* SPI3 DMA -- As used for I2S DMA transfer with the audio configuration */
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_SPI3_MISO GPIO_SPI3_MISO_1
|
|
|
|
#define GPIO_SPI3_MOSI GPIO_SPI3_MOSI_1
|
|
|
|
#define GPIO_SPI3_SCK GPIO_SPI3_SCK_1
|
2018-05-20 00:12:21 +02:00
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define DMACHAN_SPI3_RX DMAMAP_SPI3_RX_1
|
|
|
|
#define DMACHAN_SPI3_TX DMAMAP_SPI3_TX_1
|
2018-05-20 00:12:21 +02:00
|
|
|
|
2017-06-16 17:34:22 +02:00
|
|
|
/* I2S3 - CS43L22 configuration uses I2S3 */
|
2017-05-21 22:14:09 +02:00
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_I2S3_SD GPIO_I2S3_SD_2
|
|
|
|
#define GPIO_I2S3_CK GPIO_I2S3_CK_2
|
|
|
|
#define GPIO_I2S3_WS GPIO_I2S3_WS_1
|
2017-05-21 22:14:09 +02:00
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define DMACHAN_I2S3_RX DMAMAP_SPI3_RX_2
|
|
|
|
#define DMACHAN_I2S3_TX DMAMAP_SPI3_TX_2
|
2017-05-21 22:14:09 +02:00
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* I2C. Only I2C1 is available on the stm32f4discovery. I2C1_SCL and
|
|
|
|
* I2C1_SDA are available on the following pins:
|
2017-05-21 22:14:09 +02:00
|
|
|
*
|
|
|
|
* - PB6 is I2C1_SCL
|
|
|
|
* - PB9 is I2C1_SDA
|
|
|
|
*/
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
|
|
|
|
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_2
|
2015-07-20 15:22:01 +02:00
|
|
|
|
2012-02-15 18:51:30 +01:00
|
|
|
/* Timer Inputs/Outputs (see the README.txt file for options) */
|
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_TIM2_CH1IN GPIO_TIM2_CH1IN_2
|
|
|
|
#define GPIO_TIM2_CH2IN GPIO_TIM2_CH2IN_1
|
2012-02-15 18:51:30 +01:00
|
|
|
|
2018-05-26 23:59:00 +02:00
|
|
|
#define GPIO_TIM8_CH1IN GPIO_TIM8_CH1IN_1
|
|
|
|
#define GPIO_TIM8_CH2IN GPIO_TIM8_CH2IN_1
|
2012-02-25 01:19:13 +01:00
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* Ethernet *****************************************************************/
|
2014-09-13 15:28:14 +02:00
|
|
|
|
|
|
|
#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 */
|
|
|
|
|
2014-09-19 21:43:35 +02:00
|
|
|
# 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
|
2014-09-13 15:28:14 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-10-18 04:38:16 +02:00
|
|
|
#ifdef CONFIG_MMCSD_SPI
|
|
|
|
#define GPIO_MMCSD_NSS (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | \
|
|
|
|
GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN12)
|
|
|
|
|
|
|
|
#define GPIO_MMCSD_NCD (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | \
|
|
|
|
GPIO_PORTC | GPIO_PIN1)
|
|
|
|
#endif
|
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* DMA Channel/Stream Selections ********************************************/
|
2019-09-28 17:55:31 +02:00
|
|
|
|
2020-05-11 23:51:21 +02:00
|
|
|
/* Stream selections are arbitrary for now but might become important in the
|
|
|
|
* future if we set aside more DMA channels/streams.
|
2014-09-20 20:55:23 +02:00
|
|
|
*
|
|
|
|
* SDIO DMA
|
|
|
|
* DMAMAP_SDIO_1 = Channel 4, Stream 3
|
|
|
|
* DMAMAP_SDIO_2 = Channel 4, Stream 6
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define DMAMAP_SDIO DMAMAP_SDIO_1
|
|
|
|
|
2020-05-11 23:45:14 +02:00
|
|
|
/* ZERO CROSS pin definition */
|
|
|
|
|
|
|
|
#define BOARD_ZEROCROSS_GPIO \
|
|
|
|
(GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTD|GPIO_PIN0)
|
|
|
|
|
2020-05-12 22:19:26 +02:00
|
|
|
/* LIS3DSH */
|
|
|
|
|
|
|
|
#define GPIO_LIS3DSH_EXT0 \
|
|
|
|
(GPIO_INPUT|GPIO_FLOAT|GPIO_AF0|GPIO_SPEED_50MHz|GPIO_PORTE|GPIO_PIN0)
|
|
|
|
|
|
|
|
#define BOARD_LIS3DSH_GPIO_EXT0 GPIO_LIS3DSH_EXT0
|
|
|
|
|
|
|
|
/* XEN1210 magnetic sensor */
|
|
|
|
|
|
|
|
#define GPIO_XEN1210_INT (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|\
|
|
|
|
GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN5)
|
|
|
|
|
|
|
|
#define GPIO_CS_XEN1210 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
|
|
|
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
|
|
|
|
|
|
|
|
#define BOARD_XEN1210_GPIO_INT GPIO_XEN1210_INT
|
|
|
|
|
|
|
|
/* Define what timer to use as XEN1210 CLK (will use channel 1) */
|
|
|
|
|
|
|
|
#define BOARD_XEN1210_PWMTIMER 1
|
|
|
|
|
2020-01-31 19:07:39 +01:00
|
|
|
#endif /* __BOARDS_ARM_STM32_STM32F4DISCOVERY_INCLUDE_BOARD_H */
|