finished new 5V buck, layout
This commit is contained in:
@@ -57,7 +57,9 @@
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
/**
|
||||
|
||||
void HAL_HRTIM_MspPostInit(HRTIM_HandleTypeDef *hhrtim);
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void)
|
||||
@@ -89,6 +91,231 @@ void HAL_MspInit(void)
|
||||
/* USER CODE END MspInit 1 */
|
||||
}
|
||||
|
||||
static uint32_t HAL_RCC_ADC345_CLK_ENABLED=0;
|
||||
|
||||
/**
|
||||
* @brief ADC MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hadc: ADC handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||
if(hadc->Instance==ADC3)
|
||||
{
|
||||
/* USER CODE BEGIN ADC3_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC3_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clocks
|
||||
*/
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC345;
|
||||
PeriphClkInit.Adc345ClockSelection = RCC_ADC345CLKSOURCE_SYSCLK;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
HAL_RCC_ADC345_CLK_ENABLED++;
|
||||
if(HAL_RCC_ADC345_CLK_ENABLED==1){
|
||||
__HAL_RCC_ADC345_CLK_ENABLE();
|
||||
}
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**ADC3 GPIO Configuration
|
||||
PB13 ------> ADC3_IN5
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN ADC3_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC3_MspInit 1 */
|
||||
}
|
||||
else if(hadc->Instance==ADC4)
|
||||
{
|
||||
/* USER CODE BEGIN ADC4_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC4_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clocks
|
||||
*/
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC345;
|
||||
PeriphClkInit.Adc345ClockSelection = RCC_ADC345CLKSOURCE_SYSCLK;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
HAL_RCC_ADC345_CLK_ENABLED++;
|
||||
if(HAL_RCC_ADC345_CLK_ENABLED==1){
|
||||
__HAL_RCC_ADC345_CLK_ENABLE();
|
||||
}
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**ADC4 GPIO Configuration
|
||||
PB14 ------> ADC4_IN4
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_14;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN ADC4_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC4_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ADC MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hadc: ADC handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
|
||||
{
|
||||
if(hadc->Instance==ADC3)
|
||||
{
|
||||
/* USER CODE BEGIN ADC3_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ADC3_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
HAL_RCC_ADC345_CLK_ENABLED--;
|
||||
if(HAL_RCC_ADC345_CLK_ENABLED==0){
|
||||
__HAL_RCC_ADC345_CLK_DISABLE();
|
||||
}
|
||||
|
||||
/**ADC3 GPIO Configuration
|
||||
PB13 ------> ADC3_IN5
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13);
|
||||
|
||||
/* USER CODE BEGIN ADC3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC3_MspDeInit 1 */
|
||||
}
|
||||
else if(hadc->Instance==ADC4)
|
||||
{
|
||||
/* USER CODE BEGIN ADC4_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ADC4_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
HAL_RCC_ADC345_CLK_ENABLED--;
|
||||
if(HAL_RCC_ADC345_CLK_ENABLED==0){
|
||||
__HAL_RCC_ADC345_CLK_DISABLE();
|
||||
}
|
||||
|
||||
/**ADC4 GPIO Configuration
|
||||
PB14 ------> ADC4_IN4
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_14);
|
||||
|
||||
/* USER CODE BEGIN ADC4_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC4_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief COMP MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hcomp: COMP handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_COMP_MspInit(COMP_HandleTypeDef* hcomp)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hcomp->Instance==COMP5)
|
||||
{
|
||||
/* USER CODE BEGIN COMP5_MspInit 0 */
|
||||
|
||||
/* USER CODE END COMP5_MspInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**COMP5 GPIO Configuration
|
||||
PB13 ------> COMP5_INP
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN COMP5_MspInit 1 */
|
||||
|
||||
/* USER CODE END COMP5_MspInit 1 */
|
||||
}
|
||||
else if(hcomp->Instance==COMP7)
|
||||
{
|
||||
/* USER CODE BEGIN COMP7_MspInit 0 */
|
||||
|
||||
/* USER CODE END COMP7_MspInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**COMP7 GPIO Configuration
|
||||
PB14 ------> COMP7_INP
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_14;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN COMP7_MspInit 1 */
|
||||
|
||||
/* USER CODE END COMP7_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief COMP MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hcomp: COMP handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_COMP_MspDeInit(COMP_HandleTypeDef* hcomp)
|
||||
{
|
||||
if(hcomp->Instance==COMP5)
|
||||
{
|
||||
/* USER CODE BEGIN COMP5_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END COMP5_MspDeInit 0 */
|
||||
|
||||
/**COMP5 GPIO Configuration
|
||||
PB13 ------> COMP5_INP
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13);
|
||||
|
||||
/* USER CODE BEGIN COMP5_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END COMP5_MspDeInit 1 */
|
||||
}
|
||||
else if(hcomp->Instance==COMP7)
|
||||
{
|
||||
/* USER CODE BEGIN COMP7_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END COMP7_MspDeInit 0 */
|
||||
|
||||
/**COMP7 GPIO Configuration
|
||||
PB14 ------> COMP7_INP
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_14);
|
||||
|
||||
/* USER CODE BEGIN COMP7_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END COMP7_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CORDIC MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
@@ -134,6 +361,72 @@ void HAL_CORDIC_MspDeInit(CORDIC_HandleTypeDef* hcordic)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DAC MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hdac: DAC handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac)
|
||||
{
|
||||
if(hdac->Instance==DAC1)
|
||||
{
|
||||
/* USER CODE BEGIN DAC1_MspInit 0 */
|
||||
|
||||
/* USER CODE END DAC1_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_DAC1_CLK_ENABLE();
|
||||
/* USER CODE BEGIN DAC1_MspInit 1 */
|
||||
|
||||
/* USER CODE END DAC1_MspInit 1 */
|
||||
}
|
||||
else if(hdac->Instance==DAC4)
|
||||
{
|
||||
/* USER CODE BEGIN DAC4_MspInit 0 */
|
||||
|
||||
/* USER CODE END DAC4_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_DAC4_CLK_ENABLE();
|
||||
/* USER CODE BEGIN DAC4_MspInit 1 */
|
||||
|
||||
/* USER CODE END DAC4_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DAC MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hdac: DAC handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac)
|
||||
{
|
||||
if(hdac->Instance==DAC1)
|
||||
{
|
||||
/* USER CODE BEGIN DAC1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END DAC1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_DAC1_CLK_DISABLE();
|
||||
/* USER CODE BEGIN DAC1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END DAC1_MspDeInit 1 */
|
||||
}
|
||||
else if(hdac->Instance==DAC4)
|
||||
{
|
||||
/* USER CODE BEGIN DAC4_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END DAC4_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_DAC4_CLK_DISABLE();
|
||||
/* USER CODE BEGIN DAC4_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END DAC4_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FMAC MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
@@ -179,6 +472,80 @@ void HAL_FMAC_MspDeInit(FMAC_HandleTypeDef* hfmac)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HRTIM MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hhrtim: HRTIM handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_HRTIM_MspInit(HRTIM_HandleTypeDef* hhrtim)
|
||||
{
|
||||
if(hhrtim->Instance==HRTIM1)
|
||||
{
|
||||
/* USER CODE BEGIN HRTIM1_MspInit 0 */
|
||||
|
||||
/* USER CODE END HRTIM1_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_HRTIM1_CLK_ENABLE();
|
||||
/* USER CODE BEGIN HRTIM1_MspInit 1 */
|
||||
|
||||
/* USER CODE END HRTIM1_MspInit 1 */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HAL_HRTIM_MspPostInit(HRTIM_HandleTypeDef* hhrtim)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hhrtim->Instance==HRTIM1)
|
||||
{
|
||||
/* USER CODE BEGIN HRTIM1_MspPostInit 0 */
|
||||
|
||||
/* USER CODE END HRTIM1_MspPostInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**HRTIM1 GPIO Configuration
|
||||
PA8 ------> HRTIM1_CHA1
|
||||
PA9 ------> HRTIM1_CHA2
|
||||
PA10 ------> HRTIM1_CHB1
|
||||
PA11 ------> HRTIM1_CHB2
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF13_HRTIM1;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN HRTIM1_MspPostInit 1 */
|
||||
|
||||
/* USER CODE END HRTIM1_MspPostInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief HRTIM MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hhrtim: HRTIM handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_HRTIM_MspDeInit(HRTIM_HandleTypeDef* hhrtim)
|
||||
{
|
||||
if(hhrtim->Instance==HRTIM1)
|
||||
{
|
||||
/* USER CODE BEGIN HRTIM1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END HRTIM1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_HRTIM1_CLK_DISABLE();
|
||||
/* USER CODE BEGIN HRTIM1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END HRTIM1_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM_Base MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
@@ -224,6 +591,83 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UART MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param huart: UART handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||
if(huart->Instance==USART1)
|
||||
{
|
||||
/* USER CODE BEGIN USART1_MspInit 0 */
|
||||
|
||||
/* USER CODE END USART1_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clocks
|
||||
*/
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1;
|
||||
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USART1_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**USART1 GPIO Configuration
|
||||
PB6 ------> USART1_TX
|
||||
PB7 ------> USART1_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN USART1_MspInit 1 */
|
||||
|
||||
/* USER CODE END USART1_MspInit 1 */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UART MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param huart: UART handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||
{
|
||||
if(huart->Instance==USART1)
|
||||
{
|
||||
/* USER CODE BEGIN USART1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END USART1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_USART1_CLK_DISABLE();
|
||||
|
||||
/**USART1 GPIO Configuration
|
||||
PB6 ------> USART1_TX
|
||||
PB7 ------> USART1_RX
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7);
|
||||
|
||||
/* USER CODE BEGIN USART1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END USART1_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
Reference in New Issue
Block a user