Skip to content

Commit c9bbe0d

Browse files
committed
ports/stm32/boards: Add NUCLEO-U5A5ZJ-Q board support.
This change adds NUCLEO-U5A5ZJ-Q support to the STM32 port. NUCLEO-U5A5ZJ-Q: https://www.st.com/ja/evaluation-tools/nucleo-u5a5zj-q.html This board use STM32U5A5ZJ: https://www.st.com/ja/microcontrollers-microprocessors/stm32u5a5zj.html Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
1 parent cb17e5e commit c9bbe0d

File tree

5 files changed

+260
-0
lines changed

5 files changed

+260
-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_u5a5zj_q.jpg"
9+
],
10+
"mcu": "stm32u5",
11+
"product": "Nucleo U5A5ZJ_Q",
12+
"thumbnail": "",
13+
"url": "",
14+
"vendor": "ST Microelectronics"
15+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#define MICROPY_HW_BOARD_NAME "NUCLEO_U5A5ZJ_Q"
2+
#define MICROPY_HW_MCU_NAME "STM32U5A5ZJ"
3+
4+
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)
5+
#define MICROPY_HW_ENABLE_ADC (1)
6+
#define MICROPY_HW_ENABLE_DAC (1)
7+
#define MICROPY_HW_ENABLE_USB (1)
8+
#define MICROPY_HW_ENABLE_RNG (0)
9+
#define MICROPY_HW_ENABLE_RTC (1)
10+
#define MICROPY_HW_HAS_FLASH (1)
11+
#define MICROPY_HW_HAS_SWITCH (1)
12+
13+
// The board has a 16MHz oscillator, the following gives 160MHz CPU speed
14+
#define MICROPY_HW_CLK_PLLM (1)
15+
#define MICROPY_HW_CLK_PLLN (10)
16+
#define MICROPY_HW_CLK_PLLP (10)
17+
#define MICROPY_HW_CLK_PLLQ (2)
18+
#define MICROPY_HW_CLK_PLLR (1)
19+
#define MICROPY_HW_CLK_PLLVCI (RCC_PLLVCIRANGE_1)
20+
#define MICROPY_HW_CLK_PLLFRAC (0)
21+
22+
// 5 wait states, according to Table 37, Reference Manual (RM0481 Rev 1)
23+
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_4
24+
25+
// There is an external 32kHz oscillator
26+
#define MICROPY_HW_RTC_USE_LSE (1)
27+
#define MICROPY_HW_RCC_RTC_CLKSOURCE (RCC_RTCCLKSOURCE_LSE)
28+
29+
// UART config
30+
#define MICROPY_HW_UART1_TX (pin_A9)
31+
#define MICROPY_HW_UART1_RX (pin_A10)
32+
#define MICROPY_HW_UART2_TX (pin_D5)
33+
#define MICROPY_HW_UART2_RX (pin_D6)
34+
#define MICROPY_HW_UART2_RTS (pin_D4)
35+
#define MICROPY_HW_UART2_CTS (pin_D3)
36+
37+
// Connect REPL to UART1 which is provided on ST-Link USB interface
38+
#define MICROPY_HW_UART_REPL PYB_UART_1
39+
#define MICROPY_HW_UART_REPL_BAUD 115200
40+
41+
// I2C buses
42+
#define MICROPY_HW_I2C1_SCL (pin_B8) // Arduino Connector CN7-Pin2 (D15)
43+
#define MICROPY_HW_I2C1_SDA (pin_B9) // Arduino Connector CN7-Pin4 (D14)
44+
#define MICROPY_HW_I2C2_SCL (pin_F1) // Connector CN9-Pin19
45+
#define MICROPY_HW_I2C2_SDA (pin_F0) // Connector CN9-Pin21
46+
47+
// SPI buses
48+
#define MICROPY_HW_SPI1_NSS (pin_D14) // Arduino Connector CN7-Pin16 (D10)
49+
#define MICROPY_HW_SPI1_SCK (pin_A5) // Arduino Connector CN7-Pin10 (D13)
50+
#define MICROPY_HW_SPI1_MISO (pin_A6) // Arduino Connector CN7-Pin12 (D12)
51+
#define MICROPY_HW_SPI1_MOSI (pin_A7) // Arduino Connector CN7-Pin14 (D11)
52+
#define MICROPY_HW_SPI2_NSS (pin_D0)
53+
#define MICROPY_HW_SPI2_SCK (pin_B10)
54+
#define MICROPY_HW_SPI2_MISO (pin_D3)
55+
#define MICROPY_HW_SPI2_MOSI (pin_C1)
56+
#define MICROPY_HW_SPI3_NSS (pin_A4)
57+
#define MICROPY_HW_SPI3_SCK (pin_B3)
58+
#define MICROPY_HW_SPI3_MISO (pin_B4)
59+
#define MICROPY_HW_SPI3_MOSI (pin_B5)
60+
61+
// USRSW is pulled low. Pressing the button makes the input go high.
62+
#define MICROPY_HW_USRSW_PIN (pin_C13)
63+
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
64+
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
65+
#define MICROPY_HW_USRSW_PRESSED (1)
66+
67+
// LEDs
68+
#define MICROPY_HW_LED1 (pin_C7) // Green
69+
#define MICROPY_HW_LED2 (pin_B7) // Orange
70+
#define MICROPY_HW_LED3 (pin_G2) // Red
71+
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
72+
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
73+
74+
// USB Configuration
75+
#define MICROPY_HW_USB_HS (1)
76+
#define MICROPY_HW_USB_HS_IN_FS (1)
77+
78+
#if 0 // FDCAN bus
79+
#define MICROPY_HW_CAN1_NAME "FDCAN1"
80+
#define MICROPY_HW_CAN1_TX (pin_D1)
81+
#define MICROPY_HW_CAN1_RX (pin_D0)
82+
#endif
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
USE_MBOOT ?= 0
2+
3+
# MCU settings
4+
MCU_SERIES = u5
5+
CMSIS_MCU = STM32U5A5xx
6+
MICROPY_FLOAT_IMPL = single
7+
AF_FILE = boards/stm32u5a5_af.csv
8+
9+
ifeq ($(USE_MBOOT),1)
10+
# When using Mboot everything goes after the bootloader
11+
# TODO: not tested
12+
LD_FILES = boards/stm32h573xi.ld boards/common_bl.ld
13+
TEXT0_ADDR = 0x08008000
14+
else
15+
# When not using Mboot everything goes at the start of flash
16+
LD_FILES = boards/stm32u5a5xj.ld boards/common_basic.ld
17+
TEXT0_ADDR = 0x08000000
18+
endif
19+
20+
# MicroPython settings
21+
#MICROPY_HW_ENABLE_ISR_UART_FLASH_FUNCS_IN_RAM = 1
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
A0,PA3
2+
A1,PA2
3+
A2,PC3
4+
A3,PB0
5+
A4,PC1
6+
A5,PC0
7+
A6,PB1
8+
A7,PC2
9+
A8,PA1
10+
D0,PG8
11+
D1,PG7
12+
D2,PF15
13+
D3,PE13
14+
D4,PF14
15+
D5,PE11
16+
D6,PE9
17+
D7,PF13
18+
D8,PF12
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,PD11
28+
D18,PB13
29+
D19,PD12
30+
D20,PA4
31+
D21,PB4
32+
D22,PB5
33+
D23,PB3
34+
D24,PA4
35+
D25,PB4
36+
D26,PA2
37+
D27,PB10
38+
D28,PE15
39+
D29,PB0
40+
D30,PE12
41+
D31,PE14
42+
D32,PA0
43+
D33,PA8
44+
D34,PE0
45+
D35,PB11
46+
D36,PB10
47+
D37,PE15
48+
D38,PE14
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,PF3
60+
D50,PF5
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,PG1
75+
D65,PG0
76+
D66,PD1
77+
D67,PD0
78+
D68,PF0
79+
D69,PF1
80+
D70,PF2
81+
D71,PB6
82+
D72,PB2
83+
DAC1,PA4
84+
DAC2,PA5
85+
LED1,PC7
86+
LED2,PB7
87+
LED3,PG2
88+
SW,PC13
89+
I2C1_SDA,PB9
90+
I2C1_SCL,PB8
91+
I2C2_SDA,PF0
92+
I2C2_SCL,PF1
93+
I2C4_SCL,PF14
94+
I2C4_SDA,PF15
95+
SD_D0,PC8
96+
SD_D1,PC9
97+
SD_D2,PC10
98+
SD_D3,PC11
99+
SD_CMD,PD2
100+
SD_CK,PC12
101+
SD_SW,PG2
102+
OTG_FS_POWER,PD10
103+
OTG_FS_OVER_CURRENT,PG7
104+
USB_VBUS,PA9
105+
USB_ID,PA10
106+
USB_DM,PA11
107+
USB_DP,PA12
108+
UART1_TX,PA9
109+
UART1_RX,PA10
110+
UART2_TX,PD5
111+
UART2_RX,PD6
112+
UART2_RTS,PD4
113+
UART2_CTS,PD3
114+
UART3_TX,PD8
115+
UART3_RX,PD9
116+
UART5_TX,PB6
117+
UART5_RX,PB12
118+
UART6_TX,PC6
119+
UART6_RX,PC7
120+
UART7_TX,PF7
121+
UART7_RX,PF6
122+
UART8_TX,PE1
123+
UART8_RX,PE0
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_STM32U5XX_HAL_CONF_H
6+
#define MICROPY_INCLUDED_STM32U5XX_HAL_CONF_H
7+
8+
// Oscillator values in Hz
9+
#define HSE_VALUE (16000000)
10+
#define LSE_VALUE (32768)
11+
#define EXTERNAL_CLOCK_VALUE (12288000)
12+
13+
// Oscillator timeouts in ms
14+
#define HSE_STARTUP_TIMEOUT (100)
15+
#define LSE_STARTUP_TIMEOUT (5000)
16+
17+
#include "boards/stm32u5xx_hal_conf_base.h"
18+
19+
#endif // MICROPY_INCLUDED_STM32U5XX_HAL_CONF_H

0 commit comments

Comments
 (0)