In this module of the 3-Phase PMSM Workshop, the focus is on the hardware and software setups that are going to be used throughout this workshop to implement and test a complete 3-phase Permanent Magnet Synchronous Motor (PMSM) control system with NXP’s S32K micro-controller family. Except for the hardware components that can be purchased from NXP website or various distributors around the world, the software tools used for developing the applications are free of charge.
The following table summarize the most important resources that will be used for reference for upcoming modules:
|S32K144EVB & SoC||DEVKIT MOTORGD|
S32K144EVB – Product home page
S32K144EVB – Quick Start Guide
S32K144 SoC – Reference Manual
S32K144 SoC – Data Sheet
DEVKIT MOTORGD – Product home page
DEVKIT MOTORGD – Quick Start Guide
MC34GD3000 – Data Sheet
PMSM DEVKIT – Product home page
MATLAB TOOLBOX for S32K1xx Add-On Installer – MathWorks File Exchange Page
FreeMASTER Run-Time Debugging Tool – Product home page
S32DS-ARM Design Studio IDE for ARM – Product home page
Support & Training – Community page
Nowadays, to most common and convenient way to implement the Field Oriented Control (FOC) to control the rotor position in a PMSM is numerical/digital approach. In the distant past like ‘70s & ‘80s most of the applications were developed using analogue techniques which posed a lot of challenges in terms of maintenance and scalability.
The main component of this development platform is the S32K144 MCU that integrates a 32bit Cortex M4F core capable of running at 112MHz with 512KB of Flash memory and 54KB of RAM . Dedicated hardware peripherals for motor control (FTM, ADC, PDB, Timers) and a large collection of communication blocks makes this MCU a suitable candidate for various industrial and automotive applications. A block diagram with the most important components and features is shown in Fig. 2.
NOTE: ALL THE SOFTWARE TOOLS USED IN THIS WORKSHOP ARE FREE. SOME OF THE TOOLS REQUIRES A VALID LICENSE THAT CAN BE OBTAINED FREE-OF-CHARGE FROM YOUR NXP ACCOUNT
|Hands-on video training: How to build an application from scratch with NXP's Model-Based Design Toolbox for S32K MCU family for testing the Hardware and Software environment setup|
We hope you enjoy the new workshop format and find this information useful. Feel free to LIKE this article and comment below.
March 18, 2019
May 06, 2020
I'm having trouble connecting with FreeMASTER for the last step. I see the COM port in Device Manager and see the mapped network drive, but using the recommend procedure or the connection Wizard, FreeMASTER can't connect to an UARTs
I tried the Ipuart_hello_world_s32k14x example, and that worked over PuTTY on the same COM port and baud rate.
I was able to use FreeMASTER with the MCSPTE1AK144 getting started example with S32 Design Studio in lieu of Simulink
Any Ideas of what might be going wrong?
I am practicing the model "Verify_SW_HW_Setup"，but it doesnot work well.
I followed the steps step by step, but every time the program is compiled and downloaded to the development board, it failed: the simulink always showed "building" for a long time( i wait for twenty minutes ), and the light on the development board flashed in blue at a certain frequency.
Then i looked at the diagnostic log and it showed "*** Created executable: Verify_SW_HW_Setup.mot ### Successful completion of build procedure for model: Verify_SW_HW_Setup"
I uploaded a diagnosis viewer screenshot and a video of the malfunction.
My matlab version is matlab 2019a, and the computer operating system is Win10.
Thanks very much and wait for your reply!
The figures and videos in module 1 to module 10 cannot be loaded and displayed for several days.
I have checked my internet connection, web browser setting and disabled ad filter, I have even tried to browse these pages using starbuck's wifi and with different web browser, firefox, chrome, ms edge, but the figures and videos cannot be displayed.
I followed the software setup steps in module1,but it doesn't work well ,i can't use the simulink model "Verify_SW_HW_Setup" you uploaded to generate code .My matlab version is matlab 2019a.I tried "MBDToolbox_S32K1xx_2018.R1_20180723" and" MBDToolbox_S32K1xx_4.2.0_20200720",the same errors happended . I will upload some pictures about the errors and the location of the GCC compiler in my computer.
Would you please give me some advices. Thanks a lot.
Hello @Jerry_zhang ,
From your screenshots I see two issues: the library link is broken, which means that either probably our toolbox is not in the Matlab's path, or the model is designed using another MBDT version. There is also the license error that tells that the toolbox is not able to see a valid MBDT license.
I would proceed using the following approach:
1. type the 'ver' command in Matlab, you should see a line like this:
Model-Based Design Toolbox for S32K1xx Series Version 4.2.0 (R2016a-R2020a)
If not, please set the Matlab Path to default and then go in the AddOns folder, where our toolbox is installed, and run the mbd_s32k_path.m script.
This will install our toolbox in the Matlab Path.
Now open the model and let me know if this solved the problem.
Hope this helps,
Hello @Z2D ,
Looks like the read_SW2_pushbutton has the link broken with our library.
The easiest way for solving this issue is to delete the block, open our library and replace the deleted block with a Digital Read block from MBDT library. You then need to select back the PTC12 pin inside the read block. This will solve the link issue.
Hope this helps,
Hi, it happens to me that I found a solution to the broken link problem in all the model files attached.
First of all, I use matlab version 2019b and nxp mbd tool box 4.2.0.
When open the model file for the first time, e.g. ...\M1_2018.R1\Verify_SW_HW_Setup.mdl, matlab prompts the following diaglog box.
Click YES to open the model. And we can see there is a broken link model in the file.
read_SW2_pushbutton is broken
Then we should save the model file, just click the SAVE button on the top right corner. And matlab will prompt the following dialog box.
It seems the original file was created in an older matlab version, and when we save the file, it will be saved in a newer format and the old one will also be saved with its version number appended.
Just click OK to continue. And we will find a extra file is created in the directory.
Finally, open the model "Verify_SW_HS_Setup.mdl" again, matlab prompts the following dialog.
It says that matlab will try to fix the broken links automatically.
Just click YES and voila, here is a working model.
I use this method to solve the same problem in module 4 and 5, and it works. The only thing you should to repair manually is in the fastloop control subsystem, the inverse park module and standard svm module has their port number changed, so you should repair the problem yourself.
There are some extra minor problems should be fixed to make the model run. Good luck.
Thanks for this demo.
I have a question about the out-port that I need to add so that I can show it in Freemaster.
I did all the steps but still the out-port name is not shown in Freemaster, Is there a way to check what I missed ?
Depending on your MATLAB/Simulink version you will probably need to define the Simulink Outport in the model itself as a "volatile" data type.
Otherwise, you will need to check the generated code and see in which variable the Simulink store the output. It is typically something like <model_name>_b.<variable_name> and plot that in the FreeMASTER.
Let me know if that works!
I have the same issue. Even when I create a simulink signal object like firstname.lastname@example.org , I can't find the variable in freemaster. It seems to read correctly the addresses, because the value of the variable change when I change the address.
In the generated code, what can I do with the variable name?
In general, I recommend using "volatile" - this way the variable will not be optimized out by cross-compiler (GCC/IAR/etc
If you use the data store then:
If you use the signals to assign variables then:
If you still can't find it after using "volatile" then have a look in the generated code. Typically, Simulink creates a structure and your variable is one of these structure fields.
Hope this helps!
First of all, Thanks for teaching this great course.
I am having few issues while doing the module1.
I could able to generate the code without any errors using the 2019a version. but my kit is not blinking LEd at all while I am pressing sw2.
I could successfully map the elf file to free master. But I could not see the sw2 status variable in freemaster. Could you please help me with this. Please see the attached model and generated code. Thanks.
The project attached has its name on s32k11x but inside the project attached, the Config block gas the target set for S32K144. On which board do you want to run your project? Also, the .mot file attached in the archive is working on S32K144EVB (Pressing SW2 turns the Blue LED on).
For the second question, please check inside the FreeMaster Config Block the selected UART pins that they have been correctly selected. Please reply with the board you want to run and I will check the pins.
Hope this helps,
Thanks for your response. I am trying to run the code in S32K144EVB. I was using GCC compiler in the files that I have shared. For some reason,it was not working. Then I tried to change the compiler to IAR. Then it started working. Thanks.