[bsp][stm32] Add USB HS for H7-TOOL.|为 H7-TOOL 添加 USBHS.
This commit is contained in:
parent
f50f38745b
commit
9f8d6557ea
|
@ -42,7 +42,7 @@ if GetDepend(['RT_USING_SPI']):
|
|||
src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c']
|
||||
|
||||
if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
|
||||
src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pccard.c']
|
||||
# src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pccard.c']
|
||||
src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd.c']
|
||||
src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd_ex.c']
|
||||
src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_hcd.c']
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,6 +16,7 @@ Mcu.IP10=SYS
|
|||
Mcu.IP11=TIM12
|
||||
Mcu.IP12=UART4
|
||||
Mcu.IP13=USART1
|
||||
Mcu.IP14=USB_OTG_HS
|
||||
Mcu.IP2=CRC
|
||||
Mcu.IP3=DAC1
|
||||
Mcu.IP4=ETH
|
||||
|
@ -24,54 +25,66 @@ Mcu.IP6=QUADSPI
|
|||
Mcu.IP7=RCC
|
||||
Mcu.IP8=RNG
|
||||
Mcu.IP9=SDMMC1
|
||||
Mcu.IPNb=14
|
||||
Mcu.IPNb=15
|
||||
Mcu.Name=STM32H750IBKx
|
||||
Mcu.Package=UFBGA176
|
||||
Mcu.Pin0=PB8
|
||||
Mcu.Pin1=PG14
|
||||
Mcu.Pin10=PC14-OSC32_IN (OSC32_IN)
|
||||
Mcu.Pin11=PH13
|
||||
Mcu.Pin12=PH14
|
||||
Mcu.Pin13=PA9
|
||||
Mcu.Pin14=PC15-OSC32_OUT (OSC32_OUT)
|
||||
Mcu.Pin15=PC9
|
||||
Mcu.Pin16=PH0-OSC_IN (PH0)
|
||||
Mcu.Pin17=PC8
|
||||
Mcu.Pin18=PC7
|
||||
Mcu.Pin19=PH1-OSC_OUT (PH1)
|
||||
Mcu.Pin2=PG13
|
||||
Mcu.Pin20=PC6
|
||||
Mcu.Pin21=PF3
|
||||
Mcu.Pin22=PG6
|
||||
Mcu.Pin23=PF7
|
||||
Mcu.Pin24=PF8
|
||||
Mcu.Pin25=PC1
|
||||
Mcu.Pin26=PB2
|
||||
Mcu.Pin27=PH9
|
||||
Mcu.Pin28=PD13
|
||||
Mcu.Pin29=PA1
|
||||
Mcu.Pin3=PC12
|
||||
Mcu.Pin30=PA4
|
||||
Mcu.Pin31=PC4
|
||||
Mcu.Pin32=PH7
|
||||
Mcu.Pin33=PD12
|
||||
Mcu.Pin34=PD11
|
||||
Mcu.Pin35=PA2
|
||||
Mcu.Pin36=PC5
|
||||
Mcu.Pin37=PF12
|
||||
Mcu.Pin38=PA7
|
||||
Mcu.Pin39=PB14
|
||||
Mcu.Pin4=PB9
|
||||
Mcu.Pin40=VP_CRC_VS_CRC
|
||||
Mcu.Pin41=VP_RNG_VS_RNG
|
||||
Mcu.Pin42=VP_SYS_VS_Systick
|
||||
Mcu.Pin43=VP_TIM12_VS_ControllerModeReset
|
||||
Mcu.Pin5=PG11
|
||||
Mcu.Pin6=PC11
|
||||
Mcu.Pin7=PC10
|
||||
Mcu.Pin8=PD2
|
||||
Mcu.Pin9=PA10
|
||||
Mcu.PinsNb=44
|
||||
Mcu.Pin1=PB5
|
||||
Mcu.Pin10=PA10
|
||||
Mcu.Pin11=PC14-OSC32_IN (OSC32_IN)
|
||||
Mcu.Pin12=PI11
|
||||
Mcu.Pin13=PH13
|
||||
Mcu.Pin14=PH14
|
||||
Mcu.Pin15=PA9
|
||||
Mcu.Pin16=PC15-OSC32_OUT (OSC32_OUT)
|
||||
Mcu.Pin17=PC9
|
||||
Mcu.Pin18=PH0-OSC_IN (PH0)
|
||||
Mcu.Pin19=PC8
|
||||
Mcu.Pin2=PG14
|
||||
Mcu.Pin20=PC7
|
||||
Mcu.Pin21=PH1-OSC_OUT (PH1)
|
||||
Mcu.Pin22=PH4
|
||||
Mcu.Pin23=PC6
|
||||
Mcu.Pin24=PF3
|
||||
Mcu.Pin25=PG6
|
||||
Mcu.Pin26=PF7
|
||||
Mcu.Pin27=PF8
|
||||
Mcu.Pin28=PC0
|
||||
Mcu.Pin29=PC1
|
||||
Mcu.Pin3=PG13
|
||||
Mcu.Pin30=PB2
|
||||
Mcu.Pin31=PH9
|
||||
Mcu.Pin32=PD13
|
||||
Mcu.Pin33=PA1
|
||||
Mcu.Pin34=PA4
|
||||
Mcu.Pin35=PC4
|
||||
Mcu.Pin36=PH7
|
||||
Mcu.Pin37=PD12
|
||||
Mcu.Pin38=PD11
|
||||
Mcu.Pin39=PA2
|
||||
Mcu.Pin4=PC12
|
||||
Mcu.Pin40=PA5
|
||||
Mcu.Pin41=PC5
|
||||
Mcu.Pin42=PF12
|
||||
Mcu.Pin43=PB12
|
||||
Mcu.Pin44=PB13
|
||||
Mcu.Pin45=PA3
|
||||
Mcu.Pin46=PA7
|
||||
Mcu.Pin47=PB1
|
||||
Mcu.Pin48=PB0
|
||||
Mcu.Pin49=PB10
|
||||
Mcu.Pin5=PB9
|
||||
Mcu.Pin50=PB11
|
||||
Mcu.Pin51=PB14
|
||||
Mcu.Pin52=VP_CRC_VS_CRC
|
||||
Mcu.Pin53=VP_RNG_VS_RNG
|
||||
Mcu.Pin54=VP_SYS_VS_Systick
|
||||
Mcu.Pin55=VP_TIM12_VS_ControllerModeReset
|
||||
Mcu.Pin6=PG11
|
||||
Mcu.Pin7=PC11
|
||||
Mcu.Pin8=PC10
|
||||
Mcu.Pin9=PD2
|
||||
Mcu.PinsNb=56
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32H750IBKx
|
||||
|
@ -79,9 +92,11 @@ MxCube.Version=5.3.0
|
|||
MxDb.Version=DB.5.0.30
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.OTG_HS_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
|
@ -94,20 +109,40 @@ PA10.Mode=Asynchronous
|
|||
PA10.Signal=USART1_RX
|
||||
PA2.Mode=RMII
|
||||
PA2.Signal=ETH_MDIO
|
||||
PA3.Mode=Device_HS
|
||||
PA3.Signal=USB_OTG_HS_ULPI_D0
|
||||
PA4.Signal=COMP_DAC11_group
|
||||
PA5.Mode=Device_HS
|
||||
PA5.Signal=USB_OTG_HS_ULPI_CK
|
||||
PA7.Mode=RMII
|
||||
PA7.Signal=ETH_CRS_DV
|
||||
PA9.Locked=true
|
||||
PA9.Mode=Asynchronous
|
||||
PA9.Signal=USART1_TX
|
||||
PB0.Mode=Device_HS
|
||||
PB0.Signal=USB_OTG_HS_ULPI_D1
|
||||
PB1.Mode=Device_HS
|
||||
PB1.Signal=USB_OTG_HS_ULPI_D2
|
||||
PB10.Mode=Device_HS
|
||||
PB10.Signal=USB_OTG_HS_ULPI_D3
|
||||
PB11.Mode=Device_HS
|
||||
PB11.Signal=USB_OTG_HS_ULPI_D4
|
||||
PB12.Mode=Device_HS
|
||||
PB12.Signal=USB_OTG_HS_ULPI_D5
|
||||
PB13.Mode=Device_HS
|
||||
PB13.Signal=USB_OTG_HS_ULPI_D6
|
||||
PB14.Signal=S_TIM12_CH1
|
||||
PB2.Locked=true
|
||||
PB2.Mode=Single Bank 1
|
||||
PB2.Signal=QUADSPI_CLK
|
||||
PB5.Mode=Device_HS
|
||||
PB5.Signal=USB_OTG_HS_ULPI_D7
|
||||
PB8.Mode=mmc_8_bits_Wide_bus
|
||||
PB8.Signal=SDMMC1_D4
|
||||
PB9.Mode=mmc_8_bits_Wide_bus
|
||||
PB9.Signal=SDMMC1_D5
|
||||
PC0.Mode=Device_HS
|
||||
PC0.Signal=USB_OTG_HS_ULPI_STP
|
||||
PC1.Mode=RMII
|
||||
PC1.Signal=ETH_MDC
|
||||
PC10.Mode=mmc_8_bits_Wide_bus
|
||||
|
@ -180,12 +215,16 @@ PH13.Signal=UART4_TX
|
|||
PH14.Locked=true
|
||||
PH14.Mode=Asynchronous
|
||||
PH14.Signal=UART4_RX
|
||||
PH4.Mode=Device_HS
|
||||
PH4.Signal=USB_OTG_HS_ULPI_NXT
|
||||
PH7.Locked=true
|
||||
PH7.Signal=SPI5_MISO
|
||||
PH9.Signal=S_TIM12_CH2
|
||||
PI11.Mode=Device_HS
|
||||
PI11.Signal=USB_OTG_HS_ULPI_DIR
|
||||
PinOutPanel.CurrentBGAView=Top
|
||||
PinOutPanel.RotationAngle=0
|
||||
ProjectManager.AskForMigrate=true
|
||||
ProjectManager.AskForMigrate=false
|
||||
ProjectManager.BackupPrevious=false
|
||||
ProjectManager.CompilerOptimize=6
|
||||
ProjectManager.ComputerToolchain=false
|
||||
|
@ -211,7 +250,7 @@ ProjectManager.StackSize=0x400
|
|||
ProjectManager.TargetToolchain=MDK-ARM V5
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_CRC_Init-CRC-false-HAL-true,5-MX_RNG_Init-RNG-false-HAL-true,6-MX_ADC3_Init-ADC3-false-HAL-true,7-MX_DAC1_Init-DAC1-false-HAL-true,8-MX_ETH_Init-ETH-false-HAL-true,9-MX_QUADSPI_Init-QUADSPI-false-HAL-true,10-MX_SDMMC1_MMC_Init-SDMMC1-false-HAL-true,11-MX_SPI5_Init-SPI5-false-HAL-true,12-MX_UART4_Init-UART4-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_CRC_Init-CRC-false-HAL-true,5-MX_RNG_Init-RNG-false-HAL-true,6-MX_ADC3_Init-ADC3-false-HAL-true,7-MX_DAC1_Init-DAC1-false-HAL-true,8-MX_ETH_Init-ETH-false-HAL-true,9-MX_QUADSPI_Init-QUADSPI-false-HAL-true,10-MX_SDMMC1_MMC_Init-SDMMC1-false-HAL-true,11-MX_UART4_Init-UART4-false-HAL-true,12-MX_TIM12_Init-TIM12-false-HAL-true,13-MX_USB_OTG_HS_PCD_Init-USB_OTG_HS-false-HAL-true
|
||||
RCC.ADCFreq_Value=480000000
|
||||
RCC.AHB12Freq_Value=200000000
|
||||
RCC.AHB4Freq_Value=200000000
|
||||
|
@ -302,6 +341,8 @@ TIM12.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
|||
TIM12.IPParameters=Channel-PWM Generation2 CH2
|
||||
USART1.IPParameters=VirtualMode-Asynchronous
|
||||
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
||||
USB_OTG_HS.IPParameters=VirtualMode-Device_HS
|
||||
USB_OTG_HS.VirtualMode-Device_HS=Device_HS
|
||||
VP_CRC_VS_CRC.Mode=CRC_Activate
|
||||
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
|
||||
VP_RNG_VS_RNG.Mode=RNG_Activate
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||
/* #define HAL_PCD_MODULE_ENABLED */
|
||||
#define HAL_PCD_MODULE_ENABLED
|
||||
/* #define HAL_HCD_MODULE_ENABLED */
|
||||
/* #define HAL_DFSDM_MODULE_ENABLED */
|
||||
/* #define HAL_DSI_MODULE_ENABLED */
|
||||
|
|
|
@ -56,6 +56,7 @@ void SVC_Handler(void);
|
|||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void OTG_HS_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
|
|
@ -86,6 +86,8 @@ TIM_HandleTypeDef htim12;
|
|||
UART_HandleTypeDef huart4;
|
||||
UART_HandleTypeDef huart1;
|
||||
|
||||
PCD_HandleTypeDef hpcd_USB_OTG_HS;
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
@ -103,6 +105,7 @@ static void MX_QUADSPI_Init(void);
|
|||
static void MX_SDMMC1_MMC_Init(void);
|
||||
static void MX_UART4_Init(void);
|
||||
static void MX_TIM12_Init(void);
|
||||
static void MX_USB_OTG_HS_PCD_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
@ -151,6 +154,7 @@ int main(void)
|
|||
MX_SDMMC1_MMC_Init();
|
||||
MX_UART4_Init();
|
||||
MX_TIM12_Init();
|
||||
MX_USB_OTG_HS_PCD_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
@ -670,6 +674,42 @@ static void MX_USART1_UART_Init(void)
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USB_OTG_HS Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_USB_OTG_HS_PCD_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN USB_OTG_HS_Init 0 */
|
||||
|
||||
/* USER CODE END USB_OTG_HS_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN USB_OTG_HS_Init 1 */
|
||||
|
||||
/* USER CODE END USB_OTG_HS_Init 1 */
|
||||
hpcd_USB_OTG_HS.Instance = USB_OTG_HS;
|
||||
hpcd_USB_OTG_HS.Init.dev_endpoints = 9;
|
||||
hpcd_USB_OTG_HS.Init.speed = PCD_SPEED_HIGH;
|
||||
hpcd_USB_OTG_HS.Init.dma_enable = DISABLE;
|
||||
hpcd_USB_OTG_HS.Init.phy_itface = USB_OTG_ULPI_PHY;
|
||||
hpcd_USB_OTG_HS.Init.Sof_enable = DISABLE;
|
||||
hpcd_USB_OTG_HS.Init.low_power_enable = DISABLE;
|
||||
hpcd_USB_OTG_HS.Init.lpm_enable = DISABLE;
|
||||
hpcd_USB_OTG_HS.Init.vbus_sensing_enable = DISABLE;
|
||||
hpcd_USB_OTG_HS.Init.use_dedicated_ep1 = DISABLE;
|
||||
hpcd_USB_OTG_HS.Init.use_external_vbus = DISABLE;
|
||||
if (HAL_PCD_Init(&hpcd_USB_OTG_HS) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN USB_OTG_HS_Init 2 */
|
||||
|
||||
/* USER CODE END USB_OTG_HS_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GPIO Initialization Function
|
||||
* @param None
|
||||
|
@ -685,6 +725,7 @@ static void MX_GPIO_Init(void)
|
|||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOI_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
|
||||
|
|
|
@ -798,6 +798,140 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PCD MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hpcd: PCD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hpcd->Instance==USB_OTG_HS)
|
||||
{
|
||||
/* USER CODE BEGIN USB_OTG_HS_MspInit 0 */
|
||||
|
||||
/* USER CODE END USB_OTG_HS_MspInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOI_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**USB_OTG_HS GPIO Configuration
|
||||
PB5 ------> USB_OTG_HS_ULPI_D7
|
||||
PI11 ------> USB_OTG_HS_ULPI_DIR
|
||||
PH4 ------> USB_OTG_HS_ULPI_NXT
|
||||
PC0 ------> USB_OTG_HS_ULPI_STP
|
||||
PA5 ------> USB_OTG_HS_ULPI_CK
|
||||
PB12 ------> USB_OTG_HS_ULPI_D5
|
||||
PB13 ------> USB_OTG_HS_ULPI_D6
|
||||
PA3 ------> USB_OTG_HS_ULPI_D0
|
||||
PB1 ------> USB_OTG_HS_ULPI_D2
|
||||
PB0 ------> USB_OTG_HS_ULPI_D1
|
||||
PB10 ------> USB_OTG_HS_ULPI_D3
|
||||
PB11 ------> USB_OTG_HS_ULPI_D4
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_1
|
||||
|GPIO_PIN_0|GPIO_PIN_10|GPIO_PIN_11;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG2_HS;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG2_HS;
|
||||
HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_4;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG2_HS;
|
||||
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG2_HS;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_3;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG2_HS;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
|
||||
__HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();
|
||||
/* USB_OTG_HS interrupt Init */
|
||||
HAL_NVIC_SetPriority(OTG_HS_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(OTG_HS_IRQn);
|
||||
/* USER CODE BEGIN USB_OTG_HS_MspInit 1 */
|
||||
|
||||
/* USER CODE END USB_OTG_HS_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PCD MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hpcd: PCD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_PCD_MspDeInit(PCD_HandleTypeDef* hpcd)
|
||||
{
|
||||
if(hpcd->Instance==USB_OTG_HS)
|
||||
{
|
||||
/* USER CODE BEGIN USB_OTG_HS_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END USB_OTG_HS_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_USB_OTG_HS_CLK_DISABLE();
|
||||
__HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE();
|
||||
|
||||
/**USB_OTG_HS GPIO Configuration
|
||||
PB5 ------> USB_OTG_HS_ULPI_D7
|
||||
PI11 ------> USB_OTG_HS_ULPI_DIR
|
||||
PH4 ------> USB_OTG_HS_ULPI_NXT
|
||||
PC0 ------> USB_OTG_HS_ULPI_STP
|
||||
PA5 ------> USB_OTG_HS_ULPI_CK
|
||||
PB12 ------> USB_OTG_HS_ULPI_D5
|
||||
PB13 ------> USB_OTG_HS_ULPI_D6
|
||||
PA3 ------> USB_OTG_HS_ULPI_D0
|
||||
PB1 ------> USB_OTG_HS_ULPI_D2
|
||||
PB0 ------> USB_OTG_HS_ULPI_D1
|
||||
PB10 ------> USB_OTG_HS_ULPI_D3
|
||||
PB11 ------> USB_OTG_HS_ULPI_D4
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_5|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_1
|
||||
|GPIO_PIN_0|GPIO_PIN_10|GPIO_PIN_11);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOI, GPIO_PIN_11);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOH, GPIO_PIN_4);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_3);
|
||||
|
||||
/* USB_OTG_HS interrupt DeInit */
|
||||
HAL_NVIC_DisableIRQ(OTG_HS_IRQn);
|
||||
/* USER CODE BEGIN USB_OTG_HS_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END USB_OTG_HS_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
|
||||
extern PCD_HandleTypeDef hpcd_USB_OTG_HS;
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
|
@ -197,6 +197,20 @@ void SysTick_Handler(void)
|
|||
/* please refer to the startup file (startup_stm32h7xx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles USB On The Go HS global interrupt.
|
||||
*/
|
||||
void OTG_HS_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN OTG_HS_IRQn 0 */
|
||||
|
||||
/* USER CODE END OTG_HS_IRQn 0 */
|
||||
HAL_PCD_IRQHandler(&hpcd_USB_OTG_HS);
|
||||
/* USER CODE BEGIN OTG_HS_IRQn 1 */
|
||||
|
||||
/* USER CODE END OTG_HS_IRQn 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
|
|
@ -128,6 +128,14 @@ menu "On-chip Peripheral Drivers"
|
|||
select RT_USING_DFS
|
||||
default n
|
||||
|
||||
config BSP_USING_USBD
|
||||
bool "Enable OTGHS as USB device"
|
||||
select RT_USING_USB_DEVICE
|
||||
select BSP_USBD_TYPE_HS
|
||||
select BSP_USBD_SPEED_HS
|
||||
select BSP_USBD_PHY_ULPI
|
||||
default n
|
||||
|
||||
source "../libraries/HAL_Drivers/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -9,23 +9,10 @@ src += Glob('CubeMX_Config/Src/stm32h7xx_hal_msp.c')
|
|||
|
||||
if GetDepend(['BSP_USING_QSPI_FLASH']):
|
||||
src += Glob('ports/drv_qspi_flash.c')
|
||||
|
||||
|
||||
if GetDepend('BSP_USING_SPI_LCD'):
|
||||
src = src + ['ports/drv_lcd.c']
|
||||
|
||||
if GetDepend(['BSP_USING_SDCARD']):
|
||||
src += Glob('ports/sdcard_port.c')
|
||||
|
||||
if GetDepend(['BSP_USING_ICM20608']) or GetDepend(['BSP_USING_AHT10']):
|
||||
src += Glob('ports/sensor_port.c')
|
||||
|
||||
if GetDepend(['BSP_USING_AUDIO']):
|
||||
src += Glob('ports/audio/drv_es8388.c')
|
||||
src += Glob('ports/audio/drv_sound.c')
|
||||
|
||||
if GetDepend(['BSP_USING_AUDIO_RECORD']):
|
||||
src += Glob('ports/audio/drv_mic.c')
|
||||
|
||||
path = [cwd]
|
||||
path += [cwd + '/CubeMX_Config/Inc']
|
||||
|
||||
|
|
Loading…
Reference in New Issue