Skip to content

Commit 7e5bb93

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 05b2f2c commit 7e5bb93

22 files changed

+2301
-0
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
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) 2025
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 "qspi.h"
29+
30+
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
31+
// Shared cache for QSPI block device
32+
static mp_spiflash_cache_t spi_bdev_cache;
33+
#endif
34+
35+
// External QSPI flash uses hardware QSPI interface
36+
const mp_spiflash_config_t spiflash_config = {
37+
.bus_kind = MP_SPIFLASH_BUS_QSPI,
38+
.bus.u_qspi.data = NULL,
39+
.bus.u_qspi.proto = &qspi_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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"deploy": [
3+
"../deploy.md"
4+
],
5+
"docs": "",
6+
"features": [
7+
"Dual-core",
8+
"Ethernet",
9+
"External Flash",
10+
"External RAM",
11+
"USB"
12+
],
13+
"images": [],
14+
"mcu": "stm32h7",
15+
"product": "Discovery Kit H747I",
16+
"thumbnail": "",
17+
"url": "https://www.st.com/en/evaluation-tools/stm32h747i-disco.html",
18+
"vendor": "ST Microelectronics"
19+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2025
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 <string.h>
28+
#include "py/mphal.h"
29+
#include "storage.h"
30+
#include "sdram.h"
31+
#include "qspi.h"
32+
33+
void DISCO_board_early_init(void) {
34+
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
43+
}
44+
45+
void DISCO_board_low_power(int mode) {
46+
switch (mode) {
47+
case 0: // Leave stop mode.
48+
sdram_leave_low_power();
49+
break;
50+
case 1: // Enter stop mode.
51+
sdram_enter_low_power();
52+
break;
53+
case 2: // Enter standby mode.
54+
sdram_enter_power_down();
55+
break;
56+
}
57+
58+
#if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE == 0
59+
// Enable QSPI deepsleep for modes 1 and 2
60+
mp_spiflash_deepsleep(&spi_bdev.spiflash, (mode != 0));
61+
#endif
62+
63+
#if defined(M4_APP_ADDR)
64+
// Signal Cortex-M4 to go to Standby mode.
65+
if (mode == 2) {
66+
__HAL_RCC_HSEM_CLK_ENABLE();
67+
HAL_HSEM_FastTake(0);
68+
HAL_HSEM_Release(0, 0);
69+
__HAL_RCC_HSEM_CLK_DISABLE();
70+
HAL_Delay(100);
71+
}
72+
#endif
73+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include("$(PORT_DIR)/boards/manifest.py")
2+
3+
# Networking
4+
require("bundle-networking")
5+
6+
# Utils
7+
require("time")
8+
require("senml")
9+
require("logging")
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 */

0 commit comments

Comments
 (0)