Main Content

Extrapolate Resolver Position Using Timestamp Information

This example shows how to use the timestamp information in the Resolver block from Embedded Coder® Support Package for Infineon® AURIX™ TC4x Microcontrollers to determine the accurate position of a resolver sensor.

Introduction

The Resolver block consists of two input DSADC channels (one for sine channel and one for cosine channel). The block continuously provides the position of the resolver sensor after every successful analog-to-digital conversion of the input signal at the output rate. The output rate or the resolver cycle time depends on the Resolver block parameters such as on-chip modulator frequency, decimation factor of the cascaded integrated-comb (CIC) filter, and the number of samples selected for integration, which you set in the Hardware Mapping tool. The resolver sensor is used in applications such as motor control applications that demand the resolver position results at specific points of time (main program cycle or application rate) that lie between two regular outputs in the resolver cycle time. You can extrapolate the accurate position at the main program cycle by utilizing the previous position result, timestamp information (time elapsed from the previous conversion result), and the output rate of the Resolver block.

Prerequisites

Complete the Getting Started with Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers example.

Required Hardware

  • Infineon AURIX TC4x - TriBoards

  • Micro-USB cable

Available Models

The example includes the preconfigured model tc4x_resolver_with_timestamp, which you can use for code generation.

The model comprises of the PWM block and a Hardware Interrupt block with the function call subsystem. This figure illustrates the function call subsystem.

  • The PWM block signifies the application demanding the resolver position results at the main program cycle. The application rate in this model is 250 microseconds as the Initial frequency parameter of the PWM block in Hardware Mapping tool is set to 4 kHz.

  • You can view the output rate of the resolver in the Output rate in seconds parameter of the Resolver block in the Timestamp tab of Hardware Mapping tool or you can calculate the output rate using this formula: Number of values for accumulation/(On-chip modulator frequency/Decimation factor). You can find the values of the three terms in the equation from the corresponding parameters in the Hardware Mapping tool. This model is configured for an output rate of 51 microseconds.

  • The PWM timer module triggers the timestamp circuit in the DSADC channel of the Resolver block at every 250 microseconds to obtain the position of the resolver sensor. This action triggers an interrupt service routine, which extracts the timestamp information of the last position output.

  • Using extrapolation algorithms and by utilizing the inputs of previous position output, output rate, and timestamp information, the 1-D Lookup Table block provides the accurate resolver position at every 250 microseconds.

Configure the Model

1. Open the tc4x_resolver_with_timestamp model.

2. Press Ctrl+E to open the Configuration Parameters dialog box. Click Hardware Implementation in the left pane and set Hardware board to Infineon AURIX™ TC4x - TriBoards.

3. Under Hardware board settings, expand Target hardware resources. Set the Series and Package class parameters to match your hardware.

4. Use the Hardware Mapping tool to observe the interrupts configured for the available blocks in this example.

Generate Code and Deploy Model to Target Hardware

Complete the following steps to generate code and run the model on the target hardware.

1. Open the tc4x_resolver_with_timestamp model.

2. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware.

3. Follow the build process by opening the diagnostic viewer using the link provided at the bottom of the model canvas. You can observe the code generation report that contains code for model traceability. Infineon AURIX deploys the model to the hardware using a downloading tool.

Note: You can ignore the model advisor warning message while trying to build the model.

4. Download and install the One Eye tool from Infineon to monitor signals from the hardware. Before using the One Eye tool, ensure that you download and install the latest version of the DAS tool.

5. Open the One Eye tool. Load tc4x_resolver_with_timestamp.OneEye file shipped with this example by clicking File > Load Configuration in the One Eye tool.

6. Load the tc4x_resolver_with_timestamp.elf file generated in Step 3 and observe the timestamp, resolver position (Theta_Value), and extrapolated resolver position (Theta_Timestamp) values.

You can observe that the available resolver position is 132.763 degrees, but the accurate resolver position after extrapolation is 127.491 degrees.