特性:实现电机控制与霍尔传感器功能
新增电机板级支持包:基于 AT8236-MS 驱动芯片,实现了对 4 个直流电机的 PWM 控制。 实现霍尔传感器功能:用于速度测量和脉冲计数。 更新 GPIO 初始化:为霍尔传感器添加了外部中断(EXTI)配置。 修改系统时钟配置:改用高速外部时钟(HSE)并调整了锁相环(PLL)设置。 更改定时器配置:将时基生成从 TIM8 改为 TIM4。 增强 FreeRTOS 任务:实现从霍尔传感器周期性读取并更新速度数据。 更新项目配置:以反映外设使用情况和优先级的变更。
This commit is contained in:
@@ -140,12 +140,13 @@ void SystemClock_Config(void)
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
@@ -178,7 +179,7 @@ void SystemClock_Config(void)
|
||||
|
||||
/**
|
||||
* @brief Period elapsed callback in non blocking mode
|
||||
* @note This function is called when TIM8 interrupt took place, inside
|
||||
* @note This function is called when TIM4 interrupt took place, inside
|
||||
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
|
||||
* a global variable "uwTick" used as application time base.
|
||||
* @param htim : TIM handle
|
||||
@@ -189,7 +190,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||
/* USER CODE BEGIN Callback 0 */
|
||||
|
||||
/* USER CODE END Callback 0 */
|
||||
if (htim->Instance == TIM8)
|
||||
if (htim->Instance == TIM4)
|
||||
{
|
||||
HAL_IncTick();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user