Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit 551a731

Browse files
dhylandsdpgeorge
authored andcommitted
stmhal: Add support for NUCLEO_F446RE board.
1 parent 9db1c50 commit 551a731

File tree

6 files changed

+555
-2
lines changed

6 files changed

+555
-2
lines changed

stmhal/adc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
#elif defined(STM32F427xx) || defined(STM32F429xx) || \
9494
defined(STM32F437xx) || defined(STM32F439xx) || \
9595
defined(STM32F746xx) || defined(STM32F767xx) || \
96-
defined(STM32F769xx)
96+
defined(STM32F769xx) || defined(STM32F446xx)
9797
#define VBAT_DIV (4)
9898
#elif defined(STM32L476xx)
9999
#define VBAT_DIV (3)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#define MICROPY_HW_BOARD_NAME "NUCLEO-F446RE"
2+
#define MICROPY_HW_MCU_NAME "STM32F446xx"
3+
4+
#define MICROPY_HW_HAS_SWITCH (1)
5+
#define MICROPY_HW_HAS_FLASH (1)
6+
#define MICROPY_HW_ENABLE_RTC (1)
7+
8+
// HSE is 8MHz, CPU freq set to 168MHz. Using PLLQ for USB this gives a nice
9+
// 48 MHz clock for USB. To goto 180 MHz, I think that USB would need to be
10+
// configured to use PLLSAI
11+
#define MICROPY_HW_CLK_PLLM (8)
12+
#define MICROPY_HW_CLK_PLLN (336)
13+
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
14+
#define MICROPY_HW_CLK_PLLQ (7)
15+
16+
// UART config
17+
#define MICROPY_HW_UART2_TX (pin_A2)
18+
#define MICROPY_HW_UART2_RX (pin_A3)
19+
#define MICROPY_HW_UART6_TX (pin_C6)
20+
#define MICROPY_HW_UART6_RX (pin_C7)
21+
// UART 2 connects to the STM32F103 (STLINK) on the Nucleo board
22+
// and this is exposed as a USB Serial port.
23+
#define MICROPY_HW_UART_REPL PYB_UART_2
24+
#define MICROPY_HW_UART_REPL_BAUD 115200
25+
26+
// I2C busses
27+
#define MICROPY_HW_I2C1_SCL (pin_B6) // Arduino D10, pin 17 on CN10
28+
#define MICROPY_HW_I2C1_SDA (pin_B7) // pin 21 on CN7
29+
#define MICROPY_HW_I2C2_SCL (pin_B10) // Arduino D6, pin 25 on CN10
30+
#define MICROPY_HW_I2C2_SDA (pin_B3) // Arduino D3, pin 31 on CN10
31+
#define MICROPY_HW_I2C3_SCL (pin_A8) // Arduino D7, pin 23 on CN10
32+
#define MICROPY_HW_I2C3_SDA (pin_C9) // pin 1 on CN10
33+
34+
// SPI busses
35+
#define MICROPY_HW_SPI1_NSS (pin_A15) // pin 17 on CN7
36+
#define MICROPY_HW_SPI1_SCK (pin_A5) // Arduino D13, pin 11 on CN10
37+
#define MICROPY_HW_SPI1_MISO (pin_A6) // Arduino D12, pin 13 on CN10
38+
#define MICROPY_HW_SPI1_MOSI (pin_A7) // Arduino D11, pin 15 on CN10
39+
40+
#define MICROPY_HW_SPI2_NSS (pin_B12) // pin 16 on CN10
41+
#define MICROPY_HW_SPI2_SCK (pin_B13) // pin 30 on CN10
42+
#define MICROPY_HW_SPI2_MISO (pin_B14) // pin 28 on CN10
43+
#define MICROPY_HW_SPI2_MOSI (pin_B15) // pin 26 on CN10
44+
45+
#define MICROPY_HW_SPI3_NSS (pin_A4) // Arduino A2, pin 32 on CN7
46+
#define MICROPY_HW_SPI3_SCK (pin_B3) // Arduino D3, pin 31 on CN10
47+
#define MICROPY_HW_SPI3_MISO (pin_B4) // Arduino D5, pin 27 on CN10
48+
#define MICROPY_HW_SPI3_MOSI (pin_B5) // Arduino D4, pin 29 on CN10
49+
50+
#define MICROPY_HW_SPI4_NSS (pin_B12) // pin 16 on CN10
51+
#define MICROPY_HW_SPI4_SCK (pin_B13) // pin 30 on CN10
52+
#define MICROPY_HW_SPI4_MISO (pin_A1) // pin 30 on CN7
53+
#define MICROPY_HW_SPI4_MOSI (pin_A11) // pin 14 on CN10
54+
55+
// USRSW is pulled low. Pressing the button makes the input go high.
56+
#define MICROPY_HW_USRSW_PIN (pin_C13)
57+
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
58+
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
59+
#define MICROPY_HW_USRSW_PRESSED (0)
60+
61+
// LEDs
62+
#define MICROPY_HW_LED1 (pin_A5) // Green LD2 LED on Nucleo
63+
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
64+
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
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 = STM32F446xx
3+
AF_FILE = boards/stm32f429_af.csv
4+
LD_FILE = boards/stm32f411.ld

stmhal/boards/NUCLEO_F446RE/pins.csv

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
D0,PA3
2+
D1,PA2
3+
D2,PA10
4+
D3,PB3
5+
D4,PB5
6+
D5,PB4
7+
D6,PB10
8+
D7,PA8
9+
D8,PA9
10+
D9,PC7
11+
D10,PB6
12+
D11,PA7
13+
D12,PA6
14+
D13,PA5
15+
D14,PB9
16+
D15,PB8
17+
A0,PA0
18+
A1,PA1
19+
A2,PA4
20+
A3,PB0
21+
A4,PC1
22+
A5,PC0
23+
PA0,PA0
24+
PA1,PA1
25+
PA2,PA2
26+
PA3,PA3
27+
PA4,PA4
28+
PA5,PA5
29+
PA6,PA6
30+
PA7,PA7
31+
PA8,PA8
32+
PA9,PA9
33+
PA10,PA10
34+
PA11,PA11
35+
PA12,PA12
36+
PA15,PA15
37+
PB0,PB0
38+
PB1,PB1
39+
PB2,PB2
40+
PB3,PB3
41+
PB4,PB4
42+
PB5,PB5
43+
PB6,PB6
44+
PB7,PB7
45+
PB8,PB8
46+
PB9,PB9
47+
PB10,PB10
48+
PB12,PB12
49+
PB13,PB13
50+
PB14,PB14
51+
PB15,PB15
52+
PC0,PC0
53+
PC1,PC1
54+
PC2,PC2
55+
PC3,PC3
56+
PC4,PC4
57+
PC5,PC5
58+
PC6,PC6
59+
PC7,PC7
60+
PC8,PC8
61+
PC9,PC9
62+
PC10,PC10
63+
PC11,PC11
64+
PC12,PC12
65+
PC13,PC13
66+
PC14,PC14
67+
PC15,PC15
68+
PD2,PD2
69+
PH0,PH0
70+
PH1,PH1
71+
LED,PA5
72+
SW,PC13

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy