当前位置:网站首页>基于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输出,就可以认为芯片坏了
边栏推荐
- 美国费城发生“安全事故” 2名警察遭枪杀
- Loop invariant
- [learning notes] connectivity and circuit of graph
- Explain Vue's plan to clean up keepalive cache in time
- 动态规划
- LeetCode_ 2 (add two numbers)
- R language uses boxplot function in native package (basic import package, graphics) to visualize box plot
- Disjoint Set
- 注意!软件供应链安全挑战持续升级
- After the microservice project is deployed, static resources and files uploaded to upload cannot be accessed. Solution
猜你喜欢
Penetration testing methodology
APR protocol and defense
【学习笔记】阶段测试1
How to choose the appropriate certificate brand when applying for code signing certificate?
选择排序和冒泡排序
日化用品行业智能供应链协同系统解决方案:数智化SCM供应链,为企业转型“加速度”
Topology visual drawing engine
Qingda KeYue rushes to the science and Innovation Board: the annual revenue is 200million, and it is proposed to raise 750million
FR练习题目---简单题
Thymeleaf th:classappend属性追加 th:styleappend样式追加 th:data-自定义属性
随机推荐
Discussion on memset assignment
【学习笔记】图的连通性与回路
ASP.NET大型外卖订餐系统源码 (PC版+手机版+商户版)
Strong connection component
Structure - C language
分享 20 个稀奇古怪的 JS 表达式,看看你能答对多少
周大福践行「百周年承诺」,真诚服务推动绿色环保
CyCa children's physical etiquette Ningbo training results assessment came to a successful conclusion
Faire un clip vidéo auto - média deux fois, comment clip n'est pas considéré comme une infraction
Show strength. In this way, the mobile phone will not be difficult to move forward
日化用品行业智能供应链协同系统解决方案:数智化SCM供应链,为企业转型“加速度”
APR protocol and defense
R language dplyr package select function, group_ By function, mutate function and cumsum function calculate the cumulative value of the specified numerical variable in the dataframe grouping data and
R language ggplot2 visualization: visual line graph, using legend in theme function The position parameter defines the position of the legend
【学习笔记】阶段测试1
Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 2)
R language ggplot2 visual density map: Visual density map by group and custom configuration geom_ The alpha parameter in the density function sets the image transparency (to prevent multiple density c
Webrtc learning (II)
R Language ggplot2 Visualization: visualize linegraph, using Legend in Theme function. Paramètre de position emplacement de la légende personnalisée
不相交集