(STM32中断,及FreeRTOS中断优先级配置:https://blog.csdn.net/ybhuangfugui/article/details/99827056)
1、STM32中断优先级数值越小,优先级越大
2、FreeRTOS任务优先级是数值越大,优先级越高
Slave Mode选择Tigger Mode,Trigger Source选择ITR2。即TIM3(Encoder)内部触发启动
TIM1计数器
Channel4选择PWM Genneration No Output模式。此通道生成PWM,上升沿触发ADC注入通
道采样。
中心 对齐模式:
当选择中心对齐计数模式1时,只在向下计数过程中发生匹配动作时才置位比较事件标志CC4IF;
当选择中心对齐计数模式2时,只在向上计数过程中发生匹配动作时才置位比较事件标志CC4IF;
当选择中心对齐计数模式3时,在向上/向下计数过程中发生匹配动作时都会置位比较事件标志CC4IF。当然,比较事件标志被置位时可以触发中断或DMA请求
(原文链接:https://blog.csdn.net/weixin_38106263/article/details/108787090)
(第32章 TIM—高级定时器—零死角玩转STM32-F429系列:https://www.cnblogs.com/firege/p/5805894.html)
Repetition Counter(重复计数):
RepetitionCounter=1时,表示延长一倍的时间。
(STM32 定时器中TIM_RepetitionCounter 作用详解:https://blog.csdn.net/longgyue/article/details/80161380)
Counter Period :(斩波频率10KHz)
TIM1CLK / (PwmFreq * 2) = 168 * 10^6 / (10 * 10^3 * 2) = 8400
Dead Time :
0x94=10010100
【7:5】=100 【5:0】=10100=0x14=20
DTG[7:5]=100 => DT=(64+DTG[5:0]) * Tdtg = (64+20) * 2 / (168 * 10^6) = 1us
// 启动TIM1 PWM各通道
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_3);
// 启动触发ADC采样PWM
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_4);
// 启动TIM1定时器溢出中断
HAL_TIM_Base_Start_IT(&htim1);
// 启动TIM3编码器中断
HAL_TIM_Encoder_Start_IT(&htim3, TIM_CHANNEL_ALL);
(STM32 编码器模式详解:https://blog.csdn.net/xuzhexing/article/details/107152512)
(【MM32】定时器:霍尔传感器接口与六步算法https://blog.csdn.net/chendu103/article/details/107689028
BLDC开发笔记3.霍尔接口与触发换相:
https://www.cnblogs.com/ckk-blog/p/13837457.html)
// 启动TIM4霍尔传感器中断
HAL_TIMEx_HallSensor_Start_IT(&htim4);
采样时间:1/(84/4)3=0.143us
ADC转换总时间:1/(84/4)(3+15)=0.857us
开启DMA:
采样触发方式:TIM1 CC4上升沿
ADC转换时间:1/(84/4)*(3+15)=0.857us
// 启动ADC1注入通道采样中断
HAL_ADCEx_InjectedStart_IT(&hadc1);
// 启动CAN1
HAL_CAN_Start(&hcan1);
// 使能CAN1 FIFO0接收中断
HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING);
定时中断周期Period = (13999+1) / (84 * 10^6 / (5+1)) = 1ms
// 启动定时器TIM5中断
HAL_TIM_Base_Start_IT(&htim5);
(CANopen STM32移植:https://blog.csdn.net/qq_27620407/article/details/109021175)
(STM32无系统移植CanFestival小白教程:https://blog.csdn.net/weixin_43072093/article/details/115245443)
(CANOpen协议详解(一):CANfestival源码分析:https://blog.csdn.net/u012846795/article/details/121008265)
(CANOpen协议详解(二):协议具体内容:https://lixiaoyao.blog.csdn.net/article/details/121008306)
(【FreeRTOS】STM32CubeMX配置STM32FreeRTOS(一):https://blog.csdn.net/weixin_41865104/article/details/107399420)