mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
adding h743 uart, but not enabled yet since it conflict with OTG_FS2
This commit is contained in:
parent
b4804d1592
commit
227bffe04b
@ -12,7 +12,7 @@ CFLAGS += \
|
||||
-DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
|
||||
|
||||
# suppress warning caused by vendor mcu driver
|
||||
CFLAGS += -Wno-error=maybe-uninitialized
|
||||
CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
|
||||
|
||||
ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32H7xx_HAL_Driver
|
||||
ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32H7xx
|
||||
@ -27,6 +27,7 @@ SRC_C += \
|
||||
$(ST_HAL_DRIVER)/Src/stm32h7xx_hal_rcc.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32h7xx_hal_rcc_ex.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32h7xx_hal_gpio.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32h7xx_hal_uart.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32h7xx_hal_pwr_ex.c
|
||||
|
||||
SRC_S += \
|
||||
@ -45,5 +46,9 @@ CHIP_FAMILY = synopsys
|
||||
# For freeRTOS port source
|
||||
FREERTOS_PORT = ARM_CM7/r0p1
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h743xi
|
||||
JLINK_IF = jtag
|
||||
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
|
@ -61,13 +61,21 @@ void OTG_HS_IRQHandler(void)
|
||||
#define BUTTON_PIN GPIO_PIN_13
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
|
||||
#define UARTx USART1
|
||||
#define UART_GPIO_PORT GPIOB
|
||||
#define UART_GPIO_AF GPIO_AF4_USART1
|
||||
#define UART_TX_PIN GPIO_PIN_14
|
||||
#define UART_RX_PIN GPIO_PIN_15
|
||||
|
||||
UART_HandleTypeDef UartHandle;
|
||||
|
||||
// enable all LED, Button, Uart, USB clock
|
||||
static void all_rcc_clk_enable(void)
|
||||
{
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE(); // LED
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE(); // Button
|
||||
// __HAL_RCC_GPIOD_CLK_ENABLE(); // Uart tx, rx
|
||||
// __HAL_RCC_USART3_CLK_ENABLE(); // Uart module
|
||||
// __HAL_RCC_GPIOB_CLK_ENABLE(); // Uart tx, rx
|
||||
// __HAL_RCC_USART1_CLK_ENABLE(); // Uart module
|
||||
}
|
||||
|
||||
/* PWR, RCC, GPIO (All): AHB4 (D3 domain)
|
||||
@ -198,6 +206,26 @@ void board_init(void)
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(BUTTON_PORT, &GPIO_InitStruct);
|
||||
|
||||
#if 0
|
||||
// Uart
|
||||
GPIO_InitStruct.Pin = UART_TX_PIN | UART_RX_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = UART_GPIO_AF;
|
||||
HAL_GPIO_Init(UART_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
UartHandle.Instance = UARTx;
|
||||
UartHandle.Init.BaudRate = CFG_BOARD_UART_BAUDRATE;
|
||||
UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
UartHandle.Init.StopBits = UART_STOPBITS_1;
|
||||
UartHandle.Init.Parity = UART_PARITY_NONE;
|
||||
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
UartHandle.Init.Mode = UART_MODE_TX_RX;
|
||||
UartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
HAL_UART_Init(&UartHandle);
|
||||
#endif
|
||||
|
||||
#if BOARD_DEVICE_RHPORT_NUM == 0
|
||||
// Despite being call USB2_OTG
|
||||
// OTG_FS is marked as RHPort0 by TinyUSB to be consistent across stm32 port
|
||||
@ -330,7 +358,8 @@ int board_uart_read(uint8_t* buf, int len)
|
||||
int board_uart_write(void const * buf, int len)
|
||||
{
|
||||
(void) buf; (void) len;
|
||||
return 0;
|
||||
// HAL_UART_Transmit(&UartHandle, (uint8_t*) buf, len, 0xffff);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@
|
||||
/* #define HAL_SRAM_MODULE_ENABLED */
|
||||
/* #define HAL_SWPMI_MODULE_ENABLED */
|
||||
/* #define HAL_TIM_MODULE_ENABLED */
|
||||
/* #define HAL_UART_MODULE_ENABLED */
|
||||
#define HAL_UART_MODULE_ENABLED
|
||||
/* #define HAL_USART_MODULE_ENABLED */
|
||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
@ -211,6 +211,8 @@
|
||||
#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
|
||||
#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */
|
||||
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
|
||||
#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */
|
||||
#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
|
||||
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */
|
||||
|
||||
/* ########################### Ethernet Configuration ######################### */
|
||||
|
Loading…
x
Reference in New Issue
Block a user