Getting starting with S32K BLDC

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting starting with S32K BLDC

Jump to solution
843 Views
JesseBeeker
Contributor III

Hello. I am transitioning from the basic C-code demo to the start of a real application using MBD Toolbox. Here is the kit I purchased:

S32K144 Development Kit for sensorless BLDC | NXP 

I have been able to install all tools and have no issue creating and building the simple pushbutton and LED example on the S32K EVB. As I have moved through the motor control training modules, I cannot seem to get the motor to spin. I hear the PWM but the solutions provided in Module 5 and 6 and just not spinning the motor. I then went into the examples included in MBD Toolbox for S32K version 4.0.0. I specifically worked with the BLDC: Open Loop example. I am able to build and interact with it using Freemaster. I see the change to the voltage applied when I press the switches but all I get is PWM noise. Thinking I may have damaged something, I went back to my C-code demo using the S32 Design Studio and everything works as expected. 

I clearly must have a disconnect here with my set up or understanding. I found it strange that when I load the models from the training modules, the picture for the EVBs and motor are missing. Perhaps that is a clue. I am using MATLAB 2018b for reference. 

Is there something different I need to do with the hardware between the reference development kit and using the MBD Toolbox examples? EVB has a sticker referencing schematic B1. There seems to be a revC on another EVB I have on another project. 

0 Kudos
1 Solution
423 Views
JesseBeeker
Contributor III

Daniel,

I am happy to report I have the motor spinning. The kit was set up for PTD not PTA on the S32K EVB. The latest model, patch, and updated hall A and B pins was the final solution. Thank. you. 

For the Static Code Metrics issue, can you confirm that this should work with the project? I want to have this working before I start on the application.

View solution in original post

0 Kudos
7 Replies
423 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi JesseBeeker‌,

Sorry for delay due various holidays.

Please find attached the latest models we have for the BLDC Open/Closed Loop.

#1: In order to use these examples please apply patch from here: https://community.nxp.com/thread/489947#comment-1106251

#2: check on the S32K144 EVB  schematic how are the resistors R167/168/165 and 166 placed.

#2: open the models in Simulink and read carefully the instructions, making sure the phases and halls are connected in the specific order. The models assumes the S32K144 EVB is configured as factory default - without any modifications. The jumper configuration required is shown in Simulink model info.

The models released with the toolbox in the past were developed with a slightly different setup (prototyping one) and the mean time in production the kit is a bit different. The examples attached here were tested on a standard kit similar with the one you have ordered.

I have noted that the working C-Code uses PTD11 and PTD10 for Hall A and B respectively. The MBD Toolbox examples are using PTA15 and PTA16. It was clear in Freemaster that you cannot use the PTA signals here. Perhaps I have an old development set up but I ordered it late 2018, so that would be strange. 

Indeed the MBDT examples are using the PTA15 - Hall A, PTA16 - Hall B and PTA1 - Hall C.

If you take a look at the board schematics (https://www.nxp.com/support/developer-resources/evaluation-and-development-boards/ultra-reliable-mcu...) you will see that by default the R167 and R165 are placed by default on the board to route the Hall signals to PTA15/16

I do not know the reason why your kit has the R168/R166 plased. Perhaps marekmusak‌ might have an explanation. As far as i know the only changes should be on the MotorGD Kit when switching from PMSM/BLDC.

Anyhow, you can simply change the Simulink model to use the new pins (in 3 places) and it should work fine.

I'm looking forward for your feedback and suggestions.

Best regards,

Daniel

0 Kudos
424 Views
JesseBeeker
Contributor III

Daniel,

I am happy to report I have the motor spinning. The kit was set up for PTD not PTA on the S32K EVB. The latest model, patch, and updated hall A and B pins was the final solution. Thank. you. 

For the Static Code Metrics issue, can you confirm that this should work with the project? I want to have this working before I start on the application.

View solution in original post

0 Kudos
423 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi JesseBeeker,

Thanks for confirmation. Glad to hear it's working for you.

In regards with Static Code Metric issue - i'm not quite sure what you mean ? On the generated code you can run any metric you wish with any tools supported by MathWorks environment: Simulink Coverage, LDRA Testbed or BullseyeCoverage

In addition, if you want to run the metrics on PIL, then you will need to modify the model in order to keep in only the control functions. An example is available in the PIL BLDC examples.

Hope this helps!

Daniel

0 Kudos
423 Views
JesseBeeker
Contributor III

Daniel,

I have not been able to make it back to my office to look at the hardware but I want to make sure I have the right file setup here as I suspect I am doing something wrong there. The model builds (closed loop one) but when I turn on Static Code Metrics, there are files that it cannot find and the report is just a list of errors. The files are clearly in the installed toolbox under the Platform SDK folder structure. I added this to my MATLAB path but this did not solve the issue. 

Where are you expecting the provided files to be located?

For reference here is my workspace path that I have been putting the files use as the directory for the MATLAB workspace for the build:

C:\Users\sti-jbeeker\MATLAB\Workspace

Here is my toolbox path:

C:\Users\sti-jbeeker\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes

Here is a screenshot to show what I am talking about:

0 Kudos
423 Views
JesseBeeker
Contributor III

Daniel,

I have installed the patch and downloaded the updated models. I will walk through the details and hope to report success later this week. I hope my expectations with the motor dev kit to move from the shipped C-code demo to the model toolbox version without making hardware changes is not unreasonable. My desire is to only move forward code generation so I put that issue in the past. 

0 Kudos
423 Views
JesseBeeker
Contributor III

Ok, so I now see the separate track for the BDLC material. Not sure why I missed it before. I will work through and hope for a better result. 

0 Kudos
423 Views
JesseBeeker
Contributor III

So I have uncovered at least one issue here with the motor control examples. I went through the hall sensor exercise and I have noted that the working C-Code uses PTD11 and PTD10 for Hall A and B respectively. The MBD Toolbox examples are using PTA15 and PTA16. It was clear in Freemaster that you cannot use the PTA signals here. Perhaps I have an old development set up but I ordered it late 2018, so that would be strange. 

With these changes, I now get the hall transitions visible in Freemaster with the BLDC_OpenLoop_s32k14x example. Unfortunately the motor still does not spin. It actually seems to just drive the motor to a locked position so there must be some other issues. 

Hopefully with this explicit issue uncovered an NXP person may take notice here. 

0 Kudos