使用ST的Motor Control Workbench6.2.0生成代码,并让电机跑起来

这个Motor Control Workbench(MCSDK)其实是很适合小白做开发的,一套流程配置下来就可以简单的先把电机跑起来,它里面提供的Pilot控制面板还有不同的控制以供选择,位置控制、速度控制、转矩控制。让电机控制变得没有那么高冷!新版本的MCSDK比5.Y的版本界面美观一些。

准备

用到的软件如下:

  1. Motor Control Workbench 6.2.0
  2. STM32CubeMX 6.9.2
  3. Keil5 (IAR EWARM 或者 STM32CubeIDE)
  4. STM32 FirmwarePackage V1.5.1

st的这几个软件都可以在官网上直接下载,具体安装教程应搜一搜就有了。

X-CUBE-MCSDK - STM32 Motor Control Software Development Kit (MCSDK) - STMicroelectronics

用到的硬件如下:

  1. EVSPIN32G4
  2. 电机
  3. 电源

MCSDK建立工程

接下来开始建立工程!

1. 新建一个MCSDK的Project。

填入我们项目的名称然后填入电机和驱动的信息

电机搜索不到符合自己电机型号的没关系,随便选一个,一会儿可以自定义

我这里用的是SPIN32G4,就直接选好了。如果驱动板是自己做的,需要自定义驱动器的要先用JSON格式去自定义,这个可以搜一下教程(使用MCSDK 6.x.0 自定义驱控板_cube mcsdk6-CSDN博客

全部选好以后就进入到这个控制框图界面,这里就可以对电机、编码器参数进行配置,按照实际情况填写就好,st有个sensorless模式,没有编码器就可以选这个

全部信息填写完成以后就可以电机左上角的Generate the project进行代码生成。这里编译器是可选的,怎么方便怎么来吧。选好就按右下角的生成键

生成成功就会有一个以项目名称命名的文件出现,双击文件就有以下内容,

KEIL5代码的编译和烧录

打开MDK-ARM,接下来就是编译和烧录的工作了

(Keil5也要下载和MCU对应的固件包,如果没下就按照提示去官网下载,我这里是下好了

烧录之前要设置软件包,否则会出现问题,具体怎么做可以参考下面这个链接

(已解决)Error: Flash Download failed - “Cortex-M4“-CSDN博客

Motor Pilot让电机转起来

成功烧录到板子以后,点Run,就可以使用Motor Pilot这个可视化控制界面让电机跑起来了。

使用Motor Pilot 之前记得先改好COM口和波特率,波特率去代码里面搜baut rate就能找到。

这里就是速度环成功跑起来了,面板能看到实时的速度、电流、角度等信息

OVER!

This manual describes the X-CUBE-MCSDK and X-CUBE-MCSDK-FUL STM32 motor control software development kits (SDKs) designed for, and to be used with, STM32 microcontrollers. The SDKs contain a software library that implements the field oriented control (FOC) drive of 3-phase permanent magnet synchronous motors (PMSMs), both surface mounted (SMPMSM) and interior (I-PMSM). The STM32 family of 32-bit Flash microcontrollers is specifically developed for embedded applications. It is based on the following ARM® Cortex®-M cores: the Cortex®-M0 for the STM32F0, the Cortex®-M3 for the STM32F1 and STM32F2, and the Cortex®-M4 for the STM32F3, STM32F4 and STM32L4, and the Cortex®-M7 for the STM32F7. These microcontrollers combine high performance with first-class peripherals that make them suitable for performing three-phase motor FOC. The PMSM FOC library can be used to quickly evaluate ST microcontrollers, to complete ST application platforms, and to save time when developing motor control algorithms to be run on ST microcontrollers. It is written in the C language, and implements the core motor control algorithms, as well as sensor reading/decoding algorithms and sensor-less algorithms for rotor position reconstruction. This library can be easily configured to make use of the STM32F30x's embedded advanced analog peripherals (fast comparators and programmable gain amplifiers (PGAs)) for current sensing and protection, thus simplifying application boards. When deployed with the STM32F103 (Flash memory from 256 Kbytes to 1Mbyte), STM32F303 or STM32F4 devices, the library allows two motors to be driven simultaneously. The library can be customized to suit user application parameters (motor, sensors, power stage, control stage, pin-out assignment) and provides a ready-to-use application programming interface (API). A PC graphical user interface (GUI), the ST motor control workbench, allows complete and easy customization of the PMSM FOC library. Thanks to this, the user can run a PMSM motor in a very short time. A set of ready-to-use examples is provided to explain the use of the motor control API and its most commonly used features. These projects usually provide a UART interface that allows convenient real-time fine-tuning of the motor control subsystem with a remote control tool, the STM32 motor control monitor. The STM32 motor control SDK is delivered as an expansion pack for the STM32 CubeMX tool, and the PMSM FOC library is based on the STM32 Cube Firmware libraries. The list of supported STM32 microcontrollers is provided in the release note delivered with the SDK.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值