Open source brushless motor drive solution based on Infineon MCU GTM module

 

§ 01   Preface


  Hello all participating students, students who have followed the WeChat public account of Zhufei Technology should remember that, entrusted by Infineon, Zhufei Technology released an open source project for the 17th brushless motor drive on December 9, 2021. For your reference, I believe that some students have already started to play based on the previous open source solution. Those who have not noticed the original open source project can learn about it through this tweet, "Infineon BLDC driver solution is open source - Zhufei Technology" can Comparing and interspersed learning with today's program in order to achieve a better understanding effect.

  After the open source project of the last project, we learned that many students want to combine the brushless driver and the motherboard into one, and use a TC264 chip to control all peripherals, but the open source brushless driver project some time ago used It is a CCU6 module, which requires the CPU to frequently process the commutation control of the brushless drive, so many students worry that the CPU may not be able to handle it later. At the same time, Infineon also hopes that we will make another brushless based on the AURIX series MCU GTM module. The driver solution is for the reference of the students, so they hit it off. Today, a new brushless driver open source solution is brought to the students - a module brushless driver open source solution based on Infineon MCU GTM.

▲ Figure 1 Infineon Shanghai Headquarters

▲ 图1 Infineon上海总部

 

§ 02 Brushless Motor


  Since the release of the rules of the 17th Smart Car Competition, this is the third open-source project about brushless drives released by ZFYI. I believe that most of the students participating in the group that allow the use of brushless motors have already expressed concern about brushless motors. The rotation principle of the brushless motor is relatively familiar, but for the convenience of reading, please allow us to briefly explain the principle part of the brushless motor here.

2.1 Internal structure of brushless motor

▲ Figure 2.1 Internal structure of permanent magnet brushless DC motor (BLDC)

▲ 图2.1 永磁无刷直流电机(BLDC)内部结构

  The above picture is a sketch of the connection of the internal wires of the brushless motor. It can be seen that there are three pairs of coils, which are called A, B, and C coils. One end of each pair of coils is connected as a midpoint. The black line outside the motor stator in the above figure represents the midpoint of the three coils. The other ends of the three coils are led out to the outside to link and drive a three-phase bridge circuit.

▲ Figure 2.2 BLDC motor connection to drive three-phase bridge circuit

▲ 图2.2 BLDC 电机连接驱动三相桥电路

  In the structure of the brushless motor, we generally call the part of the coil as the stator. The middle part has a permanent magnet with N/S poles, which we generally call the rotor. Have you ever found that the stator and rotor in a brushless motor are exactly opposite to those of a brushed motor?

2.2 Rotation principle of brushless motor

  In order to drive the brushless motor to rotate, it is necessary to apply an appropriate current to the two phases of the three-phase lead of the motor when the rotor is at an appropriate angle, so that the stator generates a magnetic effect on the rotor to form a directional torque. When the rotor rotates through a certain angle, the energized coil is switched, so that the stator magnetic pole acts on the rotor to always form a torque in one direction.

▲ Figure 2.3 After the two phases A and B are energized at the same time, the stator magnetic poles and the rotor form torque

▲ 图2.3 同时给A,B两相通电之后定子磁极与转子形成转矩

  The following figure shows the polarity combination of the three-phase electric voltage applied and the sequence of changes. According to this sequence, the stator will form a rotating magnetic field inside, which will drive the rotor to rotate.

▲ Figure 2.4 Three-phase power-on sequence and combination of brushless motor

▲ 图2.4 无刷电机三相通电顺序和组合

  In order to obtain the maximum output torque, the stator is required to generate a magnetic field that leads the rotor by 90° in the direction of rotation. Hall sensors are usually used to measure the rotor magnetic pole angle. The figure below shows the voltage waveform output by the three Hall sensors inside the motor when the rotor rotates.

▲ Figure 2.5 HALL angle sensor and output signal embedded in the stator

▲ 图2.5 镶嵌在定子上的HALL角度传感器以及输出信号

  The three Hall sensors have a total of eight state combinations, of which all 0s and all 1s are invalid states. The remaining six state combinations represent the six regions of the rotor in 360°. In different intervals, applying different driving voltages to the three phases of the motor A, B, and C can generate a stator magnetic field that is 90° ahead of the rotor magnetic field, thereby generating the maximum rotational torque.

  So at this time, we can sort out the general brushless motor control principle:

  1. Detect the angle range of the current rotor through the Hall sensor

  2. By judging the current rotor angle interval, let the microcontroller output the control signal of the next interval

  3. The control signal is output to the motor through the pre-drive and MOS switch

  4. When the rotor reaches the next angle interval, repeat the first step

  Similarly, if you are unfamiliar with this part, I recommend the tweet released on December 9 last year, which has a detailed explanation.

 

§ 03 GTM Module


3.1 Introduction to GTM module

  2.1. Brief description of GTM module

  GTM (Generic Timer Module), literally translated means the general timer module, but it is a bit different from the general timer we usually understand. We usually use timers to output PWM signals or for periodic interrupts, etc. , these functions are supported by the GTM module, and there are some functions that we have not known about, please see the following figure:

▲ Figure 3.1 Internal function diagram of GTM module

▲ 图3.1 GTM模块内部功能图

  This is the overall block diagram of the GTM module. The first thing we must see is the largest module in it, the ARU module. It is used to process data flow and can control the output of the entire GTM module, but it is not what we have today. The protagonist, our protagonist is on the left and lower left parts of the ARU module, which are the TIM module, SPE module, and TOM module. The combination of these modules realizes the operation of the single-chip hardware to detect the Hall and commutate the output. Our CPU will There is no need to repeatedly execute the code for the brushless motor drive section.

