S32 Design Studio: Import, Build, and Monitor a Motor Control Project using AI

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32 Design Studio: Import, Build, and Monitor a Motor Control Project using AI

S32 Design Studio: Import, Build, and Monitor a Motor Control Project using AI

 

Introduction

 

This tutorial demonstrates an end-to-end, AI-assisted motor control workflow using S32 Design Studio AI Support. You'll find a motor control application for the FRDM-A-S32K312 on the NXP Application Code Hub, import it into S32 Design Studio, generate code, build and flash the project, and then create a FreeMASTER dashboard with motor controls, speed selection, and live parameter monitoring. The tutorial uses the NXP PMSM Low Voltage Motor Control Accessory Kit as the motor hardware.

 

Everything is done through two prompts – jump straight to the steps if you already have the tools installed.

 

Estimated time: ~35 minutes.

System Architecture

 

Tutorial-4.png
S32K312 Motor Control + FreeMASTER – system architecture overview

 

The components involved are:
 
Motor – NXP PMSM Low Voltage Motor Control Accessory Kit is connected to the FRDM-A-S32K312 board. The Motor is driven by PWM output from the MCU.
FRDM-A-S32K312 – Runs motor control firmware with FreeMASTER TSA enabled. Streams live data to the host PC over USB (UART).
Host PC – Runs FreeMASTER Lite (fmlite.exe) on COM#, 115200 baud, port 51234. Serves the HTML5 dashboard to the browser.

Prerequisites

 

What you need before starting

 

  • Create the folders C:\NXP\2026\K3_kit\S32DS_3.6.8 and c:\NXP\2026\K3_kit\FM_32
  • Download the FRDM Automotive S32K3 + S32M27 Board Installation Package from the Automotive Package Manager – LINK
  • Install S32 Design Studio from the above bundle into C:\NXP\2026\K3_kit\S32DS_3.6.8 along with the S32K3 SDK and S32 Design Studio MCP REST Server
  • Install the AMMCLIB for S32K3xx/S32M27x (Automotive Math and Motor Control Library) using S32DS Extensions and Updates required by the motor control demo
  • Install the NXP GCC for Arm Embedded Processors v10.2 toolchain using S32DS Extensions and Updates — this is the toolchain used to build the motor control example
  • Install FreeMASTER Lite into c:\NXP\2026\K3_kit\FM_32\FreeMASTER Lite – download from LINK
  • One FRDM-A-S32K312 evaluation board + USB cable
  • One NXP PMSM Low Voltage Motor Control Accessory Kit (motor and driver hardware for the FRDM-A-S32K312)
  • Connect the board to the PC via USB and find out which COM port it was assigned — open Device Manager → Ports (COM & LPT) and note the port of the board's USB-serial interface (it can be any COMx). You will hand this value to the AI agent, which uses it for the FreeMASTER Lite serial connection
  • Any modern browser (Chrome / Edge / Firefox)
  • Download, install and configure your agent to use the S32 Design Studio AI Support following the Installation & Usage Guide

 

Connect the FRDM-A-S32K312 board to the PC via USB before starting, then tell the agent the COM port of the board — for example: "the board is connected on COM7, use it for FreeMASTER Lite". Everywhere this tutorial shows COMx, replace it with your own port number. The AI will search the Application Code Hub and select the most suitable motor control demo automatically.

Steps

 

Send the following prompts to your AI assistant in order. Each is a complete, self-contained instruction.

 

Step 1 – Import motor control demo, build and run

You are a software developer that needs to use S32K312 FRDM board to control a motor.
I have the NXP PMSM Low Voltage Motor Control Accessory Kit available for my application.
Check NXP Application Code Hub for an application that can be used and import the selected application into S32 Design Studio IDE.
S32DS is installed at C:\NXP\2026\K3_kit\S32DS_3.6.8.
Run S32 Configuration Tools to generate code, build it, load into the flash memory and run the project.
Use the s32ds-agentic-ai MCP server; if the MCP server disconnects at any point, stop immediately and notify user.
AI will:
 
  • Search NXP Application Code Hub for a motor control application suitable for the FRDM-A-S32K312 and compatible with the NXP PMSM Low Voltage Motor Control Accessory Kit
  • Import the selected project into S32 Design Studio at C:\NXP\2026\K3_kit\S32DS_3.6.8
  • Open S32 Configuration Tools and click Generate Code (Pins, Clocks, Peripherals)
  • Build the project and confirm zero errors
  • Flash the .elf binary into the board's flash memory and run the project
  • Stop and notify the user immediately if the s32ds-agentic-ai MCP server disconnects

 

Step 2 – Create FreeMASTER dashboard and run it

