Extrapolate EDSADC Output Using Timestamp Information
This example shows how to use the Enhanced Delta-Sigma Analog to Digital Converter (EDSADC) block from Embedded Coder® Support Package for Infineon® AURIX™ TC3x Microcontrollers to determine the accurate EDSADC output using its timestamp information.
Introduction
The EDSADC continuously provides the conversion output after every successful analog-to-digital conversion of the analog input signal at an output rate. The output rate depends on the EDSADC 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 EDSADC block is used in applications such as motor control applications that demand the analog to digital conversion results at specific points of time (main program cycle or application rate) that lie between two regular outputs in the conversion cycle time. You can extrapolate the accurate conversion result at the main program cycle by utilizing the previous conversion result, timestamp information (time elapsed from the previous conversion result), and the output rate of the EDSADC block.
Prerequisites
Complete the following examples:
Required Hardware
Infineon AURIX TC375 Lite Kit
Micro-USB cable
Signal generator for analog signal generation
Hardware Connection
Connect the signal generator to AN0 pin (channel 3) of Infineon AURIX TC375 Lite Kit.
Available Models
The example includes the preconfigured model ExtrapolateEDSADCReadingsUsingTimestampInformation, which you can use for external mode of simulation.
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 conversion results at the main program cycle. The application rate in this model is 500 microseconds as the Initial frequency parameter of the PWM block in Hardware Mapping tool is set to 2 kHz.
You can calculate the output rate using this formula: (On-chip modulator clock frequency/Decimation factor)/Number of values to accumulate. 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 to produce conversion output at every 92 microseconds.
The PWM timer module triggers the timestamp circuit in the EDSADC block at every 500 microseconds to obtain the conversion output. This PWM signal acts as a gate to trigger main filter result interrupt service routine, which extracts the timestamp information of the last conversion output.
Using extrapolation algorithms and by utilizing the inputs of previous conversion output, output rate, and timestamp information, the 1-D Lookup Table block provides the accurate conversion output at every 500 microseconds.
Configure the Model
1. Open the ExtrapolateEDSADCReadingsUsingTimestampInformation 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™ TC3x.
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.
Monitor and Tune the Model
1. Open the ExtrapolateEDSADCReadingsUsingTimestampInformation model.
2. Complete the hardware connections.
3. Specify the COM Port. To see a list of available COM ports on your computer, select Start > Control Panel > Device Manager > Ports (COM &LPT).
4. In your Simulink model, press Ctrl+E or click Modeling > Model Settings to open the Configuration Parameters dialog box. Navigate to Hardware Implementation > Target hardware resources > Connectivity. Set Connectivity interface to Serial(ASCLIN0) for external mode.
5. On the Hardware tab, click Monitor & Tune to configure the model for simulation. At this point, your model runs on the Infineon AURIX TC375 Lite Kit and communicates with Simulink so that you can monitor and tune the parameters.
6. Observe the EDSADC output and extrapolated conversion output in the Display blocks of the model.
Other Things to Try
Run the example on different Infineon AURIX TC3x microcontrollers by changing the package class and pinout options and analyze the results.