8000 stmhal: Add support for the STM32F401NUCLEO board. · micropython/micropython@3d42aa0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d42aa0

Browse files
cnoviellodpgeorge
authored andcommitted
stmhal: Add support for the STM32F401NUCLEO board.
Includes full version of pins.csv file with correct mapping of the Nucleo STM32F401RE chip (LQFP64 package).
1 parent ac11e89 commit 3d42aa0

File tree

4 files changed

+500
-0
lines changed

4 files changed

+500
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#define MICROPY_HW_BOARD_NAME "F401NUCLEO"
2+
#define MICROPY_HW_MCU_NAME "STM32F401xE"
3+
4+
#define MICROPY_HW_HAS_SWITCH (1)
5+
#define MICROPY_HW_ENABLE_RTC (1)
6+
7+
// HSE is 8MHz, CPU freq set to 84MHz
8+
#define MICROPY_HW_CLK_PLLM (8)
9+
#define MICROPY_HW_CLK_PLLN (336)
10+
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV4)
11+
#define MICROPY_HW_CLK_PLLQ (7)
12+
13+
// UART config
14+
#define MICROPY_HW_UART2_PORT (GPIOA)
15+
#define MICROPY_HW_UART2_PINS (GPIO_PIN_2 | GPIO_PIN_3)
16+
#define MICROPY_HW_UART6_PORT (GPIOC)
17+
#define MICROPY_HW_UART6_PINS (GPIO_PIN_6 | GPIO_PIN_7)
18+
19+
// I2C busses
20+
#define MICROPY_HW_I2C1_SCL (pin_B6)
21+
#define MICROPY_HW_I2C1_SDA (pin_B7)
22+
23+
// USRSW is pulled low. Pressing the button makes the input go high.
24+
#define MICROPY_HW_USRSW_PIN (pin_C13)
25+
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
26+
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
27+
#define MICROPY_HW_USRSW_PRESSED (0)
28+
29+
// LEDs
30+
#define MICROPY_HW_LED1 (pin_A5) // Green LD2 LED on Nucleo
31+
#define MICROPY_HW_LED_OTYPE (GPIO_MODE_OUTPUT_PP)
32+
#define MICROPY_HW_LED_ON(pin) (pin->gpio->BSRRL = pin->pin_mask)
33+
#define MICROPY_HW_LED_OFF(pin) (pin->gpio->BSRRH = pin->pin_mask)
34+
35+
// USB config
36+
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
37+
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MCU_SERIES = f4
2+
CMSIS_MCU = STM32F401xE
3+
AF_FILE = boards/stm32f401_af.csv
4+
LD_FILE = boards/stm32f401.ld
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
PC0,PC0
2+
PC1,PC1
3+
PC2,PC2
4+
PC3,PC3
5+
PA0,PA0
6+
PA1,PA1
7+
PA2,PA2
8+
PA3,PA3
9+
PA4,PA4
10+
PA5,PA5
11+
PA6,PA6
12+
PA7,PA7
13+
PC4,PC4
14+
PC5,PC5
15+
PB0,PB0
16+
PB1,PB1
17+
PB2,PB2
18+
PB10,PB10
19+
PB12,PB12
20+
PB13,PB13
21+
PB14,PB14
22+
PB15,PB15
23+
PC6,PC6
24+
PC7,PC7
25+
PC8,PC8
26+
PC9,PC9
27+
PA8,PA8
28+
PA9,PA9
29+
PA10,PA10
30+
PA13,PA13
31+
PA14,PA14
32+
PA15,PA15
33+
PC10,PC10
34+
PC11,PC11
35+
PC12,PC12
36+
PD2,PD2
37+
PB4,PB4
38+
PB5,PB5
39+
PB6,PB6
40+
PB7,PB7
41+
PB8,PB8
42+
PB9,PB9
43+
PC13,PC13
44+
PC14,PC14
45+
PC15,PC15
46+
PH0,PH0
47+
PH1,PH1
48+
LED_GREEN,PA5
49+
LED_ORANGE,PA5
50+
LED_RED,PA5
51+
LED_BLUE,PA4
52+
SW,PC13

0 commit comments

Comments
 (0)
0