Prototyping Automotive Motor Control with NXP
Prototyping Brushless DC Motor Control with the S32M276SFFRD Development Kit
Image Source: mbparks/greenshoegarage.com
By Michael Parks, PE, for Mouser Electronics
Published April 16, 2025
A brushless direct current (BLDC) motor is an electric motor that operates using DC power but without brushes like a traditional brushed motor. Instead, these motors rely on an electronic controller to switch the current in the motor windings. This reduces wear and tear, making the motors more durable and efficient. The absence of brushes means less friction and, thus, less energy lost as heat. This higher efficiency plus an efficient power-to-weight ratio, low maintenance, high speed, high torque, and quiet operation make BLDC motors especially useful in applications such as aerial drones, fans, pumps, and electric vehicles (EVs).
However, BLDC motors require additional components, such as an electronic controller (e.g., microcontroller) and a feedback mechanism (e.g., Hall effect sensor). To simplify BLDC and permanent magnet synchronous motor (PMSM) design, NXP Semiconductors released the S32M276S system-in-package (SiP) solution, which integrates high-voltage analog functionalities and a high-performance Arm® Cortex®-M7 microcontroller. For support, NXP offers S32M2 BLDC/PMSM motor control evaluation boards and the S32M276SFFRD reference design board.
This project will help engineers understand the hardware and the software stack needed to quickly and efficiently prototype a BLDC motor control application using the NXP S32M276SFFRD reference design board.
Project Materials and Resources
Project Bill of Materials (BOM)
Project Code/Software
- S32 Design Studio for S32 Platform v.3.5 (login required)
- S32M2xx Development Package (available in S32 Design Studio)
- RTD for S32K3 and S32M27x version 4.0.0
- RTD for S32K3 and S32M27x version 4.0.0 patch P20
- Project GitHub repository
Additional Resources
- NXP account (free to create)
- FreeMASTER Run-Time Debugging Tool (login required)
- AMMCLib for S32M27X (login required)
- S32M276 motor control application (login required)
Additional Hardware
- Windows PC (Windows 10 or later)
- 12V–24V BLDC motor
- 12V DC power supply
- Momentary (on)-off-(on) rocker switch
- Five 6.3mm FASTON connectors (three for the motor, two for the power supply)
- FTDI TTL-232R-3V3-WE TTL-to-USB serial converter cable
- Wire stripper
- Wire crimper
- Hookup wire
- USB-to-UART switch adapter board (optional, design files in GitHub repository)
Project Technology Overview
The NXP S32M276SFFRD reference design board (Figure 1) is based on NXP’s S32M276 SiP, which combines a 32-bit Arm Cortex-M7 microcontroller and an analog die with a voltage regulator, gate driver, and current sensing. The reference design aims to demonstrate to motor control application engineers how the S32M276 can help reduce printed circuit board (PCB) and BOM size. To aid in prototyping potential solutions, the S32M276SFFRD provides breakouts for interfaces such as UART, CAN/CAN FD (using internal PHY), and a JTAG 10-pin connector.

Figure 1: The NXP S32M276SFFRD reference design board. (Source: Mouser Electronics)
Hardware Overview
This section describes how to connect the various hardware components for this project.
Connecting the Motor to the Development Board
- Crimp a 6.3mm FASTON connector onto phase A of the BLDC motor.
- Crimp a 6.3mm FASTON connector onto phase B of the BLDC motor.
- Crimp a 6.3mm FASTON connector onto phase C of the BLDC motor.
- Crimp a 6.3mm FASTON connector onto the positive wire of the DC power supply.
- Crimp a 6.3mm FASTON connector onto the negative wire of the DC power supply.
- Connect the motor’s phase A to the development board’s phase A connector.
- Connect the motor’s phase B to the development board’s phase B connector.
- Connect the motor’s phase C to the development board’s phase C connector.
- Connect the power supply’s positive terminal to the development board’s power connector.
- Connect the power supply’s negative terminal to the development board’s ground connector.
Note: Operating the motor with a load for a prolonged period can cause excessive heating. Ensure that an appropriate load is connected to the motor or that the motor is only running for very short periods of time.
Connecting the Switch to the Development Board
- Connect the development board’s VDDE-MCU pin (Figure 2) to the switch’s common terminal.
- Connect the development board’s PTD0 pin to the switch’s raise-up terminal.
- Connect the development board’s PTE11 pin to the switch’s lower-down terminal.

Figure 2: Connecting the switch to the board. (Source: Green Shoe Garage)
Connecting the Computer to the Development Board
- Plug a JTAG 10-pin connector cable into the development board.
- Plug the other end of the JTAG 10-pin connector cable into the S32 debug probe.
- Plug the USB-to-UART switch adapter board (Figure 3) into the development board.
- Connect the adapter board’s TX signal (LPUART0_TX) to the TTL-232R-3V3-WE yellow RX wire.
- Connect the adapter board’s RX signal (LPUART0_RX) to the TTL-232R-3V3-WE orange TX
- Connect the adapter board’s GND signal to the TTL-232R-3V3-WE black GND wire.
- Plug the USB Type A end of the TTL-232R-3V3-WE into the PC.
Note: The GitHub repository includes Gerber files for the USB-to-UART adapter board, which can make connecting an external device (e.g., switch) to the S32M276SFFRD development board much more convenient.

