initial commit
This commit is contained in:
commit
b44ce7bd77
2716 files changed
+559005
No files matched your search
@@ -0,0 +1,12 @@
|
||||
set(MCU_VARIANT stm32h503xx)
|
||||
set(JLINK_DEVICE stm32h503rb)
|
||||
|
||||
function(update_board TARGET)
|
||||
target_compile_definitions(${TARGET} PUBLIC
|
||||
STM32H503xx
|
||||
HSE_VALUE=24000000
|
||||
)
|
||||
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
||||
CFG_EXAMPLE_VIDEO_READONLY
|
||||
)
|
||||
endfunction()
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||
* Copyright (c) 2023, HiFiPhile
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: STM32 H503 Nucleo
|
||||
url: https://www.st.com/en/evaluation-tools/nucleo-h503rb.html
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UART_ID 3
|
||||
|
||||
#define PINID_LED 0
|
||||
#define PINID_BUTTON 1
|
||||
#define PINID_UART_TX 2
|
||||
#define PINID_UART_RX 3
|
||||
|
||||
static board_pindef_t board_pindef[] = {
|
||||
{ // LED
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_5, .Mode = GPIO_MODE_OUTPUT_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 1
|
||||
},
|
||||
{ // Button
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_0, .Mode = GPIO_MODE_INPUT, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // UART TX
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_3, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF13_USART3 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // UART RX
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_4, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF13_USART3 },
|
||||
.active_state = 0
|
||||
},
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// RCC Clock
|
||||
//--------------------------------------------------------------------+
|
||||
static inline void SystemClock_Config(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
|
||||
|
||||
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
|
||||
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLL1_SOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 12;
|
||||
RCC_OscInitStruct.PLL.PLLN = 250;
|
||||
RCC_OscInitStruct.PLL.PLLP = 2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 2;
|
||||
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1_VCIRANGE_1;
|
||||
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1_VCORANGE_WIDE;
|
||||
RCC_OscInitStruct.PLL.PLLFRACN = 0;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|
||||
|RCC_CLOCKTYPE_PCLK3;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
||||
|
||||
// Configure CRS clock source
|
||||
__HAL_RCC_CRS_CLK_ENABLE();
|
||||
RCC_CRSInitTypeDef RCC_CRSInitStruct = {0};
|
||||
RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;
|
||||
RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB;
|
||||
RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
|
||||
RCC_CRSInitStruct.ReloadValue = __HAL_RCC_CRS_RELOADVALUE_CALCULATE(48000000, 1000);
|
||||
RCC_CRSInitStruct.ErrorLimitValue = 34;
|
||||
RCC_CRSInitStruct.HSI48CalibrationValue = 32;
|
||||
HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct);
|
||||
|
||||
/* Select HSI48 as USB clock source */
|
||||
RCC_PeriphCLKInitTypeDef usb_clk = {0 };
|
||||
usb_clk.PeriphClockSelection = RCC_PERIPHCLK_USB;
|
||||
usb_clk.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
|
||||
HAL_RCCEx_PeriphCLKConfig(&usb_clk);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USB_CLK_ENABLE();
|
||||
}
|
||||
|
||||
static inline void board_init2(void) {
|
||||
// Empty for this board
|
||||
}
|
||||
|
||||
void board_vbus_set(uint8_t rhport, bool state) {
|
||||
(void) rhport;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
@@ -0,0 +1,9 @@
|
||||
MCU_VARIANT = stm32h503xx
|
||||
|
||||
CFLAGS += \
|
||||
-DSTM32H503xx \
|
||||
-DHSE_VALUE=24000000 \
|
||||
-DCFG_EXAMPLE_VIDEO_READONLY \
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h503rb
|
||||
@@ -0,0 +1,12 @@
|
||||
set(MCU_VARIANT stm32h533xx)
|
||||
set(JLINK_DEVICE stm32h533re)
|
||||
|
||||
function(update_board TARGET)
|
||||
target_compile_definitions(${TARGET} PUBLIC
|
||||
STM32H533xx
|
||||
HSE_VALUE=24000000
|
||||
)
|
||||
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
||||
CFG_EXAMPLE_VIDEO_READONLY
|
||||
)
|
||||
endfunction()
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||
* Copyright (c) 2023, HiFiPhile
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: STM32 H533 Nucleo
|
||||
url: https://www.st.com/en/evaluation-tools/nucleo-h533re.html
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UART_ID 2
|
||||
|
||||
#define PINID_LED 0
|
||||
#define PINID_BUTTON 1
|
||||
#define PINID_UART_TX 2
|
||||
#define PINID_UART_RX 3
|
||||
|
||||
static board_pindef_t board_pindef[] = {
|
||||
{ // LED
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_5, .Mode = GPIO_MODE_OUTPUT_PP, .Pull = GPIO_NOPULL, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 1
|
||||
},
|
||||
{ // Button
|
||||
.port = GPIOC,
|
||||
.pin_init = { .Pin = GPIO_PIN_13, .Mode = GPIO_MODE_INPUT, .Pull = GPIO_PULLDOWN, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 1
|
||||
},
|
||||
{ // UART TX
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_2, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF7_USART2 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // UART RX
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_3, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF7_USART2 },
|
||||
.active_state = 0
|
||||
},
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// RCC Clock
|
||||
//--------------------------------------------------------------------+
|
||||
static inline void SystemClock_Config(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
|
||||
|
||||
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
|
||||
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLL1_SOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 12;
|
||||
RCC_OscInitStruct.PLL.PLLN = 250;
|
||||
RCC_OscInitStruct.PLL.PLLP = 2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 2;
|
||||
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1_VCIRANGE_1;
|
||||
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1_VCORANGE_WIDE;
|
||||
RCC_OscInitStruct.PLL.PLLFRACN = 0;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|
||||
|RCC_CLOCKTYPE_PCLK3;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
||||
|
||||
// Configure CRS clock source
|
||||
__HAL_RCC_CRS_CLK_ENABLE();
|
||||
RCC_CRSInitTypeDef RCC_CRSInitStruct = {0};
|
||||
RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;
|
||||
RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB;
|
||||
RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
|
||||
RCC_CRSInitStruct.ReloadValue = __HAL_RCC_CRS_RELOADVALUE_CALCULATE(48000000, 1000);
|
||||
RCC_CRSInitStruct.ErrorLimitValue = 34;
|
||||
RCC_CRSInitStruct.HSI48CalibrationValue = 32;
|
||||
HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct);
|
||||
|
||||
/* Select HSI48 as USB clock source */
|
||||
RCC_PeriphCLKInitTypeDef usb_clk = {0 };
|
||||
usb_clk.PeriphClockSelection = RCC_PERIPHCLK_USB;
|
||||
usb_clk.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
|
||||
HAL_RCCEx_PeriphCLKConfig(&usb_clk);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USB_CLK_ENABLE();
|
||||
}
|
||||
|
||||
static inline void board_init2(void) {
|
||||
// Empty for this board
|
||||
}
|
||||
|
||||
void board_vbus_set(uint8_t rhport, bool state) {
|
||||
(void) rhport;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
@@ -0,0 +1,9 @@
|
||||
MCU_VARIANT = stm32h533xx
|
||||
|
||||
CFLAGS += \
|
||||
-DSTM32H533xx \
|
||||
-DHSE_VALUE=24000000 \
|
||||
-DCFG_EXAMPLE_VIDEO_READONLY \
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h533re
|
||||
@@ -0,0 +1,9 @@
|
||||
set(MCU_VARIANT stm32h563xx)
|
||||
set(JLINK_DEVICE stm32h563zi)
|
||||
|
||||
function(update_board TARGET)
|
||||
target_compile_definitions(${TARGET} PUBLIC
|
||||
STM32H563xx
|
||||
HSE_VALUE=8000000
|
||||
)
|
||||
endfunction()
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||
* Copyright (c) 2023, HiFiPhile
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: STM32 H563 Nucleo
|
||||
url: https://www.st.com/en/evaluation-tools/nucleo-h563zi.html
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UART_ID 3
|
||||
|
||||
#define PINID_LED 0
|
||||
#define PINID_BUTTON 1
|
||||
#define PINID_UART_TX 2
|
||||
#define PINID_UART_RX 3
|
||||
|
||||
static board_pindef_t board_pindef[] = {
|
||||
{ // LED
|
||||
.port = GPIOG,
|
||||
.pin_init = { .Pin = GPIO_PIN_4, .Mode = GPIO_MODE_OUTPUT_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 1
|
||||
},
|
||||
{ // Button
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_0, .Mode = GPIO_MODE_INPUT, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // UART TX
|
||||
.port = GPIOD,
|
||||
.pin_init = { .Pin = GPIO_PIN_8, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF7_USART3 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // UART RX
|
||||
.port = GPIOD,
|
||||
.pin_init = { .Pin = GPIO_PIN_9, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF7_USART3 },
|
||||
.active_state = 0
|
||||
},
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// RCC Clock
|
||||
//--------------------------------------------------------------------+
|
||||
static inline void SystemClock_Config(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
|
||||
|
||||
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
|
||||
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLL1_SOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 4;
|
||||
RCC_OscInitStruct.PLL.PLLN = 250;
|
||||
RCC_OscInitStruct.PLL.PLLP = 2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 2;
|
||||
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1_VCIRANGE_1;
|
||||
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1_VCORANGE_WIDE;
|
||||
RCC_OscInitStruct.PLL.PLLFRACN = 0;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|
||||
|RCC_CLOCKTYPE_PCLK3;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1;
|
||||
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Configure the programming delay
|
||||
*/
|
||||
__HAL_FLASH_SET_PROGRAM_DELAY(FLASH_PROGRAMMING_DELAY_2);
|
||||
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB;
|
||||
PeriphClkInitStruct.PLL3.PLL3Source = RCC_PLL3_SOURCE_HSE;
|
||||
PeriphClkInitStruct.PLL3.PLL3M = 1;
|
||||
PeriphClkInitStruct.PLL3.PLL3N = 18;
|
||||
PeriphClkInitStruct.PLL3.PLL3P = 2;
|
||||
PeriphClkInitStruct.PLL3.PLL3Q = 3;
|
||||
PeriphClkInitStruct.PLL3.PLL3R = 2;
|
||||
PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3_VCIRANGE_1;
|
||||
PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3_VCORANGE_WIDE;
|
||||
PeriphClkInitStruct.PLL3.PLL3FRACN = 0.0;
|
||||
PeriphClkInitStruct.PLL3.PLL3ClockOut = RCC_PLL3_DIVQ;
|
||||
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL3Q;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
static inline void board_init2(void) {
|
||||
// Empty for this board
|
||||
}
|
||||
|
||||
void board_vbus_set(uint8_t rhport, bool state) {
|
||||
(void) rhport;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
@@ -0,0 +1,8 @@
|
||||
MCU_VARIANT = stm32h563xx
|
||||
|
||||
CFLAGS += \
|
||||
-DSTM32H563xx \
|
||||
-DHSE_VALUE=8000000 \
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h563zi
|
||||
+410
@@ -0,0 +1,410 @@
|
||||
#MicroXplorer Configuration settings - do not modify
|
||||
BOOTPATH.BootPathName=LEGACY
|
||||
BOOTPATH.IPParameters=BootPathName
|
||||
BOOTPATH.UserSelectedBootPath=LEGACY
|
||||
BSP_IP_NAME=NUCLEO-H563ZI
|
||||
CAD.formats=
|
||||
CAD.pinconfig=
|
||||
CAD.provider=
|
||||
CORTEX_M33_NS.userName=CORTEX_M33
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
KeepUserPlacement=false
|
||||
MMTAppRegionsCount=0
|
||||
MMTConfigApplied=false
|
||||
Mcu.CPN=STM32H563ZIT6
|
||||
Mcu.ContextProject=TrustZoneDisabled
|
||||
Mcu.Family=STM32H5
|
||||
Mcu.IP0=BOOTPATH
|
||||
Mcu.IP1=CORTEX_M33_NS
|
||||
Mcu.IP10=NUCLEO-H563ZI
|
||||
Mcu.IP2=DEBUG
|
||||
Mcu.IP3=ICACHE
|
||||
Mcu.IP4=MEMORYMAP
|
||||
Mcu.IP5=NVIC
|
||||
Mcu.IP6=PWR
|
||||
Mcu.IP7=RCC
|
||||
Mcu.IP8=SYS
|
||||
Mcu.IP9=USB
|
||||
Mcu.IPNb=11
|
||||
Mcu.Name=STM32H563ZITx
|
||||
Mcu.Package=LQFP144
|
||||
Mcu.Pin0=PE2
|
||||
Mcu.Pin1=PE3
|
||||
Mcu.Pin10=PC1
|
||||
Mcu.Pin11=PA1
|
||||
Mcu.Pin12=PA2
|
||||
Mcu.Pin13=PA4
|
||||
Mcu.Pin14=PA7
|
||||
Mcu.Pin15=PC4
|
||||
Mcu.Pin16=PC5
|
||||
Mcu.Pin17=PB0
|
||||
Mcu.Pin18=PB13
|
||||
Mcu.Pin19=PB14
|
||||
Mcu.Pin2=PE4
|
||||
Mcu.Pin20=PB15
|
||||
Mcu.Pin21=PD8
|
||||
Mcu.Pin22=PD9
|
||||
Mcu.Pin23=PG4
|
||||
Mcu.Pin24=PG7
|
||||
Mcu.Pin25=PA9
|
||||
Mcu.Pin26=PA11
|
||||
Mcu.Pin27=PA12
|
||||
Mcu.Pin28=PA13(JTMS/SWDIO)
|
||||
Mcu.Pin29=PA14(JTCK/SWCLK)
|
||||
Mcu.Pin3=PE5
|
||||
Mcu.Pin30=PA15(JTDI)
|
||||
Mcu.Pin31=PG11
|
||||
Mcu.Pin32=PG13
|
||||
Mcu.Pin33=PB3(JTDO/TRACESWO)
|
||||
Mcu.Pin34=PB6
|
||||
Mcu.Pin35=PB7
|
||||
Mcu.Pin36=VP_ICACHE_VS_ICACHE
|
||||
Mcu.Pin37=VP_PWR_VS_SECSignals
|
||||
Mcu.Pin38=VP_PWR_VS_LPOM
|
||||
Mcu.Pin39=VP_PWR_VS_DBSignals
|
||||
Mcu.Pin4=PE6
|
||||
Mcu.Pin40=VP_SYS_VS_Systick
|
||||
Mcu.Pin41=VP_BOOTPATH_VS_BOOTPATH
|
||||
Mcu.Pin42=VP_MEMORYMAP_VS_MEMORYMAP
|
||||
Mcu.Pin5=PC13
|
||||
Mcu.Pin6=PC14-OSC32_IN(OSC32_IN)
|
||||
Mcu.Pin7=PC15-OSC32_OUT(OSC32_OUT)
|
||||
Mcu.Pin8=PF4
|
||||
Mcu.Pin9=PH0-OSC_IN(PH0)
|
||||
Mcu.PinsNb=43
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32H563ZITx
|
||||
MxCube.Version=6.12.1
|
||||
MxDb.Version=DB.6.0.121
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.EXTI13_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
PA1.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PA1.GPIO_Label=RMII_REF_CLK
|
||||
PA1.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PA1.GPIO_PuPd=GPIO_NOPULL
|
||||
PA1.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PA1.Locked=true
|
||||
PA1.Signal=ETH_REF_CLK
|
||||
PA11.GPIOParameters=GPIO_Label
|
||||
PA11.GPIO_Label=USB_FS_N
|
||||
PA11.Locked=true
|
||||
PA11.Mode=Device
|
||||
PA11.Signal=USB_DM
|
||||
PA12.GPIOParameters=GPIO_Label
|
||||
PA12.GPIO_Label=USB_FS_P
|
||||
PA12.Locked=true
|
||||
PA12.Mode=Device
|
||||
PA12.Signal=USB_DP
|
||||
PA13(JTMS/SWDIO).GPIOParameters=GPIO_Label
|
||||
PA13(JTMS/SWDIO).GPIO_Label=SWDIO
|
||||
PA13(JTMS/SWDIO).Locked=true
|
||||
PA13(JTMS/SWDIO).Mode=Trace_Synchro_4bits_JTAG
|
||||
PA13(JTMS/SWDIO).Signal=DEBUG_JTMS-SWDIO
|
||||
PA14(JTCK/SWCLK).GPIOParameters=GPIO_Label
|
||||
PA14(JTCK/SWCLK).GPIO_Label=SWCLK
|
||||
PA14(JTCK/SWCLK).Locked=true
|
||||
PA14(JTCK/SWCLK).Mode=Trace_Synchro_4bits_JTAG
|
||||
PA14(JTCK/SWCLK).Signal=DEBUG_JTCK-SWCLK
|
||||
PA15(JTDI).GPIOParameters=GPIO_Label
|
||||
PA15(JTDI).GPIO_Label=T_JTDI
|
||||
PA15(JTDI).Locked=true
|
||||
PA15(JTDI).Mode=Trace_Synchro_4bits_JTAG
|
||||
PA15(JTDI).Signal=DEBUG_JTDI
|
||||
PA2.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PA2.GPIO_Label=RMII_MDIO
|
||||
PA2.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PA2.GPIO_PuPd=GPIO_NOPULL
|
||||
PA2.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PA2.Locked=true
|
||||
PA2.Signal=ETH_MDIO
|
||||
PA4.GPIOParameters=GPIO_Label
|
||||
PA4.GPIO_Label=VBUS_SENSE
|
||||
PA4.Locked=true
|
||||
PA4.Signal=ADCx_INP18
|
||||
PA7.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PA7.GPIO_Label=RMII_CRS_DV
|
||||
PA7.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PA7.GPIO_PuPd=GPIO_NOPULL
|
||||
PA7.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PA7.Locked=true
|
||||
PA7.Signal=ETH_CRS_DV
|
||||
PA9.GPIOParameters=GPIO_Label
|
||||
PA9.GPIO_Label=UCDP_DBn
|
||||
PA9.Locked=true
|
||||
PA9.Signal=UCPD1_DB1
|
||||
PB0.Locked=true
|
||||
PB0.Signal=GPIO_Output
|
||||
PB13.GPIOParameters=GPIO_Label
|
||||
PB13.GPIO_Label=UCPD_CC1
|
||||
PB13.Locked=true
|
||||
PB13.Signal=UCPD1_CC1
|
||||
PB14.GPIOParameters=GPIO_Label
|
||||
PB14.GPIO_Label=UCPD_CC2
|
||||
PB14.Locked=true
|
||||
PB14.Signal=UCPD1_CC2
|
||||
PB15.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PB15.GPIO_Label=RMII_TXD1
|
||||
PB15.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PB15.GPIO_PuPd=GPIO_NOPULL
|
||||
PB15.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PB15.Locked=true
|
||||
PB15.Signal=ETH_TXD1
|
||||
PB3(JTDO/TRACESWO).GPIOParameters=GPIO_Label
|
||||
PB3(JTDO/TRACESWO).GPIO_Label=SWO
|
||||
PB3(JTDO/TRACESWO).Locked=true
|
||||
PB3(JTDO/TRACESWO).Mode=Trace_Synchro_4bits_JTAG
|
||||
PB3(JTDO/TRACESWO).Signal=DEBUG_JTDO-SWO
|
||||
PB6.GPIOParameters=GPIO_Label
|
||||
PB6.GPIO_Label=ARD_D1_TX
|
||||
PB6.Locked=true
|
||||
PB6.Signal=LPUART1_TX
|
||||
PB7.GPIOParameters=GPIO_Label
|
||||
PB7.GPIO_Label=ARD_D0_RX
|
||||
PB7.Locked=true
|
||||
PB7.Signal=LPUART1_RX
|
||||
PC1.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PC1.GPIO_Label=RMII_MDC
|
||||
PC1.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PC1.GPIO_PuPd=GPIO_NOPULL
|
||||
PC1.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PC1.Locked=true
|
||||
PC1.Signal=ETH_MDC
|
||||
PC13.Locked=true
|
||||
PC13.Signal=GPXTI13
|
||||
PC14-OSC32_IN(OSC32_IN).Locked=true
|
||||
PC14-OSC32_IN(OSC32_IN).Mode=LSE-External-Oscillator
|
||||
PC14-OSC32_IN(OSC32_IN).Signal=RCC_OSC32_IN
|
||||
PC15-OSC32_OUT(OSC32_OUT).Locked=true
|
||||
PC15-OSC32_OUT(OSC32_OUT).Mode=LSE-External-Oscillator
|
||||
PC15-OSC32_OUT(OSC32_OUT).Signal=RCC_OSC32_OUT
|
||||
PC4.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PC4.GPIO_Label=RMII_RXD0
|
||||
PC4.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PC4.GPIO_PuPd=GPIO_NOPULL
|
||||
PC4.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PC4.Locked=true
|
||||
PC4.Signal=ETH_RXD0
|
||||
PC5.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PC5.GPIO_Label=RMII_RXD1
|
||||
PC5.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PC5.GPIO_PuPd=GPIO_NOPULL
|
||||
PC5.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PC5.Locked=true
|
||||
PC5.Signal=ETH_RXD1
|
||||
PD8.Locked=true
|
||||
PD8.Signal=USART3_TX
|
||||
PD9.Locked=true
|
||||
PD9.Signal=USART3_RX
|
||||
PE2.GPIOParameters=GPIO_Label
|
||||
PE2.GPIO_Label=TRACE_CK
|
||||
PE2.Locked=true
|
||||
PE2.Mode=Trace_Synchro_4bits_JTAG
|
||||
PE2.Signal=DEBUG_TRACECLK
|
||||
PE3.GPIOParameters=GPIO_Label
|
||||
PE3.GPIO_Label=TRACE_D0
|
||||
PE3.Locked=true
|
||||
PE3.Mode=Trace_Synchro_4bits_JTAG
|
||||
PE3.Signal=DEBUG_TRACED0
|
||||
PE4.GPIOParameters=GPIO_Label
|
||||
PE4.GPIO_Label=TRACE_D1
|
||||
PE4.Locked=true
|
||||
PE4.Mode=Trace_Synchro_4bits_JTAG
|
||||
PE4.Signal=DEBUG_TRACED1
|
||||
PE5.GPIOParameters=GPIO_Label
|
||||
PE5.GPIO_Label=TRACE_D2
|
||||
PE5.Locked=true
|
||||
PE5.Mode=Trace_Synchro_4bits_JTAG
|
||||
PE5.Signal=DEBUG_TRACED2
|
||||
PE6.GPIOParameters=GPIO_Label
|
||||
PE6.GPIO_Label=TRACE_D3
|
||||
PE6.Locked=true
|
||||
PE6.Mode=Trace_Synchro_4bits_JTAG
|
||||
PE6.Signal=DEBUG_TRACED3
|
||||
PF4.Locked=true
|
||||
PF4.Signal=GPIO_Output
|
||||
PG11.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PG11.GPIO_Label=RMII_TXT_EN
|
||||
PG11.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PG11.GPIO_PuPd=GPIO_NOPULL
|
||||
PG11.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PG11.Locked=true
|
||||
PG11.Signal=ETH_TX_EN
|
||||
PG13.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PG13.GPIO_Label=RMI_TXD0
|
||||
PG13.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
PG13.GPIO_PuPd=GPIO_NOPULL
|
||||
PG13.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PG13.Locked=true
|
||||
PG13.Signal=ETH_TXD0
|
||||
PG4.Locked=true
|
||||
PG4.Signal=GPIO_Output
|
||||
PG7.GPIOParameters=GPIO_Label
|
||||
PG7.GPIO_Label=UCPD_FLT
|
||||
PG7.Locked=true
|
||||
PG7.Signal=GPXTI7
|
||||
PH0-OSC_IN(PH0).GPIOParameters=GPIO_Label
|
||||
PH0-OSC_IN(PH0).GPIO_Label=STLK_MCO
|
||||
PH0-OSC_IN(PH0).Locked=true
|
||||
PH0-OSC_IN(PH0).Mode=HSE-External-Clock-Source
|
||||
PH0-OSC_IN(PH0).Signal=RCC_OSC_IN
|
||||
PinOutPanel.RotationAngle=0
|
||||
ProjectManager.AskForMigrate=true
|
||||
ProjectManager.BackupPrevious=false
|
||||
ProjectManager.CompilerOptimize=6
|
||||
ProjectManager.ComputerToolchain=false
|
||||
ProjectManager.CoupleFile=false
|
||||
ProjectManager.CustomerFirmwarePackage=
|
||||
ProjectManager.DefaultFWLocation=true
|
||||
ProjectManager.DeletePrevious=true
|
||||
ProjectManager.DeviceId=STM32H563ZITx
|
||||
ProjectManager.FirmwarePackage=STM32Cube FW_H5 V1.3.0
|
||||
ProjectManager.FreePins=false
|
||||
ProjectManager.HalAssertFull=false
|
||||
ProjectManager.HeapSize=0x200
|
||||
ProjectManager.KeepUserCode=true
|
||||
ProjectManager.LastFirmware=true
|
||||
ProjectManager.LibraryCopy=2
|
||||
ProjectManager.MainLocation=Core/Src
|
||||
ProjectManager.NoMain=false
|
||||
ProjectManager.PreviousToolchain=
|
||||
ProjectManager.ProjectBuild=false
|
||||
ProjectManager.ProjectFileName=stm32h563nucleo.ioc
|
||||
ProjectManager.ProjectName=stm32h563nucleo
|
||||
ProjectManager.ProjectStructure=
|
||||
ProjectManager.RegisterCallBack=
|
||||
ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=Makefile
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USB_PCD_Init-USB-false-HAL-true,4-MX_ICACHE_Init-ICACHE-false-HAL-true,0-MX_CORTEX_M33_NS_Init-CORTEX_M33_NS-false-HAL-true,0-MX_PWR_Init-PWR-false-HAL-true
|
||||
RCC.ADCFreq_Value=250000000
|
||||
RCC.AHBFreq_Value=250000000
|
||||
RCC.APB1Freq_Value=250000000
|
||||
RCC.APB1TimFreq_Value=250000000
|
||||
RCC.APB2Freq_Value=250000000
|
||||
RCC.APB2TimFreq_Value=250000000
|
||||
RCC.APB3Freq_Value=250000000
|
||||
RCC.CECFreq_Value=32000
|
||||
RCC.CKPERFreq_Value=64000000
|
||||
RCC.CRSFreq_Value=48000000
|
||||
RCC.CSI_VALUE=4000000
|
||||
RCC.CortexFreq_Value=250000000
|
||||
RCC.DACFreq_Value=32768
|
||||
RCC.EPOD_VALUE=8000000
|
||||
RCC.ETHFreq_Value=250000000
|
||||
RCC.FCLKCortexFreq_Value=250000000
|
||||
RCC.FDCANFreq_Value=8000000
|
||||
RCC.FamilyName=M
|
||||
RCC.HCLKFreq_Value=250000000
|
||||
RCC.HSE_VALUE=8000000
|
||||
RCC.HSI48_VALUE=48000000
|
||||
RCC.HSIDiv=RCC_HSI_DIV1
|
||||
RCC.HSI_VALUE=64000000
|
||||
RCC.I2C1Freq_Value=250000000
|
||||
RCC.I2C2Freq_Value=250000000
|
||||
RCC.I2C3Freq_Value=250000000
|
||||
RCC.I2C4Freq_Value=250000000
|
||||
RCC.I3C1Freq_Value=250000000
|
||||
RCC.IPParameters=ADCFreq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,APB3Freq_Value,CECFreq_Value,CKPERFreq_Value,CRSFreq_Value,CSI_VALUE,CortexFreq_Value,DACFreq_Value,EPOD_VALUE,ETHFreq_Value,FCLKCortexFreq_Value,FDCANFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI48_VALUE,HSIDiv,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,I3C1Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM3Freq_Value,LPTIM4Freq_Value,LPTIM5Freq_Value,LPTIM6Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSIRC_VALUE,MCO1PinFreq_Value,MCO2PinFreq_Value,OCTOSPIMFreq_Value,PLL2PoutputFreq_Value,PLL2QoutputFreq_Value,PLL2RoutputFreq_Value,PLL2Source,PLL3FRACN,PLL3N,PLL3PoutputFreq_Value,PLL3Q,PLL3QoutputFreq_Value,PLL3RoutputFreq_Value,PLL3Source,PLLFRACN,PLLM,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLSourceVirtual,PWRFreq_Value,RNGFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMC1Freq_Value,SDMMC2Freq_Value,SPI1Freq_Value,SPI2Freq_Value,SPI3Freq_Value,SPI4Freq_Value,SPI5Freq_Value,SPI6Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART12Freq_Value,UART4Freq_Value,UART5Freq_Value,UART7Freq_Value,UART8Freq_Value,UART9Freq_Value,UCPD1outputFreq_Value,USART10Freq_Value,USART11Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USART6Freq_Value,USBCLockSelection,USBFreq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOPLL2OutputFreq_Value,VCOPLL3OutputFreq_Value
|
||||
RCC.LPTIM1Freq_Value=250000000
|
||||
RCC.LPTIM2Freq_Value=250000000
|
||||
RCC.LPTIM3Freq_Value=250000000
|
||||
RCC.LPTIM4Freq_Value=250000000
|
||||
RCC.LPTIM5Freq_Value=250000000
|
||||
RCC.LPTIM6Freq_Value=250000000
|
||||
RCC.LPUART1Freq_Value=250000000
|
||||
RCC.LSCOPinFreq_Value=32000
|
||||
RCC.LSIRC_VALUE=32000
|
||||
RCC.MCO1PinFreq_Value=64000000
|
||||
RCC.MCO2PinFreq_Value=250000000
|
||||
RCC.OCTOSPIMFreq_Value=250000000
|
||||
RCC.PLL2PoutputFreq_Value=516000000
|
||||
RCC.PLL2QoutputFreq_Value=516000000
|
||||
RCC.PLL2RoutputFreq_Value=516000000
|
||||
RCC.PLL2Source=RCC_PLL2_SOURCE_HSE
|
||||
RCC.PLL3FRACN=0
|
||||
RCC.PLL3N=18
|
||||
RCC.PLL3PoutputFreq_Value=72000000
|
||||
RCC.PLL3Q=3
|
||||
RCC.PLL3QoutputFreq_Value=48000000
|
||||
RCC.PLL3RoutputFreq_Value=72000000
|
||||
RCC.PLL3Source=RCC_PLL3_SOURCE_HSE
|
||||
RCC.PLLFRACN=0
|
||||
RCC.PLLM=4
|
||||
RCC.PLLN=250
|
||||
RCC.PLLPoutputFreq_Value=250000000
|
||||
RCC.PLLQoutputFreq_Value=250000000
|
||||
RCC.PLLSourceVirtual=RCC_PLL1_SOURCE_HSE
|
||||
RCC.PWRFreq_Value=250000000
|
||||
RCC.RNGFreq_Value=48000000
|
||||
RCC.SAI1Freq_Value=516000000
|
||||
RCC.SAI2Freq_Value=516000000
|
||||
RCC.SDMMC1Freq_Value=250000000
|
||||
RCC.SDMMC2Freq_Value=250000000
|
||||
RCC.SPI1Freq_Value=250000000
|
||||
RCC.SPI2Freq_Value=250000000
|
||||
RCC.SPI3Freq_Value=250000000
|
||||
RCC.SPI4Freq_Value=250000000
|
||||
RCC.SPI5Freq_Value=250000000
|
||||
RCC.SPI6Freq_Value=250000000
|
||||
RCC.SYSCLKFreq_VALUE=250000000
|
||||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||
RCC.UART12Freq_Value=250000000
|
||||
RCC.UART4Freq_Value=250000000
|
||||
RCC.UART5Freq_Value=250000000
|
||||
RCC.UART7Freq_Value=250000000
|
||||
RCC.UART8Freq_Value=250000000
|
||||
RCC.UART9Freq_Value=250000000
|
||||
RCC.UCPD1outputFreq_Value=16000000
|
||||
RCC.USART10Freq_Value=250000000
|
||||
RCC.USART11Freq_Value=250000000
|
||||
RCC.USART1Freq_Value=250000000
|
||||
RCC.USART2Freq_Value=250000000
|
||||
RCC.USART3Freq_Value=250000000
|
||||
RCC.USART6Freq_Value=250000000
|
||||
RCC.USBCLockSelection=RCC_USBCLKSOURCE_PLL3Q
|
||||
RCC.USBFreq_Value=48000000
|
||||
RCC.VCOInput2Freq_Value=8000000
|
||||
RCC.VCOInput3Freq_Value=8000000
|
||||
RCC.VCOInputFreq_Value=2000000
|
||||
RCC.VCOOutputFreq_Value=500000000
|
||||
RCC.VCOPLL2OutputFreq_Value=1032000000
|
||||
RCC.VCOPLL3OutputFreq_Value=144000000
|
||||
SH.ADCx_INP18.0=ADC1_INP18
|
||||
SH.ADCx_INP18.ConfNb=1
|
||||
SH.GPXTI13.0=GPIO_EXTI13
|
||||
SH.GPXTI13.ConfNb=1
|
||||
SH.GPXTI7.0=GPIO_EXTI7
|
||||
SH.GPXTI7.ConfNb=1
|
||||
USB.IPParameters=VirtualMode
|
||||
USB.VirtualMode=Device_Only
|
||||
VP_BOOTPATH_VS_BOOTPATH.Mode=BP_Activate
|
||||
VP_BOOTPATH_VS_BOOTPATH.Signal=BOOTPATH_VS_BOOTPATH
|
||||
VP_ICACHE_VS_ICACHE.Mode=DirectMappedCache
|
||||
VP_ICACHE_VS_ICACHE.Signal=ICACHE_VS_ICACHE
|
||||
VP_MEMORYMAP_VS_MEMORYMAP.Mode=CurAppReg
|
||||
VP_MEMORYMAP_VS_MEMORYMAP.Signal=MEMORYMAP_VS_MEMORYMAP
|
||||
VP_PWR_VS_DBSignals.Mode=DisableDeadBatterySignals
|
||||
VP_PWR_VS_DBSignals.Signal=PWR_VS_DBSignals
|
||||
VP_PWR_VS_LPOM.Mode=PowerOptimisation
|
||||
VP_PWR_VS_LPOM.Signal=PWR_VS_LPOM
|
||||
VP_PWR_VS_SECSignals.Mode=Security/Privilege
|
||||
VP_PWR_VS_SECSignals.Signal=PWR_VS_SECSignals
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
board=NUCLEO-H563ZI
|
||||
boardIOC=true
|
||||
@@ -0,0 +1,15 @@
|
||||
set(MCU_VARIANT stm32h573xx)
|
||||
set(JLINK_DEVICE stm32h573ii)
|
||||
|
||||
function(update_board TARGET)
|
||||
target_compile_definitions(${TARGET} PUBLIC
|
||||
STM32H573xx
|
||||
)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${ST_TCPP0203}/tcpp0203.c
|
||||
${ST_TCPP0203}/tcpp0203_reg.c
|
||||
)
|
||||
target_include_directories(${TARGET} PUBLIC
|
||||
${ST_TCPP0203}
|
||||
)
|
||||
endfunction()
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||
* Copyright (c) 2023, HiFiPhile
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: STM32 H573i Discovery
|
||||
url: https://www.st.com/en/evaluation-tools/stm32h573i-dk.html
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "tcpp0203.h"
|
||||
|
||||
// VBUS Sense detection
|
||||
#define OTG_FS_VBUS_SENSE 1
|
||||
#define OTG_HS_VBUS_SENSE 0
|
||||
|
||||
#define UART_ID 1
|
||||
|
||||
#define PINID_LED 0
|
||||
#define PINID_BUTTON 1
|
||||
#define PINID_UART_TX 2
|
||||
#define PINID_UART_RX 3
|
||||
#define PINID_TCPP0203_EN 4
|
||||
#define PINID_I2C_SCL 5
|
||||
#define PINID_I2C_SDA 6
|
||||
#define PINID_TCPP0203_INT 7
|
||||
|
||||
static board_pindef_t board_pindef[] = {
|
||||
{ // LED
|
||||
.port = GPIOI,
|
||||
.pin_init = { .Pin = GPIO_PIN_9, .Mode = GPIO_MODE_OUTPUT_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 1
|
||||
},
|
||||
{ // Button
|
||||
.port = GPIOC,
|
||||
.pin_init = { .Pin = GPIO_PIN_13, .Mode = GPIO_MODE_INPUT, .Pull = GPIO_PULLDOWN, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 1
|
||||
},
|
||||
{ // UART TX
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_9, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF7_USART1 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // UART RX
|
||||
.port = GPIOA,
|
||||
.pin_init = { .Pin = GPIO_PIN_10, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF7_USART1 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // TCPP0203 VCC_EN
|
||||
.port = GPIOG,
|
||||
.pin_init = { .Pin = GPIO_PIN_0, .Mode = GPIO_MODE_OUTPUT_PP, .Pull = GPIO_NOPULL, .Speed = GPIO_SPEED_FREQ_LOW, .Alternate = 0 },
|
||||
.active_state = 1
|
||||
},
|
||||
{ // I2C4 SCL
|
||||
.port = GPIOB,
|
||||
.pin_init = { .Pin = GPIO_PIN_8, .Mode = GPIO_MODE_AF_OD, .Pull = GPIO_NOPULL, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF6_I2C4 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // I2C4 SDA
|
||||
.port = GPIOB,
|
||||
.pin_init = { .Pin = GPIO_PIN_9, .Mode = GPIO_MODE_AF_OD, .Pull = GPIO_NOPULL, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = GPIO_AF6_I2C4 },
|
||||
.active_state = 0
|
||||
},
|
||||
{ // TCPP0203 INT
|
||||
.port = GPIOG,
|
||||
.pin_init = { .Pin = GPIO_PIN_1, .Mode = GPIO_MODE_IT_FALLING, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_FREQ_HIGH, .Alternate = 0 },
|
||||
.active_state = 0
|
||||
},
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// RCC Clock
|
||||
//--------------------------------------------------------------------+
|
||||
static inline void SystemClock_Config(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure the main internal regulator output voltage */
|
||||
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
Freq 250MHZ */
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS_DIGITAL;
|
||||
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLL1_SOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 5;
|
||||
RCC_OscInitStruct.PLL.PLLN = 100;
|
||||
RCC_OscInitStruct.PLL.PLLP = 2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 10;
|
||||
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1_VCIRANGE_2;
|
||||
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1_VCORANGE_WIDE;
|
||||
RCC_OscInitStruct.PLL.PLLFRACN = 0;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks */
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
||||
|
||||
// Configure CRS clock source
|
||||
__HAL_RCC_CRS_CLK_ENABLE();
|
||||
RCC_CRSInitTypeDef RCC_CRSInitStruct = {0};
|
||||
RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;
|
||||
RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB;
|
||||
RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
|
||||
RCC_CRSInitStruct.ReloadValue = __HAL_RCC_CRS_RELOADVALUE_CALCULATE(48000000, 1000);
|
||||
RCC_CRSInitStruct.ErrorLimitValue = 34;
|
||||
RCC_CRSInitStruct.HSI48CalibrationValue = 32;
|
||||
HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct);
|
||||
|
||||
/* Select HSI48 as USB clock source */
|
||||
RCC_PeriphCLKInitTypeDef usb_clk = {0 };
|
||||
usb_clk.PeriphClockSelection = RCC_PERIPHCLK_USB;
|
||||
usb_clk.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
|
||||
HAL_RCCEx_PeriphCLKConfig(&usb_clk);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USB_CLK_ENABLE();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB PD
|
||||
//--------------------------------------------------------------------+
|
||||
static I2C_HandleTypeDef i2c_handle = {
|
||||
.Instance = I2C4,
|
||||
.Init = {
|
||||
.Timing = 0x20C0EDFF, // 100kHz @ 250MHz
|
||||
.OwnAddress1 = 0,
|
||||
.AddressingMode = I2C_ADDRESSINGMODE_7BIT,
|
||||
.DualAddressMode = I2C_DUALADDRESS_DISABLE,
|
||||
.OwnAddress2 = 0,
|
||||
.OwnAddress2Masks = I2C_OA2_NOMASK,
|
||||
.GeneralCallMode = I2C_GENERALCALL_DISABLE,
|
||||
.NoStretchMode = I2C_NOSTRETCH_DISABLE,
|
||||
}
|
||||
};
|
||||
static TCPP0203_Object_t tcpp0203_obj = { 0 };
|
||||
|
||||
int32_t board_tcpp0203_init(void) {
|
||||
// Enable TCPP0203 VCC (GPIO already configured in pindef array)
|
||||
board_pindef_t* pindef = &board_pindef[PINID_TCPP0203_EN];
|
||||
HAL_GPIO_WritePin(pindef->port, pindef->pin_init.Pin, GPIO_PIN_SET);
|
||||
|
||||
// Initialize I2C4 for TCPP0203 (GPIO already configured in pindef array)
|
||||
__HAL_RCC_I2C4_CLK_ENABLE();
|
||||
__HAL_RCC_I2C4_FORCE_RESET();
|
||||
__HAL_RCC_I2C4_RELEASE_RESET();
|
||||
if (HAL_I2C_Init(&i2c_handle) != HAL_OK) {
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
// Enable interrupt for TCPP0203 FLGn (GPIO already configured in pindef array)
|
||||
NVIC_SetPriority(EXTI1_IRQn, 12);
|
||||
NVIC_EnableIRQ(EXTI1_IRQn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t board_tcpp0203_deinit(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t i2c_readreg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length) {
|
||||
TU_ASSERT (HAL_OK == HAL_I2C_Mem_Read(&i2c_handle, DevAddr, Reg, I2C_MEMADD_SIZE_8BIT, pData, Length, 10000));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t i2c_writereg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length) {
|
||||
TU_ASSERT(HAL_OK == HAL_I2C_Mem_Write(&i2c_handle, DevAddr, Reg, I2C_MEMADD_SIZE_8BIT, pData, Length, 10000));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t i2c_get_tick(void) {
|
||||
return (int32_t) HAL_GetTick();
|
||||
}
|
||||
|
||||
static inline void board_init2(void) {
|
||||
TCPP0203_IO_t io_ctx;
|
||||
|
||||
io_ctx.Address = TCPP0203_I2C_ADDRESS_X68;
|
||||
io_ctx.Init = board_tcpp0203_init;
|
||||
io_ctx.DeInit = board_tcpp0203_deinit;
|
||||
io_ctx.ReadReg = i2c_readreg;
|
||||
io_ctx.WriteReg = i2c_writereg;
|
||||
io_ctx.GetTick = i2c_get_tick;
|
||||
|
||||
TU_ASSERT(TCPP0203_RegisterBusIO(&tcpp0203_obj, &io_ctx) == TCPP0203_OK, );
|
||||
|
||||
TU_ASSERT(TCPP0203_Init(&tcpp0203_obj) == TCPP0203_OK, );
|
||||
|
||||
TU_ASSERT(TCPP0203_SetPowerMode(&tcpp0203_obj, TCPP0203_POWER_MODE_NORMAL) == TCPP0203_OK, );
|
||||
}
|
||||
|
||||
void board_vbus_set(uint8_t rhport, bool state) {
|
||||
(void) state;
|
||||
if (rhport == 0) {
|
||||
TU_ASSERT(TCPP0203_SetGateDriverProvider(&tcpp0203_obj, TCPP0203_GD_PROVIDER_SWITCH_CLOSED) == TCPP0203_OK, );
|
||||
}
|
||||
}
|
||||
|
||||
void EXTI1_IRQHandler(void) {
|
||||
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_1);
|
||||
if (tcpp0203_obj.IsInitialized) {
|
||||
TU_ASSERT(TCPP0203_SetPowerMode(&tcpp0203_obj, TCPP0203_POWER_MODE_NORMAL) == TCPP0203_OK, );
|
||||
TU_ASSERT(TCPP0203_SetGateDriverProvider(&tcpp0203_obj, TCPP0203_GD_PROVIDER_SWITCH_CLOSED) == TCPP0203_OK, );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
@@ -0,0 +1,14 @@
|
||||
MCU_VARIANT = stm32h573xx
|
||||
|
||||
CFLAGS += \
|
||||
-DSTM32H573xx
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h573ii
|
||||
|
||||
SRC_C += \
|
||||
$(ST_TCPP0203)/tcpp0203.c \
|
||||
$(ST_TCPP0203)/tcpp0203_reg.c \
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(ST_TCPP0203) \
|
||||
Reference in new issue
Block a user