我用的是PWM模块0输出的通道2 3 4 5,有波形,我已经配置最大12ma,但是它的驱动能力不行,电流太弱,该怎么提高驱动能力?
以下是我的配置代码
/*PWM0 CH2345~PB4 PB5 PE4 PE5 */
void Pwm0_Init(void){
//ʹÄÜ PWMÄ£¿é0 SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);//ʹÄÜ PWMÄ£¿é0 Êä³öÒý½Å SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
//ÅäÖÃPB4 PB5 PE4 PE5 ΪPWMoutģʽ GPIOPinTypePWM(GPIO_PORTB_BASE, GPIO_PIN_4);
GPIOPinTypePWM(GPIO_PORTB_BASE, GPIO_PIN_5);
GPIOPinTypePWM(GPIO_PORTE_BASE, GPIO_PIN_4);
GPIOPinTypePWM(GPIO_PORTE_BASE, GPIO_PIN_5);
GPIOPinConfigure(GPIO_PB4_M0PWM2); GPIOPinConfigure(GPIO_PB5_M0PWM3); GPIOPinConfigure(GPIO_PE4_M0PWM4); GPIOPinConfigure(GPIO_PE5_M0PWM5);
GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_4, GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_OD); GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_5, GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_OD); GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_OD); GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_5, GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_OD); //PWMʱÖÓ ²»·ÖƵ
SysCtlPWMClockSet(SYSCTL_PWMDIV_8); //ÅäÖÃPWM·¢ÉúÆ÷0 ģʽ£º¼Ó¼õ¼ÆÊý ²»Í¬²½
PWMGenConfigure(PWM0_BASE,PWM_GEN_1,PWM_GEN_MODE_UP_DOWN| PWM_GEN_MODE_NO_SYNC);
PWMGenConfigure(PWM0_BASE,PWM_GEN_2,PWM_GEN_MODE_UP_DOWN| PWM_GEN_MODE_NO_SYNC);
//ÅäÖÃPWM·¢ÉúÆ÷0 ƵÂÊ£º40M/8/47.21Hz = 105910
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, 105910);
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, 105910);
//ÉèÖÃPWM·¢ÉúÆ÷0 CH2 CH3µÄÊä³öÂö¿í
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, 1519*LSB);// PWMPulseWidthSet(PWM0_BASE, PWM_OUT_3, 1519*LSB);// //ÉèÖÃPWM·¢ÉúÆ÷0 CH4 CH5µÄÊä³öÂö¿í
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_4, 1017*LSB);// PWMPulseWidthSet(PWM0_BASE, PWM_OUT_5, 1519*LSB);// //ʹÄÜPWM·¢ÉúÆ÷0 Êä³öͨµÀ
PWMOutputState(PWM0_BASE, (PWM_OUT_2_BIT |PWM_OUT_3_BIT), true);
PWMOutputState(PWM0_BASE, (PWM_OUT_4_BIT |PWM_OUT_5_BIT), true);
//ʹÄÜPWM·¢ÉúÆ÷
PWMGenEnable(PWM0_BASE, PWM_GEN_1);
PWMGenEnable(PWM0_BASE, PWM_GEN_2);
}
user151383853:
已经最大了, 下面的办法, 最好还是用硬件手段, 增加一个驱动器吧, 比如 74HC244.
xyz549040622:
12ma已经不小了,要想大电流,得用专门的驱动芯片了吧
Michael Sun:
针对一般的GPIO,我们支持2mA 4mA 8mA。但是同一个GPIO bank最大支持的输入电流一般不大于40mA。详细可参考Datasheet。
从系统设计角度考虑,这种强驱动能力建议采用驱动芯片去做。