Using FreeMaster Lite create a self contained web dashboard and the server configuration file in the project folder called dashboard.
FreeMaster Lite is installed at c:\NXP\2026\K3_kit\FM_32\FreeMASTER Lite\fmlite.exe
The dashboard should define and connect all the variables for the 4 panels and contained components:
- top panel: contains the controls for the board serial connection, default: connection name "S32K312 Board", COM#, 115200 baud, 8 data bits, no parity, 1 stop bit
- left panel: contains the motor control panel: motor state (on/off), actual RPM and desired RPM, slider for selecting the RPMs in both directions, a 0 RPM button, and +- 10/100 RPMs buttons
- middle panel: contains a graphical representation of the motor, spinning the NXP logo in sync with the motor actual speed
- right panel: contains all the board\motor parameters that you can find relevant
Start FreeMaster server and run the dashboard at the end
Once the JS client confirms that the board is connected it should start reading desired and actual RPMs
Use the s32ds-agentic-ai MCP server; if the MCP server disconnects at any point, stop immediately and notify user.
AI will:
 
  • Create a FreeMASTER configuration file in the project subfolder dashboard/: COM#, 115200 baud, 8 data bits, no parity, 1 stop bit, connection name "S32K312 Board"
  • Generate a self-contained HTML5 dashboard saved to the project subfolder dashboard/ with all FreeMASTER variables defined, organised in four panels
  • Once the JS client confirms the board is connected, automatically start reading desired and actual RPMs
  • Start the FreeMASTER server and open the dashboard in the browser
  • Stop and notify the user immediately if the s32ds-agentic-ai MCP server disconnects

 


Verifying the Result

 

Work through this final check to confirm that both prompts completed successfully.

 

Final check
  1. Motor control project imported and visible in S32DS Project Explorer.
  2. S32 Configuration Tools ran – code generated with no errors.
  3. Build completes with zero errors.
  4. Firmware flashed and running – motor responds as expected.
  5. PMSM kit connected and motor responds to commands from the dashboard.
  6. FreeMASTER configuration file created in dashboard/: COM#, 115200 baud, 8 data bits, no parity, 1 stop bit, connection name "S32K312 Board".
  7. FreeMASTER server is running.
  8. Dashboard opens in browser – all four panels visible.
  9. Once connected, the dashboard automatically starts reading desired and actual RPMs.
  10. Left panel shows motor on/off state, actual and desired RPM, slider for both directions, 0 RPM button, and ±10/100 RPM buttons.
  11. Middle panel shows the NXP logo spinning in sync with the actual motor speed.
  12. Right panel shows all relevant board/motor parameters updating in real time.

Troubleshooting

 

Symptom Fix
No motor control demo found on ACH Try broader search terms such as "motor", "PWM", or "BLDC". Confirm the s32ds-agentic-ai server is connected.
Import fails or project missing from Project Explorer Try File › Import › Existing Projects into Workspace manually. Confirm S32DS path is C:\NXP\2026\K3_kit\S32DS_3.6.8.
S32 Configuration Tools does not open Double-click the .mex file. Ensure the S32K3 SDK is installed and the project SDK is correctly configured.
Generate Code produces errors Check Pins, Clocks, and Peripherals tabs for red validation markers. Resolve conflicts before regenerating.
Build errors after Generate Code Ensure the generated src/ folder is in the build path. Try Project › Clean then rebuild.
Motor does not respond after flashing Check hardware connections between board and motor driver. Verify correct PWM output pins per the demo schematic.
FreeMASTER dashboard does not connect Confirm the FreeMASTER server is running and COM# / 115200 baud / port 51234 match the configuration file. Check that the board is powered and running.
Dashboard does not auto-read RPMs after connect Check the JS connect callback in the dashboard HTML. Ensure the ReadVariable calls for desired and actual RPM are triggered after the WebSocket StartComm response confirms success.
Actual/desired RPM shows 0 or stale Verify the variable names match those in the FreeMASTER project. Check that FMSTR_Poll() is called in the main loop and TSA is enabled.
Right panel parameters not updating Verify FreeMASTER TSA is enabled (FMSTR_USE_TSA 1) and FMSTR_Poll() is called in the main loop.
s32ds-agentic-ai MCP server disconnects Stop immediately and restart the MCP server following the Installation & Usage Guide.

File Reference

 

File Step Description
src/main.c 1 Main firmware – motor control loop with FreeMASTER TSA
*.mex 1 S32 Configuration Tools project file (Pins, Clocks, Peripherals)
generate/src/ 1 Auto-generated peripheral initialisation source files
generate/include/ 1 Auto-generated peripheral configuration headers
dashboard/board_115200.fmcfg 2 FreeMASTER server configuration: COM#, 115200 baud, 8 data bits, no parity, 1 stop bit, "S32K312 Board"
dashboard/motor_dashboard.html 2 Self-contained HTML5 dashboard with all FreeMASTER variables, 4 panels (top: serial connection; left: motor control with slider, 0 RPM button, ±10/100 RPM buttons; middle: NXP logo spinning in sync with actual speed; right: board/motor parameters), auto-read on connect

 

Import the demo, build it and let your AI assistant generate the FreeMASTER dashboard – a complete motor control setup in about 35 minutes.

ラベル(1)
評価なし
バージョン履歴
最終更新日:
5 時間前
更新者: