Project file structure
BLDC Control Demo User's Guide, Rev. 6, 06/2020
16
NXP Semiconductors
o
main.c
—contains the basic application initialization (enabling interrupts), the subroutines
for accessing the MCU peripherals, and the interrupt service routines.
o
mcdrv.h
—includes the specific
mcdrv_< board&MCU >.h
file into the project.
o
mcdrv_< board&MCU >.c
—contains the motor-control driver peripherals’ initialization
functions specific to the board and MCU used.
o
mcdrv_< board&MCU >.h
—header file for
mcdrv_<board&MCU>.c
. This file contains
the macros for changing the PWM period and ADC channels assigned to the back-EMF
voltages and the board voltage and current.
o
pin_mux.c
—contains the board initialization function to configure the pin routing. This
file is generated by the Pins tool.
o
pin_mux.h
—header file for
pin_mux.c
.
o
board.c
—common MCUXpresso SDK file containing the initialization of a debug
console.
o
board.h
—common MCUXpresso SDK file containing the macros for a specific board
pinout.
o
clock_config.c
—contains the MCU clock configuration functions.
o
clock_config.h
—header file for
clock_config.c
.
o
readme.txt
—basic information about the requirements, settings, and the demo.
The motor-control folder
<KSDK_install_folder>\middleware\motor_control\bldc
contains these
common source and header files used in all motor-control projects. The folder contains the subfolders
common to the entire project in this package:
•
mc_algorithms
—contains the control algorithms used to control the BLDC motor.
•
mc_drivers
—contains the source and header files used to initialize and run motor-control
applications.
•
mc_state_machine
—contains the software routines that are executed when the application is in a
particular state or state transition.
•
state_machine
—contains the state machine functions for the Fault, Initialization, Stop, and Run
states.
Each motor-control project is based on RTCESL (Real-Time Control Embedded Software Library)
placed in the
<KSDK_install_folder>\middleware
folder. The library contains the mathematical
functions used in the project. It contains the library subfolders for specific cores (“
cm0
”, “
cm4
”, and
“
cm7
”). This subfolder includes the required header files and library files used in the project. The
RTCESL
folder is taken from the RTCESL release 4.5, and it is fully compatible with the official
release. The library names are changed for easier use with the available IDEs. See
for more information about RTCESL.