单通道PWM输出时(设定低电平时间为600us,设定空闲状态为低电平),在PWM低电平500us时,来了一个刹车信号,发现PWM波形出现了一个短暂的异常脉冲,然后才一直为低。(理论上不应该刹车信号来了之后就会一直变成低电平吗?)这个异常脉冲是什么原因? 程序配置如下: /PWM模式配置/ //配置为PWM模式1 TIM_OCInitStructure.OCMode = TIM_OCMODE_PWM1; TIM_OCInitStructure.Pulse = ChannelPulse;//初始 50% TIM_OCInitStructure.OCPolarity = TIM_OCPOLARITY_LOW; TIM_OCInitStructure.OCIdleState = TIM_OCIDLESTATE_RESET; //初始化通道1输出PWM HAL_TIM_PWM_ConfigChannel(&TIM_TimeBaseStructure,&TIM_OCInitStructure,TIM_CHANNEL_1); / 自动输出使能,断路、死区时间和锁定配置 / TIM_BDTRInitStructure.OffStateRunMode = TIM_OSSR_ENABLE; TIM_BDTRInitStructure.OffStateIDLEMode = TIM_OSSI_ENABLE; TIM_BDTRInitStructure.LockLevel = TIM_LOCKLEVEL_1; TIM_BDTRInitStructure.DeadTime = 11; TIM_BDTRInitStructure.BreakState = TIM_BREAK_ENABLE; TIM_BDTRInitStructure.BreakPolarity = TIM_BREAKPOLARITY_LOW; TIM_BDTRInitStructure.AutomaticOutput = TIM_AUTOMATICOUTPUT_ENABLE; HAL_TIMEx_ConfigBreakDeadTime(&TIM_TimeBaseStructure, &TIM_BDTRInitStructure); / 定时器通道1输出PWM / HAL_TIM_PWM_Start(&TIM_TimeBaseStructure,TIM_CHANNEL_1);
|
|