Skip to content

Commit 7373338

Browse files
yn386dpgeorge
authored andcommitted
stm32/boards/NUCLEO_H7A3ZI_Q: Add NUCLEO_H7A3ZI_Q board support.
This change adds NUCLEO_H7A3ZI_Q Core Board support to the STM32 port. NUCLEO_H7A3ZI_Q: https://www.st.com/en/evaluation-tools/nucleo-h7a3zi-q.html This board uses STM32H7A3ZI: https://www.st.com/en/microcontrollers-microprocessors/stm32h7a3zi.html Signed-off-by: Yuuki NAGAO <[email protected]>
1 parent a9d04ed commit 7373338

File tree

7 files changed

+336
-0
lines changed

7 files changed

+336
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"deploy": [
3+
"../deploy.md"
4+
],
5+
"docs": "",
6+
"features": [],
7+
"images": [
8+
"nucleo_h7a3zi_q.jpg"
9+
],
10+
"mcu": "stm32h7",
11+
"product": "Nucleo H7A3ZI-Q",
12+
"thumbnail": "",
13+
"url": "https://www.st.com/ja/evaluation-tools/nucleo-h7a3zi-q.html",
14+
"vendor": "ST Microelectronics"
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "py/mphal.h"
2+
3+
void NUCLEO_H7A3ZIQ_board_early_init(void) {
4+
// Turn off the USB switch.
5+
mp_hal_pin_output(pyb_pin_OTG_FS_POWER);
6+
mp_hal_pin_low(pyb_pin_OTG_FS_POWER);
7+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#define MICROPY_HW_BOARD_NAME "NUCLEO_H7A3ZI_Q"
2+
#define MICROPY_HW_MCU_NAME "STM32H7A3ZIT6Q"
3+
4+
#define MICROPY_HW_ENABLE_RTC (1)
5+
#define MICROPY_HW_ENABLE_SERVO (1)
6+
#define MICROPY_HW_ENABLE_RNG (0) // RNG needs proper configuration
7+
#define MICROPY_HW_ENABLE_ADC (1)
8+
#define MICROPY_HW_ENABLE_DAC (1)
9+
#define MICROPY_HW_ENABLE_USB (1)
10+
#define MICROPY_HW_ENABLE_SDCARD (0)
11+
#define MICROPY_HW_HAS_SWITCH (1)
12+
#define MICROPY_HW_HAS_FLASH (1)
13+
14+
#define MICROPY_BOARD_EARLY_INIT NUCLEO_H7A3ZIQ_board_early_init
15+
16+
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)
17+
18+
// There is no external HS crystal, instead it comes from ST-LINK MCO output which is 8MHz.
19+
// The following gives a 280Hz CPU speed.
20+
#define MICROPY_HW_CLK_USE_BYPASS (1)
21+
#define MICROPY_HW_CLK_PLLM (2)
22+
#define MICROPY_HW_CLK_PLLN (140)
23+
#define MICROPY_HW_CLK_PLLP (2)
24+
#define MICROPY_HW_CLK_PLLQ (4)
25+
#define MICROPY_HW_CLK_PLLR (2)
26+
#define MICROPY_HW_CLK_PLLVCI (RCC_PLL1VCIRANGE_2)
27+
#define MICROPY_HW_CLK_PLLVCO (RCC_PLL1VCOWIDE)
28+
#define MICROPY_HW_CLK_PLLFRAC (0)
29+
30+
// The USB clock is set using PLL3
31+
#define MICROPY_HW_CLK_PLL3M (1)
32+
#define MICROPY_HW_CLK_PLL3N (24)
33+
#define MICROPY_HW_CLK_PLL3P (2)
34+
#define MICROPY_HW_CLK_PLL3Q (4)
35+
#define MICROPY_HW_CLK_PLL3R (2)
36+
#define MICROPY_HW_CLK_PLL3VCI (RCC_PLL3VCIRANGE_3)
37+
#define MICROPY_HW_CLK_PLL3VCO (RCC_PLL3VCOWIDE)
38+
#define MICROPY_HW_CLK_PLL3FRAC (0)
39+
40+
// 6 wait states when running at 280MHz (VOS0 range)
41+
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_6
42+
43+
// The board has an external 32kHz crystal attached
44+
#define MICROPY_HW_RTC_USE_LSE (1)
45+
46+
// SMPS configuration
47+
#define MICROPY_HW_PWR_SMPS_CONFIG (PWR_DIRECT_SMPS_SUPPLY)
48+
49+
// UART config
50+
#define MICROPY_HW_UART1_TX (pin_B14) // Arduino D1, pin14 on CN10
51+
#define MICROPY_HW_UART1_RX (pin_B15) // Arduino D0, pin16 on CN10
52+
#define MICROPY_HW_UART2_TX (pin_D5) // pin 6 on CN9
53+
#define MICROPY_HW_UART2_RX (pin_D6) // pin 4 on CN9
54+
#define MICROPY_HW_UART2_RTS (pin_D4) // pin 8 on CN9
55+
#define MICROPY_HW_UART2_CTS (pin_D3) // pin10 on CN9
56+
#define MICROPY_HW_UART3_TX (pin_D8)
57+
#define MICROPY_HW_UART3_RX (pin_D9)
58+
#define MICROPY_HW_UART5_TX (pin_B6)
59+
#define MICROPY_HW_UART5_RX (pin_B12)
60+
#define MICROPY_HW_UART6_TX (pin_C6)
61+
#define MICROPY_HW_UART6_RX (pin_C7)
62+
#define MICROPY_HW_UART7_TX (pin_F7)
63+
#define MICROPY_HW_UART7_RX (pin_F6)
64+
#define MICROPY_HW_UART8_TX (pin_E1)
65+
#define MICROPY_HW_UART8_RX (pin_E0)
66+
67+
// UART3 connects to the STLINK-V3 on the Nucleo board
68+
// and this is exposed as a USB Serial port.
69+
#define MICROPY_HW_UART_REPL PYB_UART_3
70+
#define MICROPY_HW_UART_REPL_BAUD 115200
71+
72+
// I2C buses
73+
#define MICROPY_HW_I2C1_SCL (pin_B8) // Arduino D15, pin 2 on CN7
74+
#define MICROPY_HW_I2C1_SDA (pin_B9) // Arduino D14, pin 4 on CN7
75+
#define MICROPY_HW_I2C4_SCL (pin_F14) // pin19 on CN9
76+
#define MICROPY_HW_I2C4_SDA (pin_F15) // pin12 on CN9
77+
78+
// SPI buses
79+
#define MICROPY_HW_SPI1_NSS (pin_A4) // pin17 on CN7
80+
#define MICROPY_HW_SPI1_SCK (pin_A5) // Arduino D13, pin10 on CN7
81+
#define MICROPY_HW_SPI1_MISO (pin_A6) // Arduino D12, pin12 on CN7
82+
#define MICROPY_HW_SPI1_MOSI (pin_A7) // Arduino D11, pin14 on CN7
83+
#define MICROPY_HW_SPI2_NSS (pin_B12)
84+
#define MICROPY_HW_SPI2_SCK (pin_B10)
85+
#define MICROPY_HW_SPI2_MISO (pin_C2)
86+
#define MICROPY_HW_SPI2_MOSI (pin_C1)
87+
#define MICROPY_HW_SPI3_NSS (pin_A15)
88+
#define MICROPY_HW_SPI3_SCK (pin_B2)
89+
#define MICROPY_HW_SPI3_MISO (pin_C10)
90+
#define MICROPY_HW_SPI3_MOSI (pin_C11)
91+
92+
// USRSW is pulled low. Pressing the button makes the input go high.
93+
#define MICROPY_HW_USRSW_PIN (pin_C13)
94+
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
95+
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
96+
#define MICROPY_HW_USRSW_PRESSED (1)
97+
98+
// LEDs
99+
#define MICROPY_HW_LED1 (pin_B0) // green
100+
#define MICROPY_HW_LED2 (pin_E1) // yellow
101+
#define MICROPY_HW_LED3 (pin_B14) // red
102+
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
103+
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
104+
105+
// USB config
106+
#define MICROPY_HW_USB_HS (1)
107+
#define MICROPY_HW_USB_HS_IN_FS (1)
108+
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
109+
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
110+
111+
// FDCAN bus
112+
#define MICROPY_HW_CAN1_NAME "FDCAN1"
113+
#define MICROPY_HW_CAN1_TX (pin_D1)
114+
#define MICROPY_HW_CAN1_RX (pin_D0)
115+
116+
void NUCLEO_H7A3ZIQ_board_early_init(void);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
USE_MBOOT ?= 0
2+
3+
# MCU settings
4+
MCU_SERIES = h7
5+
CMSIS_MCU = STM32H7A3xxQ
6+
MICROPY_FLOAT_IMPL = double
7+
AF_FILE = boards/stm32h7b3_af.csv
8+
9+
ifeq ($(USE_MBOOT),1)
10+
# When using Mboot all the text goes together after the filesystem
11+
LD_FILES = boards/stm32h743.ld boards/common_blifs.ld
12+
TEXT0_ADDR = 0x08040000
13+
else
14+
# When not using Mboot the ISR text goes first, then the rest after the filesystem
15+
LD_FILES = boards/stm32h7a3.ld boards/common_basic.ld
16+
TEXT0_ADDR = 0x08000000
17+
endif
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
A0,PA3
2+
A1,PC0
3+
A2,PC3
4+
A3,PB1
5+
A4,PC2
6+
A5,PF11
7+
A6,PC1
8+
A7,PC5
9+
A8,PA2
10+
D0,PB7
11+
D1,PB6
12+
D2,PG14
13+
D3,PE13
14+
D4,PE14
15+
D5,PE11
16+
D6,PA8
17+
D7,PG12
18+
D8,PG9
19+
D9,PD15
20+
D10,PD14
21+
D11,PA7
22+
D12,PA6
23+
D13,PA5
24+
D14,PB9
25+
D15,PB8
26+
D16,PC6
27+
D17,PB15
28+
D18,PB13
29+
D19,PB12
30+
D20,PA15
31+
D21,PC7
32+
D22,PB5
33+
D23,PB3
34+
D24,PA4
35+
D25,PB4
36+
D26,PG6
37+
D27,PB2
38+
D28,PD13
39+
D29,PD12
40+
D30,PD11
41+
D31,PE2
42+
D32,PA0
43+
D33,PB0
44+
D34,PE0
45+
D35,PB11
46+
D36,PB10
47+
D37,PE15
48+
D38,PE6
49+
D39,PE12
50+
D40,PE10
51+
D41,PE7
52+
D42,PE8
53+
D43,PC8
54+
D44,PC9
55+
D45,PC10
56+
D46,PC11
57+
D47,PC12
58+
D48,PD2
59+
D49,PG10
60+
D50,PG8
61+
D51,PD7
62+
D52,PD6
63+
D53,PD5
64+
D54,PD4
65+
D55,PD3
66+
D56,PE2
67+
D57,PE4
68+
D58,PE5
69+
D59,PE6
70+
D60,PE3
71+
D61,PF8
72+
D62,PF7
73+
D63,PF9
74+
D64,PD10
75+
D65,PB14
76+
D66,PD1
77+
D67,PD0
78+
D68,PF15
79+
D69,PF14
80+
D70,PB5
81+
D71,PE9
82+
D72,PB2
83+
DAC1,PA4
84+
DAC2,PA5
85+
LED1,PB0
86+
LED2,PE1
87+
LED3,PB14
88+
SW,PC13
89+
I2C1_SDA,PB9
90+
I2C1_SCL,PB8
91+
I2C4_SCL,PF14
92+
I2C4_SDA,PF15
93+
OTG_FS_POWER,PD10
94+
OTG_FS_OVER_CURRENT,PG7
95+
USB_VBUS,PA9
96+
USB_ID,PA10
97+
USB_DM,PA11
98+
USB_DP,PA12
99+
UART1_TX,PB14
100+
UART1_RX,PB15
101+
UART2_TX,PD5
102+
UART2_RX,PD6
103+
UART2_RTS,PD4
104+
UART2_CTS,PD3
105+
UART3_TX,PD8
106+
UART3_RX,PD9
107+
UART5_TX,PB6
108+
UART5_RX,PB12
109+
UART6_TX,PC6
110+
UART6_RX,PC7
111+
UART7_TX,PF7
112+
UART7_RX,PF6
113+
UART8_TX,PE1
114+
UART8_RX,PE0
115+
,PC1
116+
,PA2
117+
,PA1
118+
,PA7
119+
,PC4
120+
,PC5
121+
,PG11
122+
,PG13
123+
,PB13
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* This file is part of the MicroPython project, http://micropython.org/
2+
* The MIT License (MIT)
3+
* Copyright (c) 2019 Damien P. George
4+
*/
5+
#ifndef MICROPY_INCLUDED_STM32H7XX_HAL_CONF_H
6+
#define MICROPY_INCLUDED_STM32H7XX_HAL_CONF_H
7+
8+
// Oscillator values in Hz
9+
#define HSE_VALUE (8000000)
10+
#define LSE_VALUE (32768)
11+
#define EXTERNAL_CLOCK_VALUE (12288000)
12+
13+
// Oscillator timeouts in ms
14+
#define HSE_STARTUP_TIMEOUT (5000)
15+
#define LSE_STARTUP_TIMEOUT (5000)
16+
17+
#include "boards/stm32h7xx_hal_conf_base.h"
18+
19+
#endif // MICROPY_INCLUDED_STM32H7XX_HAL_CONF_H

