stm32/boards/STM32H573I_DK: Add H5 board definition files.

Signed-off-by: Damien George <damien@micropython.org>
pull/11138/head
Damien George 2023-03-22 16:41:11 +11:00
rodzic 56a22ddc8b
commit 6f74146bc1
5 zmienionych plików z 341 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,45 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2023 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "storage.h"
#include "octospi.h"
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
static mp_spiflash_cache_t spi_bdev_cache;
#endif
// External SPI flash uses hardware OCTOSPI interface (in 1-line mode).
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_QSPI, // spiflash driver doesn't yet support OSPI
.bus.u_qspi.data = NULL,
.bus.u_qspi.proto = &octospi_proto,
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
.cache = &spi_bdev_cache,
#endif
};
spi_bdev_t spi_bdev;

Wyświetl plik

@ -0,0 +1,113 @@
#define MICROPY_HW_BOARD_NAME "STM32H573I-DK"
#define MICROPY_HW_MCU_NAME "STM32H573IIK3Q"
#define MICROPY_PY_PYB_LEGACY (0)
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_ADC (1)
#define MICROPY_HW_ENABLE_DAC (0) // requires DMA
#define MICROPY_HW_ENABLE_USB (1)
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_FLASH (1)
#if 1
// The board has a 25MHz oscillator, the following gives 250MHz CPU speed
#define MICROPY_HW_CLK_USE_BYPASS (1)
#define MICROPY_HW_CLK_PLLM (5)
#define MICROPY_HW_CLK_PLLN (100)
#define MICROPY_HW_CLK_PLLP (2)
#define MICROPY_HW_CLK_PLLQ (2)
#define MICROPY_HW_CLK_PLLR (2)
#define MICROPY_HW_CLK_PLLVCI_LL (LL_RCC_PLLINPUTRANGE_4_8)
#define MICROPY_HW_CLK_PLLVCO_LL (LL_RCC_PLLVCORANGE_WIDE)
#define MICROPY_HW_CLK_PLLFRAC (0)
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_5
#else
// Use 64MHz HSI to clock the CPU at 200MHz
#define MICROPY_HW_CLK_USE_HSI (1) // 64MHz
#define MICROPY_HW_CLK_PLLM (16)
#define MICROPY_HW_CLK_PLLN (100)
#define MICROPY_HW_CLK_PLLP (2)
#define MICROPY_HW_CLK_PLLQ (2)
#define MICROPY_HW_CLK_PLLR (2)
#define MICROPY_HW_CLK_PLLVCI_LL (LL_RCC_PLLINPUTRANGE_4_8)
#define MICROPY_HW_CLK_PLLVCO_LL (LL_RCC_PLLVCORANGE_WIDE)
#define MICROPY_HW_CLK_PLLFRAC (0)
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_4 // VOS0, 168-210MHz
#endif
// PLL3 with Q output at 48MHz for USB
#define MICROPY_HW_CLK_PLL3M (25)
#define MICROPY_HW_CLK_PLL3N (192)
#define MICROPY_HW_CLK_PLL3P (2)
#define MICROPY_HW_CLK_PLL3Q (4)
#define MICROPY_HW_CLK_PLL3R (2)
#define MICROPY_HW_CLK_PLL3FRAC (0)
#define MICROPY_HW_CLK_PLL3VCI_LL (LL_RCC_PLLINPUTRANGE_1_2)
#define MICROPY_HW_CLK_PLL3VCO_LL (LL_RCC_PLLVCORANGE_MEDIUM)
// There is an external 32kHz oscillator
#define MICROPY_HW_RTC_USE_LSE (1)
// 512MBit
#if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
#define MICROPY_HW_OSPIFLASH_SIZE_BITS_LOG2 (29)
#define MICROPY_HW_OSPIFLASH_CS (pin_G6)
#define MICROPY_HW_OSPIFLASH_SCK (pin_F10)
#define MICROPY_HW_OSPIFLASH_IO0 (pin_B1)
#define MICROPY_HW_OSPIFLASH_IO1 (pin_D12)
#define MICROPY_HW_OSPIFLASH_IO2 (pin_C2)
#define MICROPY_HW_OSPIFLASH_IO3 (pin_D13)
#define MICROPY_HW_OSPIFLASH_IO4 (pin_H2)
#define MICROPY_HW_OSPIFLASH_IO5 (pin_H3)
#define MICROPY_HW_OSPIFLASH_IO6 (pin_G9)
#define MICROPY_HW_OSPIFLASH_IO7 (pin_C0)
#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
#define MICROPY_HW_BDEV_SPIFLASH (&spi_bdev)
#define MICROPY_HW_BDEV_SPIFLASH_CONFIG (&spiflash_config)
#define MICROPY_HW_BDEV_SPIFLASH_SIZE_BYTES ((1 << MICROPY_HW_OSPIFLASH_SIZE_BITS_LOG2) / 8)
#define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol
#endif
// UART buses
#define MICROPY_HW_UART1_TX (pin_A9)
#define MICROPY_HW_UART1_RX (pin_A10)
#define MICROPY_HW_UART3_TX (pin_B10) // Arduino Connector CN15-Pin2 (D1)
#define MICROPY_HW_UART3_RX (pin_B11) // Arduino Connector CN15-Pin1 (D0)
#define MICROPY_HW_UART_REPL PYB_UART_1
#define MICROPY_HW_UART_REPL_BAUD 115200
// I2C buses
#define MICROPY_HW_I2C1_SCL (pin_B6) // Arduino Connector CN13-Pin10 (D15)
#define MICROPY_HW_I2C1_SDA (pin_B7) // Arduino Connector CN13-Pin9 (D14)
// SPI buses
#define MICROPY_HW_SPI2_NSS (pin_A3) // Arduino Connector CN13-Pin3 (D10)
#define MICROPY_HW_SPI2_SCK (pin_I1) // Arduino Connector CN13-Pin6 (D13)
#define MICROPY_HW_SPI2_MISO (pin_I2) // Arduino Connector CN13-Pin5 (D12)
#define MICROPY_HW_SPI2_MOSI (pin_B15) // Arduino Connector CN13-Pin4 (D11)
// USRSW is pulled low. Pressing the button makes the input go high.
#define MICROPY_HW_USRSW_PIN (pin_C13)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
#define MICROPY_HW_USRSW_PRESSED (1)
// LEDs
#define MICROPY_HW_LED1 (pin_I9) // green
#define MICROPY_HW_LED2 (pin_I8) // orange
#define MICROPY_HW_LED3 (pin_F1) // red
#define MICROPY_HW_LED4 (pin_F4) // blue
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin))
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin))
// USB config
#define MICROPY_HW_USB_FS (1)
#define MICROPY_HW_USB_MAIN_DEV (USB_PHY_FS_ID)
/******************************************************************************/
// Variable and function declarations
extern const struct _mp_spiflash_config_t spiflash_config;
extern struct _spi_bdev_t spi_bdev;

