Skip to content

Commit d8a62b3

Browse files
committed
stm32/boards: Add STM32H747I-DISCO with TinyUSB support.
Adds board definition for STM32H747I-DISCO with TinyUSB stack enabled. Board features USB HS via ULPI PHY (USB3320C) running at High-Speed (480 Mbps). Working: - USB CDC (serial console) - USB MSC (mass storage) - All peripherals (I2C, SPI, UART, ADC, SD card) - Both ST-LINK UART and USB CDC consoles Board configuration: - Dual-core STM32H747XI (M7 @ 400MHz, M4 @ 240MHz) - 2MB Flash, 1MB RAM, 32MB SDRAM - USB HS with ULPI PHY - 8-bit SDMMC SD card interface - Ethernet (requires hardware modification - see board README) Test suite in tests/ directory verifies peripheral functionality. Signed-off-by: Andrew Leech <[email protected]>
1 parent 32b24c9 commit d8a62b3

18 files changed

+1414
-10
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# STM32H747I-DISCO Board
2+
3+
STMicroelectronics STM32H747I-DISCO development board with STM32H747XI dual-core MCU.
4+
5+
## Features
6+
7+
- STM32H747XIH6 microcontroller
8+
- Arm Cortex-M7 @ 480 MHz + Cortex-M4 @ 240 MHz
9+
- 2 MB Flash, 1 MB RAM
10+
- 32 MB external SDRAM
11+
- Connectivity
12+
- USB High-Speed via ULPI PHY (USB3320)
13+
- USB Full-Speed
14+
- Ethernet RMII (LAN8742A PHY) - **requires hardware modification**
15+
- microSD card slot (8-bit SDMMC1)
16+
- Display
17+
- 4" capacitive touchscreen LCD (480×272)
18+
- Audio
19+
- WM8994 codec with line in/out, headphone, speaker, microphone
20+
- 2x digital MEMS microphones
21+
- Other peripherals
22+
- 2× user LEDs
23+
- 1× user button + reset button
24+
- Arduino Uno V3 expansion connector
25+
- PMOD connector
26+
- Onboard ST-LINK/V3
27+
28+
## Pin Configuration
29+
30+
Default pin assignments:
31+
32+
- UART1: PA9 (TX), PA10 (RX) - Connected to ST-LINK VCP
33+
- USB_HS: ULPI interface on PA3, PA5, PB0, PB1, PB5, PB10-13, PC0, PH4, PI11
34+
- I2C4: PD12 (SCL), PD13 (SDA) - WM8994 audio codec
35+
- SPI5: PF7 (SCK), PF8 (MISO), PF9 (MOSI), PF6 (CS)
36+
- UART8: PJ8 (TX), PJ9 (RX)
37+
- SD Card: 8-bit SDMMC1 interface on PC6-12, PB8-9, PD2
38+
39+
## Ethernet Hardware Limitation
40+
41+
**Important:** The Ethernet interface is not functional with the default board configuration due to a pin conflict between ETH_MDC (PC1) and SAI4_D1 (digital MEMS microphone). A hardware modification is required to disconnect the MEMS microphone from PC1 to enable Ethernet functionality. Refer to the STM32H747I-DISCO user manual (UM2411) for details on the required modification.
42+
43+
## Building Firmware
44+
45+
```bash
46+
cd ports/stm32
47+
make BOARD=STM32H747I_DISCO
48+
```
49+
50+
## Flashing Firmware
51+
52+
Using STM32CubeProgrammer (recommended):
53+
```bash
54+
STM32_Programmer_CLI -c port=SWD mode=UR -w build-STM32H747I_DISCO/firmware.elf -v -rst
55+
```
56+
57+
Using st-flash:
58+
```bash
59+
st-flash write build-STM32H747I_DISCO/firmware.bin 0x08000000
60+
```
61+
62+
## Console Access
63+
64+
The board provides two independent console options:
65+
66+
1. **ST-LINK V3 UART** (recommended):
67+
- Device: /dev/ttyACM* (Linux), COM* (Windows)
68+
- Baudrate: 115200
69+
- Always available regardless of USB state
70+
71+
2. **USB CDC serial**:
72+
- Requires USB cable connected
73+
- Provides MicroPython REPL
74+
75+
Using mpremote:
76+
```bash
77+
mpremote connect /dev/ttyACM5 # Adjust device as needed
78+
```
79+
80+
## Testing
81+
82+
The board includes a test suite for verifying hardware functionality:
83+
84+
```python
85+
# Run automated tests
86+
import run_all_tests
87+
run_all_tests.run_automated()
88+
89+
# Run manual tests (requires user interaction)
90+
run_all_tests.run_manual()
91+
```
92+
93+
Test coverage:
94+
- I2C (WM8994 codec)
95+
- ADC (3 channels)
96+
- SPI
97+
- UART
98+
- SD card
99+
- Ethernet (requires hardware modification)
100+
- DAC
101+
- PWM/Timers
102+
- LEDs and buttons

