Driving a BLDC Motor with Infineon's TLE9879Qx 3-Phase Motor Driver Shield

Introduction

Use of brushless DC motors in industrial and automotive mechatronic applications continues to grow. Helping drive this growth is the performance and cost benefits of the electronics used to control the motors. A good example of this is Infineon’s highly integrated TLE9879QXA40 3-phase motor driver chip. This post highlights using Infineon’s BLDC_SHIELD_TLE9879 evaluation board to spin a BLDC motor.

Hardware

Hardware used in this project is Infineon’s BLDC_SHIELD_TLE9879 evaluation board, an Arduino Uno and Trinamic’s QBL4208-41-04-006 BLDC. The BLDC shield is compatible with an Arduino Uno and in combination they are used to drive the Trinamic 3-phase BLDC motor.

Figure 1 : BLDC_SHIELD_TLE9879

The shield contains Infineon’s TLE9879QXA40 3-phase motor driver and drive circuitry including six IPC90N04S5-3R6 NFETs to directly drive an external 3-phase BLDC motor. The shield’s TLE9879QXA40 comes flashed with several motor control algorithms (sensorless FOC, Back EMF, hall sensor based block commutation), and it is controlled from the Uno via SPI. The shield is powered by an external +12 VDC supply and the motor drive voltage supplied by the shield is also +12 VDC.
TLE9879QXA40 Details
The TLE9879QXA40 is a single chip 3-phase motor driver SoC that integrates an Arm® Cortex®-M3 core, six NFET drivers, and charge pump. Its peripheral set includes a current sensor, a successive approximation ADC synchronized with the capture and compare unit for PWM control and 16-bit timers. A LIN transceiver is also integrated to enable communication to the device along with a number of general purpose I/Os. It includes an on-chip linear voltage regulator to supply external loads.

Software

Arduino code on the Uno and the flashed TLE9879 shield code work together to control a BLDC motor. The Uno acts as a controller to send high level commands such as starting or stopping the motor over SPI to the TLE9879 mounted on the shield. The TLE9879 code translates the high level commands from the Uno to read/write parameters, control the LED and perform motor control functions.
Arduino
Infineon’s provided software library includes a complete set of commands including controlling the motor, setting motor parameters, loading/saving motor parameter sets and controlling a LED to test SPI communication. Each of the motor control algorithms has it’s own parameter set. The commands and motor control algorithm parameter sets are documented in the BLDC Shield with TLE9879QXA40 for Arduino User Manual. The Arduino library, example code and reference documentation are available on Github at the link in the below reference section.
TLE9879QXA40 Shield Motor Control Code
The TLE9879QXA40 code used in the shield is available as Keil uVision5 project files from Infineon. Four projects are included: Bootloader, HALL, FOC, and BEMF. The default motor parameters for each motor control algorithm flashed on the shield can be found in the source code for each of the algorithms. Once the source code files are downloaded and extracted the motor parameter foc_defines.h, bchall_defines.h, bemf_defines.h files can be found in each project directory (example: …\TLE9879 BLDC Shield\Infineon-BLDC_Shield-Software-v01_00-EN.zip\03_shield_software\uVision_project_files\FOC\RTE\Device\TLE9879QXA40). The project files and source code for the firmware flashed on the shield’s TLE9879QXA40 are included in the software download “BLDC Shield for Arduino with TLE9879QXA40” from Infineon at link BLDC_SHIELD_TLE9879 under “Tools & Software” as highlighted below:
image
(note: myinfineon.com access is required to download).

Test Driving a Motor

Trinamic’s QBL4208-41-04-006 was selected for the test drive since it’s one of the motors recommended by Infineon and is readily available at Digi-Key. The default motor parameters used in the provided motor control firmware flashed on the shield were used as a starting point for controlling the motor. The test motor’s datasheet needs to be reviewed for motor parameter values and shield parameters modified accordingly. Since the Trinamic motor includes hall sensors, sensorless FOC and Hall Block Commutation algorithms will be used to drive the motor. Note - You might have to adjust the motor parameters, in case the motor does not run properly.
Connecting the Uno, BLDC shield and motor
The shield needs to be mounted on the Arduino; shield L1, L2, L3 lines connected to L1, L2, L3 of the motor, motor hall sensor wires connected to the shield (for use with HALL algorithm): +12 VDC and ground connected to shield. During testing the Uno is connected over USB to a PC running the Arduino GUI.

Sensorless FOC
The below Arduino code is a simple example of selecting the FOC algorithm, modifying motor parameters, setting motor RPM, setting shield LED color, and then starting and stopping the motor.

bldc_shield_single_motor_test_FOC.ino

// Include the Shield library to your Arduino project
#include "TLE9879_Group.h"

// Declare Shield group object
TLE9879_Group *shields;
float shunt;

