Motor Control Using eTPU Software Plugins on S32K39 Electrification MCUs

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

Motor Control Using eTPU Software Plugins on S32K39 Electrification MCUs

SimonZossak
NXP Employee
NXP Employee
2 0 535

Motor Control on S32K39 Using the eTPU

The Enhanced Time Processing Unit (eTPU) is a programmable I/O controller with its own core and memory system, allowing it to perform complex timing and I/O management independently of the CPU. The eTPU module is a peripheral for 32-bit S32K39 Electrification MCUs.

The eTPU is used as a co-processor, specialized for advanced timing functions, such as motor control.

It has 2 engines each with 32 channels. The eTPU core is capable of running at frequency up to 320MHz.

Fig. 1: Subset of S32K39 block diagram showing the motor control peripheralsFig. 1: Subset of S32K39 block diagram showing the motor control peripherals

S32K39's eTPU is the most advanced design we have had:

  • The highest clock frequency
  • The largest memory sizes
  • Supported by professional, production-ready, safety qualified, software drivers (early access release available, RTM release available from 07/2024)

 

eTPU SW Overview

Four plugins are available as Real-Time Drivers (RTD) to speed up enablement using the eTPU:

  • eTPU – provides initialization and configuration of the eTPU global setting, e.g. clocks.
  • MotorControl – provides main motor control functionality such as PWM generation, Analog Sensing, Resolver processing, Field-Oriented Control and Quadrature Decoder for encoder processing.
  • RDC Checker - Safety Mechanism for resolver position reading. RDC Checker algorithm runs on CPU and checks the resolver processing of the eTPU.
  • Pwm – provides general purpose PWM generation. The generation may be done either by the eTPU or other timer peripheral available on the MCU.

Fig. 2: eTPU SW Plugins as part of Real-Time Drivers (not a complete list)Fig. 2: eTPU SW Plugins as part of Real-Time Drivers (not a complete list)

 

Features of the eTPU SW Plugins

  • Production quality SW
  • Delivered as standard RTD plugins (free of charge to use)
  • EB Tresos/S32 Config Tool configuration with cross checking of user input
  • Increased safety level (ASIL D) due to RDC Checker usage
  • Development/runtime errors reporting via Default Error Tracer (DET)
  • Possible to use in Autosar®/non-Autosar environment
  • Possible to configure several motor control instances​
  • Arbitrary combination of motor control functions running on the eTPU and CPU
  • API for setting/getting physical quantities available for usage of relative interpretation (-1, 1) or absolute interpretation (thus set in Amps, Volts, rpm, etc.)
  • Controller parameters calculation by configuration tool (current and speed control)
  • Example application for S32K396 Motor Control Kit with 3-phase PMSM available

 

Function Blocks of MotorControl Plugin

MotorControl plugin provides several essential function blocks for motor control applications:

  • PWMM – Pulse Width Modulation dedicated for motor control application supports generating single or complementary signals for 3-phase motor. Frequency, deadtime, alignment and modulation are configurable.
  • AS – Analog Sensing function does the processing of raw values (e.g. currents and voltage) measured by ADC. It applies DC offset, gain (for scaling) and moving average filter (EWMA). Up to 8 signals can be configured.
  • RESOLVER – Resolver function does the processing of analog signals coming from position sensor. This data is measured with SD-ADC and filtered with CoolFlux DSP. The Resolver function includes sensor excitation, Angle Tracking Observer, diagnostics and angle extrapolation. The output of the function includes angle and angular speed of the rotor.
  • FOC – Field-Oriented Control function enables control of 3-phase permanent magnet synchronous motor. It implements scalar, voltage, current or speed control loop. The PI controller parameters are calculated by EB Tresos or S32 Config Tool based on required bandwidth. It also provides API for mechanical alignment of rotor position as part of the start procedure.
  • QD – Quadrature Decoder function does the processing of digital signals coming from encoder position sensor with possibility to configure number of pulses per revolution. Thus, it is an alternative to resolver sensor working with RESOLVER function.

 

eTPU SW Use Cases

1. PMSM field-oriented control running on the eTPU – CPU is fully offloaded and just provides required values of current and speed to the eTPU using MotorControl plugin API.

Fig. 3: Block diagram of motor control application with control running on the eTPUFig. 3: Block diagram of motor control application with control running on the eTPU

 

 2. I/O functions are running on the eTPU and FOC control is running on CPU.

Fig. 4: Block diagram of motor control application with control running on CPUFig. 4: Block diagram of motor control application with control running on CPU

Arbitrary combination of MotorControl functions running on the eTPU is possible. For example:

  • Analog Sensing and Resolver running on the eTPU. PWM may be provided by different peripherals.
  • Just Resolver on the eTPU. All other functions are provided by CPU and available peripherals.
  • Or others.

 

Motor Control Instances Concept

Each motor control instance can consist of one or more function blocks described above – PWMM, AS, RESOLVER, QD, PMSM FOC.

MotorControl plugin then supports configuration of one or more motor control instances, that may be unique. The most common usage would be dual PMSM motor control (configuration 1). Configuration 2 on the figure below shows 3 motor control instances processing signals for 3 physical resolver sensors.

Fig.5: Examples of possible MotorControl plugin configurationFig.5: Examples of possible MotorControl plugin configuration

 

RDC Checker Plugin

Resolver sensor as a source of motor shaft position is critical from a safety point of view. This plugin implements safety measures of motor position and speed calculated by Resolver eTPU function. Usage of this safety mechanism is needed for safety-critical motor control applications using this Resolver function. The RDC algorithm runs on a lockstep core independently of the eTPU Resolver processing. It checks plausibility of eTPU Resolver inputs, states, and outputs.

RDC Checker is capable to detect faults of:

  • Resolver device (mounted on motor shaft)
  • External circuitry
  • SoC IP modules: eTPU, SGEN, SDADC, CoolFlux DSP, DMA

Fig.6: Resolver processing running on the eTPU and RDC checker safety mechanismFig.6: Resolver processing running on the eTPU and RDC checker safety mechanism

 

Demonstration of eTPU SW Usage

More information can be found here:

nxp.com/S32K39-37

NXP Electric Vehicle Traction Inverter with S32K39

nxp.com/etpu

nxp.com/RTD