前言
STM32微控制器提供了行业标准Arm®Cortex®-M核心运行矢量控制或FOC模式的性能,广泛应用于空调、家用电器、无人机、建筑和工业自动化、医疗和电动自行车应用的高性能驱动器。
STM32 MCSDK(电机控制软件开发工具包)固件(X-CUBE-MCSDK和X-CUBE-MCSDK- ful)包括永磁同步电机(PMSM)固件库(FOC control)和STM32电机控制工作台(用于配置FOC固件库参数)及其图形用户界面(GUI)。STM32电机控制工作台是一款PC软件,它可以减少STM32 PMSM FOC固件配置所需的设计工作和时间。用户通过GUI生成项目文件,并根据应用程序的需要初始化库。所使用的算法的一些变量可以实时监控和更改。
示例详解
- STM32 MCSDK(电机控制软件开发工具包)工具下载
- 进入ST官肉,在浏览器中输入https://www.st.com/, 在弹出的网页搜索框中输入“MCSDK”并点击“Search”
出现两个结果:
第一个不包括全部源代码,可以直接下载,第二个包涵全部源码,需要官方验证用户信息后才能下载。本示例直接下载第一个作为演示。
-
- 下载完后,解压得到exe文件,然后双击EXE文件开始安装!
安装完成后在电脑桌面上生成如上图右边的两个图标: MotorControl Workbench 5.4.0 和Motor Profiler 5.4.0,其中Motor Profiler是用来对电机参数实现快速测试的工具(需配合支持的开发板使用),MotorControl Workbench即是ST电机控制平台,后面我们将重点介绍这个平台的使用,如何用它快速实现对无刷电机的控制,包括有感/无感,6步方波控制,FOC控制等等。
-
- 初识MotorControl Workbench:
MotorControl Workbench需要用到.NET3.5框架,如果电脑上没有安装.NET3.5,需先安装,这里提供一个WIN10环境下安装.NET3.5的方法:
https://blog.csdn.net/zhanglifu3601881/article/details/92800310
安装好.NET3.5后,双击桌面上的MotorControl Workbench图标,打开MotorControl Workbench,界面显示如下:
我们打开示例工程看看:
点击主界面中的图形可以打开对应的设置功能窗口:
下面我们来生成这个示例工程:
保存工程文件:
选择生成产数:
代码生成中…:
生成完成:
打开刚指定的生成文件夹(不要有中文),里面有和工程名相同的STMCX文件和目录:
在工程目录中有如下文件:
进入工程目路的MDK-ARM子目录下,打开程序工程:
工程打开后可以直接编译:
编译完成:
编译成功后便将程序下载到开发板中运行,查看效果。如果有要修改的可以直接在IDE工程中改代码,也可以修改ICO文件(cube工程文件),然后生成代码,当开也可以直接用MotorControl Workbench打开STMCX文件,修改STMCX后重新生成工程。
OK,本期实验完成!下期见!同时如果大家有什么疑问或是有想了解的其它内容,也欢迎大家留言!!最后喜欢这个公众号的同学们记得加关注了,每天都会有技术干货推出!!文中源码资料下载,关注十三公众号:
在公众号里给十三发送 “下载|STM32 电机教程0” :