当前位置:网站首页>基于TI DRV10970驱动直流无刷电机

基于TI DRV10970驱动直流无刷电机

2022-07-05 14:33:00 不会武功不懂江湖

前言

之前在实验室接手了一个项目,需要使用TI的DRV10970芯片来驱动直流无刷电机带霍尔反馈,最近这几天把电机调通了,所以写个文章记录一下。


关于直流无刷电机的驱动方式,我也不过多赘述,CSDN上有很多,我只讲基于TI的DRV10970芯片来实现驱动直流无刷电机。

一、TI DRV10970

1.介绍

DRV10970是一款集成式三相BLDC电机驱动器,适用于家用电器、冷却风扇以及其他通用电机控制 应用。该器件内置智能特性,并且拥有小巧外形和简单的引脚分布结构,不仅降低了设计复杂度、节省了电路板空间,而且还降低了系统成本。集成的保护功能提高了系统的稳健性和可靠性。
这就意味着我们不需要去处理霍尔信号,芯片会自动来处理霍尔信号,我们只需要输出PWM和设置一些管脚便可以实现驱动直流无刷电机。
在这里插入图片描述
在这里插入图片描述

2.引脚介绍

名字描述
CPNCharge pump switching node,Connect a 0.1-µF X7R capacitor rated for VM between CPN and CPP
CPPCharge pump switching node,Connect a 0.1-µF X7R capacitor rated for VM between CPN and CPP
VCPCharge pump output,Connect a 16-V, 1-µF ceramic capacitor to VM
GNDDevice ground,Must be connected to board ground
VINTIntegrated regulator output,Integrated regulator (typical voltage 5 V) mainly for internal circuits; Provide external power for less than 20 mA. Bypass to GND with a 10-V, 2.2-µF ceramic capacitor
VMPower supply
CSCurrent limit setting pin
DAADrive angle adjustment configuration pin,Low: 10° drive angle adjustment,High: 5° drive angle adjustment,Floating: adaptive drive angle adjustment
FGFrequency indication pin,Open drain Electrical Frequency Output pin. One toggle per electrical cycle. Requires an external pull-up of 3.3-kΩ.
FRMotor direction control,Direction Control Input.When low, phase driving sequence is U → V → W ( U phase is leading V phase by 120°).When high, the phase driving sequence is U → W → V.
BRKMODBrake mode setting,Low: Coasting mode (phases are tri-stated),High: Brake mode (phases are driven low)
PWMVariable duty cycle PWM input for speed control
RDLock indication pin
RETRYAuto retry timing configure
CMTMODCommutation mode setting,Low: Sinusoidal operation mode with 0° Hall placement,High: Sinusoidal operation mode with 30° Hall placement,Floating: Trapezoidal operation mode with 30° Hall placement

在这里插入图片描述
上面这么多引脚中我们只需要特别关注几个就好,其中包含脉宽调制 (PWM) 输入(速度命令)、FG 输出(速度反馈)、FR 输入(正向和反向控制)以及 RD 输出(电机锁定指示)。
FG和RD是DRV10970反馈给MCU的信号
CMTMOD是设置模式,一般将CMTMOD设置为低电平就是正弦模式0°放置霍尔元件,
BRKMOD是刹车模式设置,将BRKMOD引脚设置为低电平,即使把BRKMOD设置为高电平电机也不会刹车,因为这个管脚是设置刹车模式,而不是直接让电机刹车,只有断电或者将PWM设置为0才可以刹车。
DAA是驱动电机角度设置,设置为浮空即可,浮空就是自适应角度来驱动电机
PWM就是连接MCU的PWM输出管脚,PWM的频率为15Khz-100Khz。

二、使用步骤

1.程序

所以在使用DRV10970时,我们需要将PWM,FR,BM,CM,DAA设置好即可,我这里使用了两个芯片驱动两个电机

