4.1.1 NXP has provided a demo project for PMSM control. With a counter increment, the speed of motor change from 1000rpm, 2000rmp to 4000rpm, then to -1000rpm, -2000rpm, -4000rpm.
The Freemaster embedded in this project can show this clearly in Graphic Interface.
According to Reference manual , the control procedure is as follows,
4.1.2 Analysis of the demo project
The structure tree of the project is as follows,
The entry program is main.c, which trigger NVIC for ADC conversion and Switch Button control for DemoAPP start or stop. The freemaster library embedded in this project can polling the data sequence and communicated with computer via OpenSDA port in UART channel.
void FMSTR_Poll() shall define the whole process. In this project, Interruption is used for Freemaster. While the demo project in KMS 1.0.0 use NXP property FreeRTOS MQX for teal-time supervision. Maybe that is why I can not use KMS in my computer, since the SDK environment is not properly installed and I still could not figure out why.
4.1.3 Therefore, my pilot project is based on this demo project. The main change for the design shall be with main.c and app_init.c.
In app_init.c, I shall define the ports used for sensor data collection.
In main.c, I shall complete the IRQ triggered sensing and controlling for the motor.