
2
Getting started
This firmware example is based on the MCSDK implementing high performance PMSM FOC control with
positioning features. The application firmware interfaces with the middleware via the specific API (MC_API).
The MODBUS RTU communication is based on the FreeModbus library and the application firmware interfaces
with the middleware via the specific API (MB_API).
Peripheral management is performed by the STM32Cube low level divers (LL) and Hardware Abstraction Layer
(HAL) based on the standard CMSIS library.
Figure 2.
Firmware architecture
2.1
Folders structure
This section provides an overview of the package contents:
•
MotorControl Workbench project
•
Binary
folder containing the compiled binary file
•
EVALKIT_ROBOT_1_SDK543_Positioning_LL
folder containing the source code, the CobeMX project file
and the toolchains’ projects
The source code sub-folder structure is the following:
•
Drivers
: STM32 HAL and LL libraries and CMSIS drivers
•
MCSDK_v5.4.3
: Motor control Field Oriented Control middleware
•
modbus
: MODBUS communication middleware
•
Inc
: Application include files
•
Src
: Application source files
•
EWARM
: IAR Embedded Workbench V8 project
•
MDK-ARM
: Keil-ARM uVision V5 project
2.2
Main application code
The main application consists of the following sections:
1.
Initialization
: Peripherals are configured and data structures are initialized
2.
Encoder alignment
: Mechanical alignment procedure is executed
3.
Main loop
: Infinite loop monitoring command request, execution and faults
4.
Motor control loop (interrupt based)
: executes the PMSM FOC algorithm (part of MCSDK)
5.
MODBUS loop (interrupt based)
: manages the MODBUS RTU communication
UM2711
Getting started
UM2711
-
Rev 1
page 3/18