Figure 3: An adapter board makes interfacing with external components more reliable. (Source: Green Shoe Garage)
Software Overview
This section describes the various development applications that will be used to update, test, and operate this project. This article will not repeat the NXP documentation, but consider the following when setting up the development environment on the computer:
- When downloading and installing the software, use the specified version (not the latest version) and follow the installation order. Incorrectly installing the software may result in failed code compilation, software launch failure, or incomplete menus.
- Do not attempt to simultaneously run the integrated development environment (IDE) debugger and the test applications (e.g., MCAT) because they require the same COM port.
S32 Design Studio
NXP S32 Design Studio (S32DS) is an IDE tailored for automotive and industrial applications. It supports the development of software for NXP’s S32 family of automotive microcontrollers and microprocessors, which are widely used in advanced automotive systems like advanced driver-assistance systems (ADAS), powertrain, and body control. It is built on the widely adopted Eclipse platform, offering developers a familiar interface.
S32DS delivers a comprehensive toolchain with GCC-based compilers, debuggers, and support for the S32 Real Time Drivers (RTD). It provides drivers, RTOS, middleware, and hardware abstraction and supports AUTOSAR-compliant tools and libraries for automotive software.
FreeMASTER
FreeMASTER is a versatile real-time debug monitor and data visualization tool used for configuring and tuning embedded software applications. It has been widely adopted by automotive OEMs and appliance manufacturers for various automotive and industrial applications with key features such as:
- Non-intrusive monitoring: Displays multiple variables in real time using oscilloscope-like displays, gauges, sliders, and text data recorders
- Integration: Links with custom HTML, MATLAB®, Excel, and other scriptable frameworks to incorporate microcontroller (MCU) hardware into control loops
- Connectivity: Connects to target systems via various communication peripherals or debug channels, using JSON RPC calls compatible with Python, Node.js, C/C++/C#, and more
- Embedded views: Includes graphs, tabular grids, and web views within the desktop application
Motor Control Application Tuning Tool
NXP’s Motor Control Application Tuning (MCAT) Tool (Figure 4) is a powerful software utility designed to simplify the development and tuning of motor control applications, particularly when using NXP’s motor control hardware platforms and software solutions. It provides an intuitive interface for real-time adjustments to motor control parameters and the possibility to tune the control loop parameters while the motor is running. This capability is critical for fine-tuning performance, minimizing torque ripple, and achieving optimal efficiency, making it a valuable resource for engineers working on electric motors in applications such as EVs.

Figure 4: NXP’s MCAT Tool helps adjust the performance parameters of the motor. (Source: NXP)
Developing the Project
This section describes how the source code can be modified to meet this application’s requirements. It can also serve as a template to make additional changes based on the project’s needs. The source code is available from the GitHub repository.
Editing the Source Code in S32DS
Modify the main loop of the MCAT test code so that the motor runs with the active window switch. The code assumes an active high switch but can be modified for an active low switch.
#include "Siul2_Port_Ip.h"
#include "Siul2_Dio_Ip.h"
#include "actuate_s32m.h"
#define MOTOR_ON() ACTUATE_EnableOutput()
#define MOTOR_OFF() ACTUATE_DisableOutput()
int main(void)
{
// Initialize pins PTD0 and PTE11 as input
Siul2_Port_Ip_PinSettingsConfig pinConfig = {
.mux = SIUL2_PORT_MUX_AS_GPIO,
.inputBufferEnable = true,
.outputBufferEnable = false,
};
Siul2_Port_Ip_Init(1, &pinConfig);
// Main application loop
while (1)
{
// Read the state of PTD0 and PTE11
bool isPTD0High = Siul2_Dio_Ip_ReadChannel(PTD, 0);
bool isPTE11High = Siul2_Dio_Ip_ReadChannel(PTE, 11);
// Turn the motor on if either PTD0 or PTE11 is high
if (isPTD0High)
{
MOTOR_UP();
}
else if (isPTE11High)
{
MOTOR_DOWN();
}
else
{
MOTOR_OFF();
}
}
return 0;
}
The code repurposes the pins originally intended for use with Hall effect sensors. This means that this example can be used in a sensorless configuration.
Uploading the Firmware
To import the installed application software project in the S32 Design Studio IDE for the S32 Platform:
- Launch S32DS for S32 Platform.
- Click File, and then click Import.
- In the Import window, expand the General folder and select Existing Projects into Workspace (Figure 5).

Figure 5: Adding an existing code base in the S32DS. (Source: NXP)
- Navigate to the directory where the project files were downloaded and select the parent project folder.
- Select the Copy Projects into Workspace checkbox (Figure 6).
- Click OK, and then click Finish.