void setup()
{
	// Initialize the Shield group object with the
	// number of Shields in the stack
	shields = new TLE9879_Group(1);

	// Set the desired mode (FOC, HALL, BEMF)
	shields->setMode(FOC);

  //Set QBL4208-41-04-006 motor parameters
  shields->setParameter(FOC_R_PHASE,0.9, BOARD1);     //motor resistance (default 0.36)
  shields->setParameter(FOC_L_PHASE,0.0013, BOARD1);  //motor inductance (default 0.0002)
  shields->setParameter(FOC_NOM_CUR,2, BOARD1);  //nominal current (default 5)
  shields->setParameter(FOC_MAX_SPEED,4000, BOARD1);  //max speed  (default 2000 )
  shields->setParameter(FOC_START_CUR_IF,1, BOARD1);  //open loop start current (default 2)
  shields->setParameter(FOC_MIN_POS_REF_CUR,1, BOARD1); //closed loop low speed pos_rot current (default 3)
  shields->setParameter(FOC_MAX_POS_REF_CUR,2, BOARD1); //closed loop high speed pos_rot current (default 4)
  shields->setParameter(FOC_END_START_SPEED,2300, BOARD1); //open loop end speed (default 800)
  shields->setParameter(FOC_MAX_CUR_SPEED ,2500, BOARD1); //closed loop pos_rot switchover speed (default 1000)
  
	// Set the desired motor speed (RPM)
	shields->setMotorSpeed(3000);
	
	/*
	You might have to adjust the motor parameters,
	in case the motor does not run properly.
	*/
	
	// Enable and set LED to green, start the motor and let it run for 15 seconds,
	// then stop the motor
  shields->setLed(LED_ON, BOARD1);
  shields->setLedColor(COLOR_GREEN, BOARD1);
	shields->setMotorMode(START_MOTOR);
	delay(15000);
 
  shields->setMotorMode(STOP_MOTOR);  
}

void loop()
{
}

The shields default FOC motor control parameters can be found inside the foc_defines.h file located in Infineon’s FOC project file in the directory …\TLE9879 BLDC Shield\Infineon-BLDC_Shield-Software-v01_00-EN.zip\03_shield_software\uVision_project_files\FOC\RTE\Device\TLE9879QXA40 .

HALL Block Commutation
Below table shows Hall sensor connections between shield X15 connector and motor hall sensor leads during test.

X15 pin Motor Hall lead
1 - VDDext Red
2 - S2 Blue
3 - NC none
4 - S1 Green
5 - GND Black
6 - S0 White

The below Arduino code is a simple example of selecting the HALL algorithm, modifying motor parameters, set shield LED color, set motor RPM, and then starting and stopping the motor.

bldc_shield_single_motor_test_HALL.ino

// Include the Shield library to your Arduino project
#include "TLE9879_Group.h"

// Declare Shield group object
TLE9879_Group *shields;

void setup()
{
	// Initialize the Shield group object with the
	// number of Shields in the stack
	shields = new TLE9879_Group(1);


  // Set the desired mode (FOC, HALL, BEMF)
  shields->setMode(HALL);
  shields->setParameter(HALL_INIT_DUTY,30);     //set initial duty cycle (default 10)

  // Enable and set LED to blue, set RPM
  // then stop the motor
  shields->setLed(LED_ON, BOARD1);
  shields->setLedColor(COLOR_BLUE, BOARD1);	
	shields->setMotorSpeed(1500);
	
	/*
	You might have to adjust the motor parameters,
	in case the motor does not run properly.
	*/
  // Start the motor and let it run for 15 seconds,
  // then stop the motor
	shields->setMotorMode(START_MOTOR);
  
	delay(15000);

  shields->setMotorMode(STOP_MOTOR);  
}

void loop()
{
}

The shields default HALL motor control parameters can be found inside the bchall_defines.h file located in Infineon’s FOC project file in the directory …\TLE9879 BLDC Shield\Infineon-BLDC_Shield-Software-v01_00-EN.zip\03_shield_software\uVision_project_files\HALL\RTE\Device\TLE9879QXA40 .

Conclusion

The combination of the Arduino Uno and Infineon’s TLE9879 BLDC shield is an easy to use, low cost hardware platform to get started with trying out and experimenting with driving BLDC motors. Complete source code is also available to download as a reference/starting point for those interested in developing their own firmware.

References

Infineon BLDC_SHIELD_TLE9879 product page
Infineon TLE9879-BLDC-Shield github link
Infineon Source Code BLDC Shield for Arduino with TLE9879QXA40 available on myinfineon.com
Infineon TLE9879QXA40 product page
Trinamic QBL4208 series motor product page
Trinamic QBL4208-41-04-006 data sheet

Contact

Any questions or comments please go to our TechForum:

1 Like

I bought the parts listed here, but just realized there may be a mistake? The Shield is rated for 12Vs, but the motors are 24Vs? Is there something I’m missing?

1 Like

Hello @richard.savery,
The BLDC_SHIELD_TLE9879 shield is rated up to 28V, see BLDC_SHIELD_TLE9879 - Infineon Technologies. The motor is rated up to 24V but works fine at 12V in the Infineon example shown. 12V was probably chosen for the example since its a common automotive motor voltage.

1 Like

Hello @richard.savery,
I found additional information from Infineon on the BLDC shield supply voltage rating at FAQ BLDC motor shield with TLE9879QXA40 for Ardui... - Infineon Developer Community
The FAQ states “The board is capable of handling 24V, but it is not recommended to evaluate 24V truck applications since the IC is designed for 12V automotive applications.”

1 Like

Thanks so much for these fast responses.

Is it possible to read the real speed when using BEMF (no other position sensors connected)? Such a command doesn’t exist in the provided Arduino library.

Based on the information provided by Infineon, determining speed from BEMF is not a capability implemented in the Arduino library. I did find an unrelated general reference to determining BLDC speed from BEMF on a Stackexchange post microcontroller - BLDC speed and position from back-emf - Electrical Engineering Stack Exchange microcontroller - BLDC speed and position from back-emf - Electrical Engineering Stack Exchange .