ports/stm32/boards/stm32h7a3.ld

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
GNU linker script for STM32H7A3
3+
*/
4+
5+
/* Specify the memory areas */
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* sectors 0- 15, 128K */
9+
FLASH_APP (rx) : ORIGIN = 0x08020000, LENGTH = 1664K /* sectors 16-223, 1664K */
10+
FLASH_FS (r) : ORIGIN = 0x081c0000, LENGTH = 256K /* sectors 224-255, 256K */
11+
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 120K /* Used for storage cache */
12+
FS_CACHE (xrw) : ORIGIN = 0x2001e000, LENGTH = 8K /* Used for storage cache */
13+
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 1024K
14+
RAM_CD (xrw) : ORIGIN = 0x30000000, LENGTH = 128K
15+
RAM_SRD (xrw) : ORIGIN = 0x38000000, LENGTH = 32K
16+
}
17+
18+
/* produce a link error if there is not this amount of RAM for these sections */
19+
_minimum_stack_size = 2K;
20+
_minimum_heap_size = 16K;
21+
22+
/* Define the stack. The stack is full descending so begins just above last byte
23+
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
24+
_estack = ORIGIN(RAM) + LENGTH(RAM) - _estack_reserve;
25+
_sstack = _estack - 16K; /* tunable */
26+
27+
/* RAM extents for the garbage collector */
28+
_ram_start = ORIGIN(RAM);
29+
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
30+
_heap_start = _ebss; /* heap starts just after statically allocated memory */
31+
_heap_end = _sstack;
32+
33+
/* Location of filesystem RAM cache */
34+
_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(FS_CACHE);
35+
_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(FS_CACHE) + LENGTH(FS_CACHE);
36+
37+
/* Location of filesystem flash storage */
38+
_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS);
39+
_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS);

0 commit comments

Comments
 (0)