ports/stm32/boards/STM32H747I_DISCO/bdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2025 Andrew Leech
6+
* Copyright (c) 2025
77
*
88
* Permission is hereby granted, free of charge, to any person obtaining a copy
99
* of this software and associated documentation files (the "Software"), to deal

ports/stm32/boards/STM32H747I_DISCO/board.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44
],
55
"docs": "",
66
"features": [
7-
"DAC",
87
"Dual-core",
98
"Ethernet",
109
"External Flash",
1110
"External RAM",
12-
"microSD",
1311
"USB"
1412
],
15-
"images": [
16-
"stm32h747i_disco.jpg"
17-
],
13+
"images": [],
1814
"mcu": "stm32h7",
1915
"product": "Discovery Kit H747I",
2016
"thumbnail": "",

ports/stm32/boards/STM32H747I_DISCO/board_init.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2025 Andrew Leech
6+
* Copyright (c) 2025
77
*
88
* Permission is hereby granted, free of charge, to any person obtaining a copy
99
* of this software and associated documentation files (the "Software"), to deal
@@ -28,9 +28,18 @@
2828
#include "py/mphal.h"
2929
#include "storage.h"
3030
#include "sdram.h"
31+
#include "qspi.h"
3132

3233
void DISCO_board_early_init(void) {
3334
HAL_InitTick(0);
35+
36+
// SDRAM initialization is handled by main.c
37+
// sdram_init();
38+
39+
#if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE == 0
40+
// QSPI initialization might fail - comment out for now
41+
// qspi_memory_map();
42+
#endif
3443
}
3544

