8000 stm32/boards/STM32H573I_DK: Add H5 board definition files. · duncf/micropython@6f74146 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f74146

Browse files
committed
stm32/boards/STM32H573I_DK: Add H5 board definition files.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 56a22dd commit 6f74146

File tree

5 files changed

+341
-0
lines changed

5 files changed

+341
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2023 Damien P. George
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "storage.h"
28+
#include "octospi.h"
29+
30+
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
31+
static mp_spiflash_cache_t spi_bdev_cache;
32+
#endif
33+
34+
// External SPI flash uses hardware OCTOSPI interface (in 1-line mode).
35+
36+
const mp_spiflash_config_t spiflash_config = {
37+
.bus_kind = MP_SPIFLASH_BUS_QSPI, // spiflash driver doesn't yet support OSPI
38+
.bus.u_qspi.data = NULL,
39+
.bus.u_qspi.proto = &octospi_proto,
40+
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
41+
.cache = &spi_bdev_cache,
42+
#endif
43+
};
44+
45+
spi_bdev_t spi_bdev;
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#define MICROPY_HW_BOARD_NAME "STM32H573I-DK"
2+
#define MICROPY_HW_MCU_NAME "STM32H573IIK3Q"
3+
4+
#define MICROPY_PY_PYB_LEGACY (0)
5+
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
6+
#define MICROPY_HW_ENABLE_RTC (1)
7+
#define MICROPY_HW_ENABLE_RNG (1)
8+
#define MICROPY_HW_ENABLE_ADC (1)
9+
#define MICROPY_HW_ENABLE_DAC (0) // requires DMA
10+
#define MICROPY_HW_ENABLE_USB (1)
11+
#define MICROPY_HW_HAS_SWITCH (1)
12+
#define MICROPY_HW_HAS_FLASH (1)
13+
14+
#if 1
15+
// The board has a 25MHz oscillator, the following gives 250MHz CPU speed
16+
#define MICROPY_HW_CLK_USE_BYPASS (1)
17+
#define MICROPY_HW_CLK_PLLM (5)
18+
#define MICROPY_HW_CLK_PLLN (100)
19+
#define MICROPY_HW_CLK_PLLP (2)
20+
#define MICROPY_HW_CLK_PLLQ (2)
21+
#define MICROPY_HW_CLK_PLLR (2)
22+
#define MICROPY_HW_CLK_PLLVCI_LL (LL_RCC_PLLINPUTRANGE_4_8)
23+
#define MICROPY_HW_CLK_PLLVCO_LL (LL_RCC_PLLVCORANGE_WIDE)
24+
#define MICROPY_HW_CLK_PLLFRAC (0)
25+
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_5
26+
#else
27+
// Use 64MHz HSI to clock the CPU at 200MHz
28+
#define MICROPY_HW_CLK_USE_HSI (1) // 64MHz
29+
#define MICROPY_HW_CLK_PLLM (16)
30+
#define MICROPY_HW_CLK_PLLN (100)
31+
#define MICROPY_HW_CLK_PLLP (2)
32+
#define MICROPY_HW_CLK_PLLQ (2)
33+
#define MICROPY_HW_CLK_PLLR (2)
34+
#define MICROPY_HW_CLK_PLLVCI_LL (LL_RCC_PLLINPUTRANGE_4_8)
35+
#define MICROPY_HW_CLK_PLLVCO_LL (LL_RCC_PLLVCORANGE_WIDE)
36+
#define MICROPY_HW_CLK_PLLFRAC (0)
37+
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_4 // VOS0, 168-210MHz
38+
#endif
39+
40+
// PLL3 with Q output at 48MHz for USB
41+
#define MICROPY_HW_CLK_PLL3M (25)
42+
#define MICROPY_HW_CLK_PLL3N (192)
43+
#define MICROPY_HW_CLK_PLL3P (2)
44+
#define MICROPY_HW_CLK_PLL3Q (4)
45+
#define MICROPY_HW_CLK_PLL3R (2)
46+
#define MICROPY_HW_CLK_PLL3FRAC (0)
47+
#define MICROPY_HW_CLK_PLL3VCI_LL (LL_RCC_PLLINPUTRANGE_1_2)
48+
#define MICROPY_HW_CLK_PLL3VCO_LL (LL_RCC_PLLVCORANGE_MEDIUM)
49+
50+
// There is an external 32kHz oscillator
51+
#define MICROPY_HW_RTC_USE_LSE (1)
52+
53+
// 512MBit
54+
#if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
55+
#define MICROPY_HW_OSPIFLASH_SIZE_BITS_LOG2 (29)
56+
#define MICROPY_HW_OSPIFLASH_CS (pin_G6)
57+
#define MICROPY_HW_OSPIFLASH_SCK (pin_F10)
58+
#define MICROPY_HW_OSPIFLASH_IO0 (pin_B1)
59+
#define MICROPY_HW_OSPIFLASH_IO1 (pin_D12)
60+
#define MICROPY_HW_OSPIFLASH_IO2 (pin_C2)
61+
#define MICROPY_HW_OSPIFLASH_IO3 (pin_D13)
62+
#define MICROPY_HW_OSPIFLASH_IO4 (pin_H2)
63+
#define MICROPY_HW_OSPIFLASH_IO5 (pin_H3)
64+
#define MICROPY_HW_OSPIFLASH_IO6 (pin_G9)
65+
#define MICROPY_HW_OSPIFLASH_IO7 (pin_C0)
66+
#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
67+
#define MICROPY_HW_BDEV_SPIFLASH (&spi_bdev)
68+
#define MICROPY_HW_BDEV_SPIFLASH_CONFIG (&spiflash_config)
69+
#define MICROPY_HW_BDEV_SPIFLASH_SIZE_BYTES ((1 << MICROPY_HW_OSPIFLASH_SIZE_BITS_LOG2) / 8)
70+
#define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol
71+
#endif
72+
73+
// UART buses
74+
#define MICROPY_HW_UART1_TX (pin_A9)
75+
#define MICROPY_HW_UART1_RX (pin_A10)
76+
#define MICROPY_HW_UART3_TX (pin_B10) // Arduino Connector CN15-Pin2 (D1)
77+
#define MICROPY_HW_UART3_RX (pin_B11) // Arduino Connector CN15-Pin1 (D0)
78+
#define MICROPY_HW_UART_REPL PYB_UART_1
79+
#define MICROPY_HW_UART_REPL_BAUD 115200
80+
81+
// I2C buses
82+
#define MICROPY_HW_I2C1_SCL (pin_B6) // Arduino Connector CN13-Pin10 (D15)
83+
#define MICROPY_HW_I2C1_SDA (pin_B7) // Arduino Connector CN13-Pin9 (D14)
84+
85+
// SPI buses
86+
#define MICROPY_HW_SPI2_NSS (pin_A3) // Arduino Connector CN13-Pin3 (D10)
87+
#define MICROPY_HW_SPI2_SCK (pin_I1) // Arduino Connector CN13-Pin6 (D13)
88+
#define MICROPY_HW_SPI2_MISO (pin_I2) // Arduino Connector CN13-Pin5 (D12)
89+
#define MICROPY_HW_SPI2_MOSI (pin_B15) // Arduino Connector CN13-Pin4 (D11)
90+
91+
// USRSW is pulled low. Pressing the button makes the input go high.
92+
#define MICROPY_HW_USRSW_PIN (pin_C13)
93+
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
94+
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
95+
#define MICROPY_HW_USRSW_PRESSED (1)
96+
97+
// LEDs
98+
#define MICROPY_HW_LED1 (pin_I9) // green
99+
#define MICROPY_HW_LED2 (pin_I8) // orange
100+
#define MICROPY_HW_LED3 (pin_F1) // red
101+
#define MICROPY_HW_LED4 (pin_F4) // blue
102+
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin))
103+
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin))
104+
105+
// USB config
106+
#define MICROPY_HW_USB_FS (1)
107+
#define MICROPY_HW_USB_MAIN_DEV (USB_PHY_FS_ID)
108+
109+
/******************************************************************************/
110+
// Variable and function declarations
111+
112+
extern const struct _mp_spiflash_config_t spiflash_config;
113+
extern struct _spi_bdev_t spi_bdev;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
USE_MBOOT ?= 0
2+
3+
# MCU settings
4+
MCU_SERIES = h5
5+
CMSIS_MCU = STM32H573xx
6+
MICROPY_FLOAT_IMPL = single
7+
AF_FILE = boards/stm32h573_af.csv
8+
9+
ifeq ($(USE_MBOOT),1)
10+
LD_FILES = boards/stm32h573xi.ld boards/common_bl.ld
11+
TEXT0_ADDR = 0x08008000
12+
else
13+
LD_FILES = boards/stm32h573xi.ld boards/common_basic.ld
14+
TEXT0_ADDR = 0x08000000
15+
endif
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
,PA0
2+
,PA1
3+
,PA2
4+
,PA3
5+
,PA4
6+
,PA5
7+
,PA6
8+
,PA7
9+
,PA8
10+
,PA9
11+
,PA10
12+
,PA11
13+
,PA12
14+
,PA13
15+
,PA14
16+
,PA15
17+
,PB0
18+
,PB1
19+
,PB2
20+
,PB3
21+
,PB4
22+
,PB5
23+
,PB6
24+
,PB7
25+
,PB8
26+
,PB9
27+
,PB10
28+
,PB11
29+
,PB12
30+
,PB13
31+
,PB14
32+
,PB15
33+
,PC0
34+
,PC1
35+
,PC2
36+
,PC3
37+
,PC4
38+
,PC5
39+
,PC6
40+
,PC7
41+
,PC8
42+
,PC9
43+
,PC10
44+
,PC11
45+
,PC12
46+
,PC13
47+
,PC14
48+
,PC15
49+
,PD0
50+
,PD1
51+
,PD2
52+
,PD3
53+
,PD4
54+
,PD5
55+
,PD6
56+
,PD7
57+
,PD8
58+
,PD9
59+
,PD10
60+
,PD11
61+
,PD12
62+
,PD13
63+
,PD14
64+
,PD15
65+
,PE0
66+
,PE1
67+
,PE2
68+
,PE3
69+
,PE4
70+
,PE5
71+
,PE6
72+
,PE7
73+
,PE8
74+
,PE9
75+
,PE10
76+
,PE11
77+
,PE12
78+
,PE13
79+
,PE14
80+
,PE15
81+
,PF0
82+
,PF1
83+
,PF2
84+
,PF3
85+
,PF4
86+
,PF5
87+
,PF6
88+
,PF7
89+
,PF8
90+
,PF9
91+
,PF10
92+
,PF11
93+
,PF12
94+
,PF13
95+
,PF14
96+
,PF15
97+
,PG0
98+
,PG1
99+
,PG2
100+
,PG3
101+
,PG4
102+
,PG5
103+
,PG6
104+
,PG7
105+
,PG8
106+
,PG9
107+
,PG10
108+
,PG11
109+
,PG12
110+
,PG13
111+
,PG14
112+
,PG15
113+
,PH0
114+
,PH1
115+
,PH2
116+
,PH3
117+
,PH4
118+
,PH5
119+
,PH6
120+
,PH7
121+
,PH8
122+
,PH9
123+
,PH10
124+
,PH11
125+
,PH12
126+
,PH13
12 F438 7+
,PH14
128+
,PH15
129+
,PI0
130+
,PI1
131+
,PI2
132+
,PI3
133+
,PI4
134+
,PI5
135+
,PI6
136+
,PI7
137+
,PI8
138+
,PI9
139+
,PI10
140+
,PI11
141+
,PI12
142+
,PI13
143+
,PI14
144+
,PI15
145+
LED1,G11
146+
LED2,G2
147+
SW,PC13
148+
UART3_TX,PB10
149+
UART3_RX,PB11
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) 2023 Damien P. George
4+
*/
5+
#ifndef MICROPY_INCLUDED_STM32H5XX_HAL_CONF_H
6+
#define MICROPY_INCLUDED_STM32H5XX_HAL_CONF_H
7+
8+
// Oscillator values in Hz
9+
#define HSE_VALUE (25000000)
10+
#define LSE_VALUE (32768)
11+
#define EXTERNAL_CLOCK_VALUE (12288000)
12+
13+
#include "boards/stm32h5xx_hal_conf_base.h"
14+
15+
// Oscillator timeouts in ms
16+
#define HSE_STARTUP_TIMEOUT (100)
17+
#define LSE_STARTUP_TIMEOUT (5000)
18+
19+
#endif // MICROPY_INCLUDED_STM32H5XX_HAL_CONF_H

0 commit comments

Comments
 (0)
0