当前位置:网站首页>基于TI DRV10970驱动直流无刷电机
基于TI DRV10970驱动直流无刷电机
2022-07-05 14:33:00 【不会武功不懂江湖】
前言
之前在实验室接手了一个项目,需要使用TI的DRV10970芯片来驱动直流无刷电机带霍尔反馈,最近这几天把电机调通了,所以写个文章记录一下。
关于直流无刷电机的驱动方式,我也不过多赘述,CSDN上有很多,我只讲基于TI的DRV10970芯片来实现驱动直流无刷电机。
一、TI DRV10970
1.介绍
DRV10970是一款集成式三相BLDC电机驱动器,适用于家用电器、冷却风扇以及其他通用电机控制 应用。该器件内置智能特性,并且拥有小巧外形和简单的引脚分布结构,不仅降低了设计复杂度、节省了电路板空间,而且还降低了系统成本。集成的保护功能提高了系统的稳健性和可靠性。
这就意味着我们不需要去处理霍尔信号,芯片会自动来处理霍尔信号,我们只需要输出PWM和设置一些管脚便可以实现驱动直流无刷电机。
2.引脚介绍
名字 | 描述 |
---|---|
CPN | Charge pump switching node,Connect a 0.1-µF X7R capacitor rated for VM between CPN and CPP |
CPP | Charge pump switching node,Connect a 0.1-µF X7R capacitor rated for VM between CPN and CPP |
VCP | Charge pump output,Connect a 16-V, 1-µF ceramic capacitor to VM |
GND | Device ground,Must be connected to board ground |
VINT | Integrated 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 |
VM | Power supply |
CS | Current limit setting pin |
DAA | Drive angle adjustment configuration pin,Low: 10° drive angle adjustment,High: 5° drive angle adjustment,Floating: adaptive drive angle adjustment |
FG | Frequency indication pin,Open drain Electrical Frequency Output pin. One toggle per electrical cycle. Requires an external pull-up of 3.3-kΩ. |
FR | Motor 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. |
BRKMOD | Brake mode setting,Low: Coasting mode (phases are tri-stated),High: Brake mode (phases are driven low) |
PWM | Variable duty cycle PWM input for speed control |
RD | Lock indication pin |
RETRY | Auto retry timing configure |
CMTMOD | Commutation 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输出,就可以认为芯片坏了
边栏推荐
- How can non-technical departments participate in Devops?
- 【NVMe2.0b 14-9】NVMe SR-IOV
- Penetration testing methodology
- Is the securities account given by the head teacher of qiniu school safe? Can I open an account?
- Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 2)
- R language uses the polR function of mass package to build an ordered multi classification logistic regression model, and uses the coef function to obtain the log odds ratio corresponding to each vari
- Thymeleaf 常用函數
- LeetCode_ 2 (add two numbers)
- Time to calculate cron expression based on cronsequencegenerator
- 启牛学堂班主任给的证券账户安全吗?能开户吗?
猜你喜欢
选择排序和冒泡排序
CYCA少儿形体礼仪 宁波市培训成果考核圆满落幕
分享 20 个稀奇古怪的 JS 表达式,看看你能答对多少
Introduction, installation, introduction and detailed introduction to postman!
SaaS multi tenant solution for FMCG industry to build digital marketing competitiveness of the whole industry chain
Redis如何实现多可用区?
FR练习题目---简单题
区间 - 左闭右开
无密码身份验证如何保障用户隐私安全?
微帧科技荣获全球云计算大会“云鼎奖”!
随机推荐
The forked VM terminated without saying properly goodbye
How does redis implement multiple zones?
How to make a second clip of our media video without infringement
Thymeleaf 常用函數
CyCa children's physical etiquette Ningbo training results assessment came to a successful conclusion
Thymeleaf 模板的创建与使用
be careful! Software supply chain security challenges continue to escalate
R语言使用原生包(基础导入包、graphics)中的boxplot函数可视化箱图(box plot)
Explain Vue's plan to clean up keepalive cache in time
美国费城发生“安全事故” 2名警察遭枪杀
做自媒体视频二次剪辑,怎样剪辑不算侵权
最长公共子序列 - 动态规划
PMP考试20天能通过吗?
How to choose the appropriate certificate brand when applying for code signing certificate?
Strong connection component
PyTorch二分类时BCELoss,CrossEntropyLoss,Sigmoid等的选择和使用
Mysql database installation tutorial under Linux
MySQL user-defined function ID number to age (supports 15 / 18 digit ID card)
[learning notes] connectivity and circuit of graph
[summary of leetcode weekly competition] the 81st fortnight competition of leetcode (6.25)