BLDC Motor Control with Model Based Design

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BLDC Motor Control with Model Based Design

39,476 Views
Daniel_Popa
NXP Employee
NXP Employee

This course explains how to design and prototype a Motor Control Application using Model Based Design Toolbox for MPC5744P

          

a0c0b5cecd2bd_MotorControlClass_Announcement.mp4
Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x
    • Chapters
    • descriptions off, selected
    • captions off, selected
      (view in My Videos)

      Course Objectives

      1 - Leverage MBD Toolbox Capabilities:

               Automatic C-code generation for different microprocessors

               Initialization and control for multiple peripherals

               Ease of use and speed of development for complex apps

      2 - Highlight MPC5744P Capabilities For Industrial Control

      3 - Learn Step-by-Step How To Control A Motor Speed:

               Sensors reading via GPIO

               Field Oriented Control of BLDC motors

               Pulse Width Modulation via FTM 

      4 - Understand How To Use Available Tools:

               FreeMASTER - real time data visualizer

               RAppID Bootloader

               Run-Time Debugging Tools

      Capture.JPG

      This Course Explains:

      •       All the concepts and dependencies with the assumption that users meet first time with NXP products.
      •       Programming model of various peripherals, communication protocols or motor control concepts
      •       How to use Model Based Design to program a fairly complex application for Motor Control

      Video #1Introduction

                        MPC5744P and MotorGD DevKits unboxing

      MBD Toolbox environment setup

       

      Video #2Application Partitioning

      Motor Control block diagram

      SW blocks and HW peripherals mapping

       

      Video #3Configure Input Commands

      ADC configuration

      GPIOs configuration

      FreeMASTER interface

      Video #4BLDC Motor Theory

      What it is and where to use it

      How it works with digital controller

      Video #5Read Hall Sensors

      Hall sensors setup

      GPIO and eTimer input capture

      Decode rotor initial position

      Video #6Commutation

      FOC sector identification

      6-step commutation

      SVM procedure

      Video #7Commutation Algorithm Validation

      6-step commutation algorithm implementation

      SIL and PIL model conversion

      Validate results with MIL, SIL and PIL

      Video #8Power Stage Configuration

      MotorGD pin assignment

      PWM generation and validation

      FET pre-driver programming via SPI

      Power stage verification

      Video #9Open Loop Control System

      Open Loop control algorithm implementation

      Phase voltage commutation based on Hall sensors

      Spin BLDC motor for the 1st time

      Video #10Speed Estimator

      Speed estimator implementation

      Testing and validation on real motor

      Video #11Closed Loop Control System

      PI Speed Controller tuning

      Closed Loop System transfer function

      Root Locus vs. Ziegler Nichols methods

      Video #12Motor Control System

      Final motor control Simulink model

      FreeMASTER control panel

      Tests and Conclusions

       

      What Is Available As Support Information For The Course:

      Video training

      19 videos showing step by step the theory, practical implementation and validation

      145 minutes of video content

      Training Material

      PDF slides used for each lecture

      Simulink Models

      Matlab 2015b SLX models for each of the functionalities and peripherals covered in the lectures: ADC/GPIO/CAN/UART/FTM/SPI

      Support

      Any additional question will be answered via Community

      UPDATE August 2nd, 2019: Here is an interesting investigation on various controllers design/implementation/test made by  : https://community.nxp.com/thread/509234

      Labels (1)
      26 Replies

      26,135 Views
      haoxue1027
      Contributor V

      hello,

      These courses are very helpful for studying, thank you very much,

      If the video can have subtitles, it is more helpful for studying.

      best regards

      hao

      0 Kudos
      Reply

      26,155 Views
      zhangrunhe
      Contributor I

      I added an SPI command to set the dead time of the GD3000 to 0 in the state machine. Test the waveform of phase A and GND, and the waveform shown below appears.The dead zone is 0 for a while and 24us for a while....IMG_2959.JPG

      0 Kudos
      Reply

      26,136 Views
      thomsonzhou
      Contributor III

      I think you need to use source insight to search all of the dead time variables in your project. 

      So that you can make clear where you should modify exactly.

      0 Kudos
      Reply

      26,136 Views
      zhangrunhe
      Contributor I

      hello,

         Thank you very much,I have solved my previous problem, but I have encountered a new problem.I want to use freemaster to connect my MPC5744 DevKit via CAN. But there is a problem like the one shown.

      error.png

      PS: 1. I have completed the repair of hot fix_8.
                2. I use openSDA to connect freemaster to MPC5744 DevKit is normal.

          thanks very much and wait for your reply!

      0 Kudos
      Reply

      26,136 Views
      thomsonzhou
      Contributor III

      Hi Zhang, 

          Your problem is similar with my previous one. 

      This kind problem maybe caused by:

      Firstly, The corresponding NXP demo software project for MPC5744 dismatch with your board. 

      Sometimes, the NXP demo board use external/internal oscillar but the demo software use internal/external oscillar.

      Secondly, we suggest you  to pay your attention to the jumpers configuration for different connection cables. You need to read your demo board manual carefully. NXP board mainly have several connection methods including SCI, USB2UART, PEMicro, and openBDM.

      All above connections have different jumper configurations. 

      So, please read the corresponding document carefully to make sure your jumers' configuration are exact. 

      .  

      0 Kudos
      Reply

      26,136 Views
      zhangrunhe
      Contributor I

      Hi,thomson

      thanks for your help. I tried to use the etimer module of MBDT for MPC574XP to read the signal of the photoelectric encoder. I can get the count value of a certain etimer module, but I can't make the etimer module detect the pulse of the encoder index and then clear the value of the register captured by etimer. How can I do this?
      PS, I used two etimer modules and one used for orthogonal decoding. Read the pulses of the A and B phases of the encoder. Another pulse is used to detect the index and generate an interrupt.module.png

      0 Kudos
      Reply

      26,136 Views
      thomsonzhou
      Contributor III

      Dear Zhang, 

          Sorry to reply too late. I was  on my business tour in last two weeks. I saw your problem. My answer is you can add a detection fucntion manually in the generated code. Or you can add one user define simulink function in your BLDC module.

         To detect the first and the second pulses, you need to be very familar with your NXP TIMERS, which is used for PWM signal detecting.

        To NXP MCU, it is much easier for PWM signal detecting. After read the MCU manual, you can find the timer exact registers description for the hex value of the registers.

        Usually, if you use pulse A and pulse B then you need to use one timer with two channels to detect the first clock time and the second clock time for your machine. After you get the two hex values you can evaluate the exact time, frequency and periods or any variable you want.

        The problem is you need to reset your clock before start your function because all of the clock counting need to start from zero clock time.

      Good Luck!

      Thomson 

      0 Kudos
      Reply

      26,184 Views
      zhangrunhe
      Contributor I

      Hello,

      can you tell me how to set the deatime of MC34GD30000?use the MBDT simulink.I used your routine to find that the actual dead time is 24us, which is obviously too long.

      thank you very much and wait for your reply

      0 Kudos
      Reply

      26,184 Views
      thomsonzhou
      Contributor III

      When you generate the model from simulink model to C code, you can locate the exact location of GDU part settings. 

      Locate the exact deadtime register, and then modify the deadtime value from 24us to 1us.

      So often we use 1us to make BLDC/PMSM rotate as faster as possible. 

      To make clear which register is the deadtime register, please research the corresponding MCU manual. 

      You can download the corresponding manual from www.nxp.com

       GOOD LUCK!

      0 Kudos
      Reply

      26,185 Views
      zhangrunhe
      Contributor I

      Hi,I want to know how to use the MBDT for MPC5744P to read the conversion value of the ADC through DMA. I tried to use your routine and found that I can't read the conversion value of the ADC at the destination address.Can you provide a demo for reference.

      thank you very much and wait for your reply

      0 Kudos
      Reply

      26,185 Views
      thomsonzhou
      Contributor III

      Hello,

             MPC5744P should have its own demo code. Or you can use MBDT simulink modues of BLDC or FOC to make your motor rotate. Since the MCU model can be changed from one to another, you can change it the simulink MCU model from MC9S12 to  MPC5744P and then generate your code directly. 

         

          If you use the exact evaluation board, you can make your motor rotate immediately.

      :smileyhappy:

      0 Kudos
      Reply

      26,185 Views
      edenli
      Contributor V

      Hi Daniel,

      I very excited to find the "Motor Control Class",and i congratulate with you achiving complete success in advance.if yes,i wanna join in.and now i am learning the PMSM control,Can you add some videos about the PMSM control likely the BLDC?

      Best Regrads!

      Eden Li

      0 Kudos
      Reply

      26,184 Views
      Daniel_Popa
      NXP Employee
      NXP Employee

      Hi Eden Li, 

      We start with BLDC because is simple. Depending on the feedback we get - for sure we can think of another course on FOC Sensorless on PMSM - for second half of this year.

      Best regards,

      Daniel

      26,185 Views
      thomsonzhou
      Contributor III

      Hi Daniel, 

         For the BLDC MCT toolbox model toolbox 1.3 , the target MCU does not contain the target MCU: MC9S12ZVML32. I have no idea why NXP does not provide the both options for both MC9S12ZVML32 and MC9S12ZVM32.

        What is the differences between MC9S12ZVML32 and MC9S12ZVM32?

        How can we reuse the model for MC9S12ZVML32?

        Do you have any better suggestions for MC9S12ZVML32? Or do you have example BLDC modles for MC9S12ZVML32 ?

      Thomson 

      0 Kudos
      Reply

      26,184 Views
      Daniel_Popa
      NXP Employee
      NXP Employee

      Hi Thomson, 

      This toolbox has been release some time ago and in the meantime was not updated to support all the available derivatives. Anyhow - the parts you are refering looks very similar - please check table 1 in this application node

      https://www.nxp.com/docs/en/application-note/AN5330.pdf 

      You may reuse the MATLAB support for MC9S12ZVM32 to develop applications for MC9S12ZVML32 and should work fine.

      As a BLDC example you can start with this one: Example Model: S12ZVM Trapezoidal Motor Control  and migrate it to use the MC9S12ZVM32.

      Hope this helps!

      Daniel

      0 Kudos
      Reply

      26,185 Views
      thomsonzhou
      Contributor III

      Hi Daniel,

          I downloaded the BLDC model you attached, however, I found when I use a simulink scope model, which contains 3

      three input ports, connected to the corresponding 3 BLDC motor PWM output ports( pwma , pwmb and pwmc) , with

      matlab BLDC data file ?.mat putted in matlab enviroment, the BLDC PWM output signals are always zero. It means the

      BLDC model you attached did not run at all. 

         How can I make this BLDC simulink model generate the exact PWM signal waves when I attached a simulink scope?

       Or this simulink model need to be actived to run with free master project, which attached in the simulink model file?

      If yes, please let me know the corresponding pdf, http links or other resources with details how to make this simulink

      BLDC model generate exact right PWM output signal.

        Finally, I downloaded the FOC simulink model in your class, however, it always generate zero in the simulink scope,

      which means the FOC motor does not run at all. 

      I have no idea, how to make this  models generate exactly right signal output?

      Thank you very much and wait for your reply.

      Thomson 

      0 Kudos
      Reply

      26,186 Views
      thomsonzhou
      Contributor III

      Thank you very much. This helps.

      0 Kudos
      Reply

      26,186 Views
      Maciek
      Contributor V

      Hi Daniel,

      the course is a great idea! I will join it for sure. At my company we are using MBD and we are generating code for NXP processors but we don't use MBD toolbox or any other board support packages. 

      A few months ago we were evaluating MBD toolbox using a few low-cost devkits from NXP (for: MC9S12ZVMx, MPC5643L and Kinetis). And we have had multiple problems/questions like: compiler version settings, Rappid Bootloader usage, specific block usage etc. Even questions about intended usage/application of MBD toolbox itself.

      The most important thing (at least for us) would be to have alive and responsive channel (like this forum) with direct response from MBD toolbox people at NXP.

      I can't also see MotorGD DevKit available anywhere. Can You point us what exactly is the course hardware setup ?

      It looks like DEVKIT-MPC5744P with DEVKIT-MOTORGD and some BLDC motor (but what model exactly) - but there is no info about this kits on the NXP site ?! Are they available now (and where) ?

      Best regards

      Maciek

      26,184 Views
      Daniel_Popa
      NXP Employee
      NXP Employee

      Hi Maciek, 

      We look forward to answer all your questions. We want to change the way we do things and become much more involved with the customers/users of MBD via this community and this course is one of the first initiatives that hopes to clarify some of the aspects you have already highlighted.

      For the setup - please wait until Monday when we will release the 1st video - mainly that is the content of the Introduction video - unboxing the devkits and various information about it. We want to avoid spoiler alert at this time :-)

      Thank you!

      Daniel

      26,186 Views
      jgerhardy
      Contributor III

      Hello Daniel,

      The course sounds very interesting and I have some questions. It is necessary to sign up for the course? Will it be possible to view the videos after the release week appointments? Unfortunately, I will not be able to participare during the first three weeks of the course. Is it necessary to have the MotorGD DevKit to participate? What IDE will be used for the course, the S32 or is it possible to work with code warrior?

      Greetings,

      John

      0 Kudos
      Reply