比如配置PWM输出,设置20KHz,把引脚配置到VERY HIGH,在示波器开高带宽的情况下,会看到引脚过充,这个调节补偿电容没用。
不同硬件设计,过充大小略有区别
实际应用中推荐设置匹配的速度等级,可以有效降低干扰
[C] 纯文本查看 复制代码 /*
*********************************************************************************************************
* 函 数 名: bsp_ConfigTimGpio
* 功能说明: 配置GPIO和TIM时钟, GPIO连接到TIM输出通道
* 形 参: GPIOx : GPIOA - GPIOK
* GPIO_PinX : GPIO_PIN_0 - GPIO__PIN_15
* TIMx : TIM1 - TIM17
* 返 回 值: 无
*********************************************************************************************************
*/
void bsp_ConfigTimGpio(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinX, TIM_TypeDef* TIMx)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* 使能GPIO时钟 */
bsp_RCC_GPIO_Enable(GPIOx);
/* 使能TIM时钟 */
bsp_RCC_TIM_Enable(TIMx);
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = bsp_GetAFofTIM(TIMx);
GPIO_InitStruct.Pin = GPIO_PinX;
HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
}
修改成LOW后,
|