void PWM_Configuration(u16 arr,u16 pre)
{
    
	GPIO_InitTypeDef GPIO_InitStructure;
	TIM_TimeBaseInitTypeDef	TIM_TimeBaseStructure;
	TIM_OCInitTypeDef TIM_OCInitStructure;
// TIM_BDTRInitTypeDef TIM_BDTRInitStructure;
	
	RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC |RCC_AHB1Periph_GPIOD, ENABLE);
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM12, ENABLE);
	
	GPIO_PinAFConfig(GPIOB,GPIO_PinSource14,GPIO_AF_TIM12); //PB14 复用 TIM12
	GPIO_PinAFConfig(GPIOB,GPIO_PinSource15,GPIO_AF_TIM12); //PB14 复用 TIM12
	
	// PWM
	GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_14 | GPIO_Pin_15;		 //
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //复用推挽输出
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
	GPIO_Init(GPIOB,&GPIO_InitStructure); //初始化 PB14

	//M1
	//GPIO DAA 悬空 M2 PD14--DAA
	GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_8 | GPIO_Pin_14 ;	
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;//普通输入模式
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;//浮空
	GPIO_Init(GPIOD, &GPIO_InitStructure);//初始化GPIOD
	
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 ;	 //GPIO_Pin_11 
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
	GPIO_Init(GPIOB, &GPIO_InitStructure);//初始化GPIOD
	
			//GPIO M1--PD12--CM
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_15 ;	 //M2 PD15--FR
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
	GPIO_Init(GPIOD, &GPIO_InitStructure);//初始化GPIOD
	
				//GPIO M2--PA12--CM M2-PA11-BM
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 ;	 
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
	GPIO_Init(GPIOA, &GPIO_InitStructure);//初始化GPIOD
	
	//GPIO //FG and RD all feedback
	GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_9|  GPIO_Pin_13;	//输入
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;//普通输入模式
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//
	GPIO_Init(GPIOD, &GPIO_InitStructure);//初始化GPIOD
	
		//GPIO // M2--PC8--RD M2--FG--PC14
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_14;	//输入
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;//普通输入模式
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//
	GPIO_Init(GPIOC, &GPIO_InitStructure);//初始化GPIOD
	
	//GPIO // CMTMOD--PD10 
	GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_10|GPIO_Pin_11;	//输入
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输入模式
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;//
	GPIO_Init(GPIOD, &GPIO_InitStructure);//初始化GPIOD
	
		
	TIM_TimeBaseStructure.TIM_Period= arr-1;				
	TIM_TimeBaseStructure.TIM_Prescaler= pre-1;			
	TIM_TimeBaseStructure.TIM_CounterMode=TIM_CounterMode_Up;
	TIM_TimeBaseStructure.TIM_ClockDivision=TIM_CKD_DIV1;		
	TIM_TimeBaseInit(TIM12,&TIM_TimeBaseStructure);	 //TIM12
	 
	TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;				
	TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;	
	TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;		

// TIM_DeInit(TIM12);
						
	TIM_OC1Init(TIM12, &TIM_OCInitStructure);//初始化外设TIM1 OC1--OC4
	TIM_OC2Init(TIM12, &TIM_OCInitStructure);
	TIM_OC3Init(TIM12, &TIM_OCInitStructure);
	TIM_OC4Init(TIM12, &TIM_OCInitStructure);

	TIM_OC1PreloadConfig(TIM12, TIM_OCPreload_Enable);//使能预装载寄存器
	TIM_OC2PreloadConfig(TIM12, TIM_OCPreload_Enable);
  TIM_OC3PreloadConfig(TIM12, TIM_OCPreload_Enable);
	TIM_OC4PreloadConfig(TIM12, TIM_OCPreload_Enable);

	TIM_ARRPreloadConfig(TIM12,ENABLE);			

	TIM_Cmd(TIM12, ENABLE);	
	
	//M1
	// PD12--CM
	GPIO_ResetBits(GPIOD, GPIO_Pin_10 );//PD10---FR PD11---BM
	
	GPIO_SetBits(GPIOD, GPIO_Pin_12 );// PD12--CM
	
	//M2
	GPIO_ResetBits(GPIOA, GPIO_Pin_11 );// PA11--BM
	GPIO_SetBits(GPIOA, GPIO_Pin_12 );// PD12--CM

}

三.如何判断芯片时候损坏

当VM供12V电时,如果VINT没有5V输出,就可以认为芯片坏了

原网站

版权声明
本文为[不会武功不懂江湖]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_43903002/article/details/125607148

随机推荐