3645
void DISCO_board_low_power(int mode) {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef MICROPY_INCLUDED_MBEDTLS_CONFIG_BOARD_H
2+
#define MICROPY_INCLUDED_MBEDTLS_CONFIG_BOARD_H
3+
4+
#define MBEDTLS_ECP_NIST_OPTIM
5+
6+
#include "ports/stm32/mbedtls/mbedtls_config_port.h"
7+
8+
#endif /* MICROPY_INCLUDED_MBEDTLS_CONFIG_BOARD_H */

ports/stm32/boards/STM32H747I_DISCO/mpconfigboard.h

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ typedef unsigned int mp_uint_t; // must be pointer size
2121
#define MICROPY_HW_ENABLE_ADC (1)
2222
#define MICROPY_HW_ENABLE_DAC (1)
2323
#define MICROPY_HW_ENABLE_USB (1)
24+
#define MICROPY_HW_TINYUSB_STACK (1)
2425
#define MICROPY_HW_HAS_SWITCH (1)
2526
#define MICROPY_HW_HAS_FLASH (1)
2627
#define MICROPY_HW_ENABLE_SERVO (1)
@@ -88,7 +89,7 @@ void DISCO_board_low_power(int mode);
8889
// Peripheral clock sources
8990
#define MICROPY_HW_RCC_HSI48_STATE (RCC_HSI48_ON)
9091
#define MICROPY_HW_RCC_USB_CLKSOURCE (RCC_USBCLKSOURCE_PLL3)
91-
#define MICROPY_HW_RCC_RTC_CLKSOURCE (RCC_RTCCLKSOURCE_LSE)
92+
#define MICROPY_HW_RCC_RTC_CLKSOURCE (RCC_RTCCLKSOURCE_LSI)
9293
#define MICROPY_HW_RCC_FMC_CLKSOURCE (RCC_FMCCLKSOURCE_PLL2)
9394
#define MICROPY_HW_RCC_RNG_CLKSOURCE (RCC_RNGCLKSOURCE_HSI48)
9495
#define MICROPY_HW_RCC_ADC_CLKSOURCE (RCC_ADCCLKSOURCE_PLL3)
@@ -105,8 +106,9 @@ void DISCO_board_low_power(int mode);
105106
#define MICROPY_HW_ANALOG_SWITCH_PC2 (SYSCFG_SWITCH_PC2_OPEN)
106107
#define MICROPY_HW_ANALOG_SWITCH_PC3 (SYSCFG_SWITCH_PC3_OPEN)
107108

108-
// Using LSE for RTC (32.768kHz crystal on PC14/PC15)
109-
#define MICROPY_HW_RTC_USE_LSE (1)
109+
// Using LSI for RTC (LSE may not be populated or starting)
110+
// LSI is approximately 32kHz but varies, so use default prediv values
111+
#define MICROPY_HW_RTC_USE_LSE (0)
110112
#define MICROPY_HW_RTC_USE_US (1)
111113
#define MICROPY_HW_RTC_USE_CALOUT (1)
112114

@@ -302,3 +304,25 @@ extern struct _spi_bdev_t spi_bdev;
302304
#define MICROPY_HW_FMC_D29 (pin_I7)
303305
#define MICROPY_HW_FMC_D30 (pin_I9)
304306
#define MICROPY_HW_FMC_D31 (pin_I10)
307+
308+
#define MICROPY_HW_USB_VID 0x0483
309+
#define MICROPY_HW_USB_PID 0x5740
310+
#define MICROPY_HW_USB_PID_CDC_MSC (MICROPY_HW_USB_PID)
311+
#define MICROPY_HW_USB_PID_CDC_HID (MICROPY_HW_USB_PID)
312+
#define MICROPY_HW_USB_PID_CDC (MICROPY_HW_USB_PID)
313+
#define MICROPY_HW_USB_PID_MSC (MICROPY_HW_USB_PID)
314+
#define MICROPY_HW_USB_PID_CDC2_MSC (MICROPY_HW_USB_PID)
315+
#define MICROPY_HW_USB_PID_CDC2 (MICROPY_HW_USB_PID)
316+
#define MICROPY_HW_USB_PID_CDC3 (MICROPY_HW_USB_PID)
317+
#define MICROPY_HW_USB_PID_CDC3_MSC (MICROPY_HW_USB_PID)
318+
#define MICROPY_HW_USB_PID_CDC_MSC_HID (MICROPY_HW_USB_PID)
319+
#define MICROPY_HW_USB_PID_CDC2_MSC_HID (MICROPY_HW_USB_PID)
320+
#define MICROPY_HW_USB_PID_CDC3_MSC_HID (MICROPY_HW_USB_PID)
321+
#define MICROPY_HW_USB_LANGID_STRING 0x409
322+
#define MICROPY_HW_USB_MANUFACTURER_STRING "STMicroelectronics"
323+
#define MICROPY_HW_USB_PRODUCT_FS_STRING "STM32H747I-DISCO"
324+
#define MICROPY_HW_USB_PRODUCT_HS_STRING "STM32H747I-DISCO"
325+
#define MICROPY_HW_USB_INTERFACE_FS_STRING "STM32H747I-DISCO"
326+
#define MICROPY_HW_USB_INTERFACE_HS_STRING "STM32H747I-DISCO"
327+
#define MICROPY_HW_USB_CONFIGURATION_FS_STRING "STM32H747I-DISCO Config"
328+
#define MICROPY_HW_USB_CONFIGURATION_HS_STRING "STM32H747I-DISCO Config"

ports/stm32/boards/STM32H747I_DISCO/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ MICROPY_PY_OPENAMP = 1
1919
MICROPY_PY_OPENAMP_REMOTEPROC = 1
2020

2121
FROZEN_MANIFEST = $(BOARD_DIR)/manifest.py
22+
MBEDTLS_CONFIG_FILE = '"$(BOARD_DIR)/mbedtls_config_board.h"'

0 commit comments

Comments
 (0)