Skip to content

Commit 2d3aaaf

Browse files
committed
bsp/stm32h5: support host mode
Signed-off-by: HiFiPhile <[email protected]>
1 parent 07ff25e commit 2d3aaaf

File tree

19 files changed

+284
-102
lines changed

19 files changed

+284
-102
lines changed

examples/host/bare_api/only.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mcu:MAX3421
1616
mcu:STM32C0
1717
mcu:STM32F4
1818
mcu:STM32F7
19+
mcu:STM32H5
1920
mcu:STM32H7
2021
mcu:STM32H7RS
2122
mcu:STM32N6

examples/host/cdc_msc_hid/only.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mcu:MAX3421
1616
mcu:STM32C0
1717
mcu:STM32F4
1818
mcu:STM32F7
19+
mcu:STM32H5
1920
mcu:STM32H7
2021
mcu:STM32H7RS
2122
mcu:STM32N6

examples/host/cdc_msc_hid_freertos/only.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mcu:MAX3421
1212
mcu:STM32C0
1313
mcu:STM32F4
1414
mcu:STM32F7
15+
mcu:STM32H5
1516
mcu:STM32H7
1617
mcu:STM32H7RS
1718
mcu:STM32N6

examples/host/device_info/only.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mcu:RAXXX
1616
mcu:STM32C0
1717
mcu:STM32F4
1818
mcu:STM32F7
19+
mcu:STM32H5
1920
mcu:STM32H7
2021
mcu:STM32H7RS
2122
mcu:STM32N6

examples/host/hid_controller/only.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ mcu:RAXXX
1515
mcu:MAX3421
1616
mcu:STM32F4
1717
mcu:STM32F7
18+
mcu:STM32H5
1819
mcu:STM32H7
1920
mcu:STM32H7RS
2021
mcu:STM32N6

examples/host/midi_rx/only.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ mcu:RX65X
1818
mcu:RAXXX
1919
mcu:STM32F4
2020
mcu:STM32F7
21+
mcu:STM32H5
2122
mcu:STM32H7
2223
mcu:STM32H7RS
2324
mcu:STM32N6

examples/host/msc_file_explorer/only.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mcu:MAX3421
1616
mcu:STM32C0
1717
mcu:STM32F4
1818
mcu:STM32F7
19+
mcu:STM32H5
1920
mcu:STM32H7
2021
mcu:STM32H7RS
2122
mcu:STM32N6

hw/bsp/stm32g0/family.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// Forward USB interrupt events to TinyUSB IRQ Handler
3838
//--------------------------------------------------------------------+
3939
void USB_UCPD1_2_IRQHandler(void) {
40-
tud_int_handler(0);
40+
tusb_int_handler(0, true);
4141
}
4242

4343
//--------------------------------------------------------------------+

hw/bsp/stm32g0/family.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function(family_configure_example TARGET RTOS)
6464
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
6565
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
6666
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
67+
${TOP}/src/portable/st/stm32_fsdev/hcd_stm32_fsdev.c
6768
${TOP}/src/portable/st/stm32_fsdev/fsdev_common.c
6869
${TOP}/src/portable/st/typec/typec_stm32.c
6970
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}

hw/bsp/stm32h5/boards/stm32h503nucleo/board.h

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,33 @@
3737
extern "C" {
3838
#endif
3939

40-
// LED
41-
#define LED_PORT GPIOA
42-
#define LED_PIN GPIO_PIN_5
43-
#define LED_STATE_ON 1
44-
45-
// Button
46-
#define BUTTON_PORT GPIOA
47-
#define BUTTON_PIN GPIO_PIN_0
48-
#define BUTTON_STATE_ACTIVE 0
49-
50-
// UART Enable for STLink VCOM
51-
#define UART_DEV USART3
52-
#define UART_CLK_EN __USART3_CLK_ENABLE
53-
#define UART_GPIO_PORT GPIOA
54-
#define UART_GPIO_AF GPIO_AF13_USART3
55-
56-
#define UART_TX_PIN GPIO_PIN_3
57-
#define UART_RX_PIN GPIO_PIN_4
40+
#define PINID_LED 0
41+
#define PINID_BUTTON 1
42+
#define PINID_UART_TX 2
43+
#define PINID_UART_RX 3
44+
45+
static board_pindef_t board_pindef[] = {
46+
{ // LED
47+
.port = GPIOA,
48+
.pin_init = { .Pin = GPIO_PIN_5, .Mode = GPIO_MODE_OUTPUT_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
49+
.active_state = 1
50+
},
51+
{ // Button
52+
.port = GPIOA,
53+
.pin_init = { .Pin = GPIO_PIN_0, .Mode = GPIO_MODE_INPUT, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
54+
.active_state = 0
55+
},
56+
{ // UART TX
57+
.port = GPIOA,
58+
.pin_init = { .Pin = GPIO_PIN_3, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF13_USART3 },
59+
.active_state = 0
60+
},
61+
{ // UART RX
62+
.port = GPIOA,
63+
.pin_init = { .Pin = GPIO_PIN_4, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF13_USART3 },
64+
.active_state = 0
65+
},
66+
};
5867

5968
//--------------------------------------------------------------------+
6069
// RCC Clock
@@ -120,6 +129,10 @@ static inline void SystemClock_Config(void) {
120129
__HAL_RCC_USB_CLK_ENABLE();
121130
}
122131

132+
static inline void board_init2(void) {
133+
// Empty for this board
134+
}
135+
123136
#ifdef __cplusplus
124137
}
125138
#endif

0 commit comments

Comments
 (0)