3.2 Drive Logic Analysis

  Before introducing the modules we will use separately, let's briefly describe their workflow.

  The TIM module is responsible for collecting the Hall signal and filtering it, and then sending the Hall signal to the SPE module. The SPE module controls the TOM module to output a fixed-phase PWM signal by judging the current Hall value, and this fixed phase is our A commutation table is pre-written in the SPE module during initialization. The specific workflow can be seen in the following figure:

▲ Figure 3.2 TIM module

▲ 图3.2 TIM模块

(1) TIM module

  TIM (Timer Input Module) module, timer input module.

  In our practical application, this module is mainly responsible for collecting Hall signal and braking signal, and the module has its own filtering function to ensure that the captured value is accurate. The TIM module will directly send the captured Hall value to the SPE module for subsequent processing.

  It can be seen from the above general working flow chart that the input of the TIM0 module has 8 channels, and we only used three to capture the Hall signal, and then sent the processed three-way Hall signal to the SPE0 module.

(2) SPE module

  SPE (Sensor Pattern Evaluation) module, sensor evaluation module.

  The SPE module is dedicated to evaluating the value of the current Hall signal, and according to the current Hall value to look up the table to control the output of the TOM module through the register, the specific control logic is shown in the following figure:

▲ Figure 3.3 SPE module

▲ 图3.3 SPE模块

  The three-way signal in the upper left corner is the signal sent after being filtered by the TIM module, and then saved by the NIP register (we can know the current Hall value by reading the NIP register), and then the three-way signal is sent to the Pattern for checking. The lookup table here is the corresponding relationship between the Hall and the output. For example, the actual value of the Hall is 1, and then the output value of the lookup table is 3, then the lookup table will be output again according to the Hall value output by the lookup table. Control value of the actual PWM. In the above figure, SPE_PAT_PTR is the corrected value output from the lookup table according to the actual Hall value, while SPE_OUT_PATx is the register value that controls the PWM output. The value of SPE_OUT_PATx is sent to the SPE_OUT_CTRL register according to SPE_PAT_PTR, and the subsequent output is to judge the content of the SPE_OUT_CTRL register to control Output of different ports.

  It is worth noting that the brake signal in the upper right corner is controlled by the FSOI. When the FSOI is valid, the final output will be modified to the output value of the FSOM register, and the FSOM register is what we gave it during initialization, we As long as the FSOM register is set to control all upper bridges to be turned off and all lower bridges to be turned on, then it is a normal braking effect.

(3) TOM module

  TOM (Timer Output Module) module, timer output module.

  The module will generate a PWM signal according to the set parameters, and output a PWM signal or a high and low level according to the output channel selected by the SPE module, thereby driving the brushless motor to rotate.

 

§ 04 Open Source Download


  The brushless motor drive open source hardware and software download links based on

https://gitee.com/seekfree/TC264_GTM_BLDC_Project

  Pack and download the open source library compressed package, and you can start playing brushless happily. Don't forget to give us a little star before downloading. Thank you for your support.

 

§ 05   Summary


  For the convenience of testing, the hardware of this open source project still uses the TC264 and the drive circuit on one board. Students can consider using the main control TC264 to control the drive output directly when making the board. The commonly used resources have also been avoided, that is, a TC264 is not only the main control of the car, but also the controller driven by the brushless motor, and as mentioned at the beginning of the article, the solution of using the GTM module to realize the brushless drive is also reduced. CPU consumption, and the board we tested uses MOS transistors in parallel for compatibility with larger currents, so you can also design halved according to actual needs, so that the driver board can be reduced by half, and it is also recommended. We use a TC264 to achieve the two requirements of brushless drive and main control, so as to adapt to the lightweight overall design of the balanced bicycle group.

  Therefore, the actual driver board corresponding to this open source project has not produced a learning board for sale. Currently, the brushless driver learning board sold by Zhufei is only the solution of CCU6, so students can directly design their own according to the schematic diagram of the open source project. .

  The brushless motor can use the model recommended in the Chasing Fly demo car model. As we mentioned in the open source solution of the off-road group, we have tested many motors. The balance group of the bicycle finally uses the same motor as the extreme-speed off-road group. , the open source project code and hardware are also tested with this motor as a sample.

  • The parameters of the motor are as follows : inductive, three slots and two poles, 2860Kv (Kv means the speed increased by the motor for each additional volt of voltage, up to 12V), size 36(mm)*50(mm), rated power 190W, support 1-3S lithium Battery powered.

▲ Figure 5.1 Balance bicycle driven by brushless motor

▲ 图5.1 无刷电机驱动的平衡单车

  Reminder: This motor is only recommended for ZFLY. Students can also choose the brushless motor that they think is suitable. There are no restrictions on this point, but it is recommended that you choose a brushless motor.

  The above open source projects have been carefully designed and coded by Zhufei, which is true and reliable. It was also explained in yesterday's live broadcast. You can watch the video through Zhufei B station. The balance bicycle group's Zhufei demonstration model is also used. This open source set The program is produced, which proves the feasibility of this open source program, and the rest is for everyone to use their own algorithms to the fullest. During the learning process, you can combine live video playback and previous related tweets to deepen your understanding. See the link and live playback link below:


● Links to related charts:

Guess you like

Origin blog.csdn.net/zhuoqingjoking97298/article/details/124357386