Wyświetl plik

@ -0,0 +1,15 @@
USE_MBOOT ?= 0
# MCU settings
MCU_SERIES = h5
CMSIS_MCU = STM32H573xx
MICROPY_FLOAT_IMPL = single
AF_FILE = boards/stm32h573_af.csv
ifeq ($(USE_MBOOT),1)
LD_FILES = boards/stm32h573xi.ld boards/common_bl.ld
TEXT0_ADDR = 0x08008000
else
LD_FILES = boards/stm32h573xi.ld boards/common_basic.ld
TEXT0_ADDR = 0x08000000
endif

Wyświetl plik

@ -0,0 +1,149 @@
,PA0
,PA1
,PA2
,PA3
,PA4
,PA5
,PA6
,PA7
,PA8
,PA9
,PA10
,PA11
,PA12
,PA13
,PA14
,PA15
,PB0
,PB1
,PB2
,PB3
,PB4
,PB5
,PB6
,PB7
,PB8
,PB9
,PB10
,PB11
,PB12
,PB13
,PB14
,PB15
,PC0
,PC1
,PC2
,PC3
,PC4
,PC5
,PC6
,PC7
,PC8
,PC9
,PC10
,PC11
,PC12
,PC13
,PC14
,PC15
,PD0
,PD1
,PD2
,PD3
,PD4
,PD5
,PD6
,PD7
,PD8
,PD9
,PD10
,PD11
,PD12
,PD13
,PD14
,PD15
,PE0
,PE1
,PE2
,PE3
,PE4
,PE5
,PE6
,PE7
,PE8
,PE9
,PE10
,PE11
,PE12
,PE13
,PE14
,PE15
,PF0
,PF1
,PF2
,PF3
,PF4
,PF5
,PF6
,PF7
,PF8
,PF9
,PF10
,PF11
,PF12
,PF13
,PF14
,PF15
,PG0
,PG1
,PG2
,PG3
,PG4
,PG5
,PG6
,PG7
,PG8
,PG9
,PG10
,PG11
,PG12
,PG13
,PG14
,PG15
,PH0
,PH1
,PH2
,PH3
,PH4
,PH5
,PH6
,PH7
,PH8
,PH9
,PH10
,PH11
,PH12
,PH13
,PH14
,PH15
,PI0
,PI1
,PI2
,PI3
,PI4
,PI5
,PI6
,PI7
,PI8
,PI9
,PI10
,PI11
,PI12
,PI13
,PI14
,PI15
LED1,G11
LED2,G2
SW,PC13
UART3_TX,PB10
UART3_RX,PB11
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
127 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

Wyświetl plik

@ -0,0 +1,19 @@
/* This file is part of the MicroPython project, http://micropython.org/
* The MIT License (MIT)
* Copyright (c) 2023 Damien P. George
*/
#ifndef MICROPY_INCLUDED_STM32H5XX_HAL_CONF_H
#define MICROPY_INCLUDED_STM32H5XX_HAL_CONF_H
// Oscillator values in Hz
#define HSE_VALUE (25000000)
#define LSE_VALUE (32768)
#define EXTERNAL_CLOCK_VALUE (12288000)
#include "boards/stm32h5xx_hal_conf_base.h"
// Oscillator timeouts in ms
#define HSE_STARTUP_TIMEOUT (100)
#define LSE_STARTUP_TIMEOUT (5000)
#endif // MICROPY_INCLUDED_STM32H5XX_HAL_CONF_H