Figure 6: Make sure to select the Copy projects into workspace checkbox. (Source: NXP)
- Expand the project folder and double-click the *.mex file to open the project configuration in the S32 Configuration Tool (Figure 7).

Figure 7: The *.mex file will be uploaded to the device under test. (Source: NXP)
- Ensure that you configure the appropriate project and click the Update Code button to generate configuration files (Figure 8).

Figure 8: Ensure the correct device is selected before uploading the firmware. (Source: NXP)
- In S32DS, click the C icon (Figure 9) to return to the C/C++ view.

Figure 9: The C icon opens the C/C++ viewing mode. (Source: NXP)
- Click the Debug icon (Figure 10) to open the Debug Configuration menu (Figure 11) and select the predefined debug configuration for building and uploading software into MCU.

Figure 10: The Debug icon opens the Debug Configuration menu. (Source: NXP)

Figure 11: The Debug Configuration window lets you change how the firmware will run during debugging. (Source: NXP)
The S32DS will switch to a debug view.
- Click the Resume icon (or press F8) to run the code (Figure 12).
- Click Disconnect (Figure 12) to avoid interference between the S32DS IDE debugger and the FreeMASTER tool.


Figure 12: The Disconnect and Resume buttons let you toggle whether the IDE or test tools have access to the device under test. (Source: NXP)
Tuning the Motor with the MCAT Tool
NXP’s MCAT Tool is a powerful software utility designed to simplify the development and tuning of motor control applications, including those that use NXP’s motor control hardware platforms.
- Navigate to the FreeMASTER_Control folder and double-click the pmpx file to open the MCAT tool (Figure 13).

Figure 13: The S32M_PMSM_Sensorls.pmpx file opens the MCAT tool. (Source: Mouser Electronics)
- Select the appropriate microcontroller and motor control configuration file.
- Enter the motor-specific parameters in the MCAT interface (including, but not limited to):
- Number of pole pairs (pp)
- Rated voltage and current
- Maximum speed (RPM)
- Back EMF constant and winding resistance (if known)
- Click the Output File tab and click Generate Configuration File (Figure 14).

Figure 14: MCAT Output File tab. (Source: Mouser Electronics)
- Follow steps 10 through 12 of the Uploading the Firmware section to add the new configuration.
- Set initial proportional–integral–derivative (PID) control gains for speed and current loops. Default values may be provided by the MCAT tool.
- Enable the motor:
- Set the desired operating mode (for this project, use open-loop or closed-loop control).
- Gradually increase the speed or duty cycle to ensure the motor starts correctly.
- Monitor real-time key parameters like voltage, current, and speed.
- Adjust the PID gains for the speed and current loops:
- Start with proportional gain (P) and tune until you achieve a balance between responsiveness and stability.
- Add integral gain (I) to eliminate steady-state error.
- Add derivative gain (D) if needed to dampen oscillations.
- Use real-time feedback from the MCAT tool (e.g., waveforms and numerical data) to optimize tuning.
Note: MCAT offers a cascade driving structure that enables open-loop and closed-loop operations:
- Scalar control (open loop without any feedback) allows the generation of pulse-width modulation (PWM) signals to test at low speed. Set the motor to 50rpm and slowly increase the V/rpm factor until the motor starts rotating.
- Current field-oriented control (FOC) mode enables the evaluation of current sensing, including tuning the current loop PI regulator.
- Speed FOC mode enables users to tune the speed loop PI regulator, ramps, etc.
- Test the motor under load:
- Apply different loads to the motor to simulate real-world conditions.
- Monitor the performance (Figure 15) and adjust parameters to ensure stability and efficiency.


Figure 15: Testing the motor under load. (Source: Green Shoe Garage)
- Adjust startup parameters such as initial duty cycle, acceleration rate, and startup commutation settings to achieve smooth and reliable motor startup.
- Verify safety features:
- Test the motor’s behavior under fault conditions like overcurrent, undervoltage, or overheating.
- Adjust fault thresholds in the MCAT tool to ensure the motor controller responds appropriately.
- After tuning, repeat steps 4 and 5 as necessary to update the configuration file.
Conclusion
The electrification revolution of the automotive industry requires countless innovations to come together in precise ways. Among these, achieving reductions in cost, weight, and complexity is crucial to enabling the mass adoption of EVs. NXP’s S32M276 SiP solution plays a pivotal role in addressing these challenges by integrating multiple critical functions into a single package, reducing the need for discrete components and minimizing system complexity. This integration translates directly into cost savings by reducing the BOM and simplifying assembly processes. Furthermore, the compact nature of the SiP contributes to a smaller and lighter overall system, which is especially beneficial in EVs, where weight reduction is directly linked to improved range and performance.
By supporting high-performance computation and advanced motor control in a unified package, the S32M276 also enables the development of more efficient climate-control systems. Its optimized architecture allows for precise control of electric motors, improving energy efficiency and lowering the vehicle’s energy consumption. This results in better mileage per charge, enhancing the overall appeal of EVs to consumers. In sum, embedded systems such as the NXP S32M276 should not only help to increase the pace of EV adoption but also help pave the way for a more sustainable future.