CCS Note 09: Lesson 4. ADC Setting And Application
Instruction
How to utilize CCS for configuring ADC and its basic applications
Environment
This document utilizes the following setup:
Operating System: Windows x64
Code Composer Studio Version: 11.2.0.00007
Development Board: LAUNCHXL-F28379D (STM320F28379D)
Tutorial List
Reference Materials
Register Data, System, and Module Details
TMS320F2837xD Dual-Core Delfino Microcontrollers Technical Reference Manual (Rev. I) (ti.com)
Pin Mapping
Module Memory & Flash Architecture
The TMS320F2837xD Architecture: Achieving a New Level of High Performance (ti.com)
Memory Allocation Setting
TMS320C28x Assembly Language Tools v22.6.0.LTS User’s Guide (Rev. Y) (ti.com)
Some Magic Bugs Records
TMS320F2837xD Dual-Core Real-Time MCUs Silicon Errata (Rev. M)
Import Example from C2000Ware
Example: CPU1 —adc_soc_epwm_cpu01.c (CPU1 means single core.)
Project Path: C:\ti\c2000\C2000Ware_4_01_00_00\device_support\f2837xd\examples\cpu1\adc_soc_epwm
Section 1. Basics Exercise
Set ADC module triggered by ePWM1 module. Connect the ADCINA0 pin to a signal generator, providing an input voltage of 0~3V. In the debug mode of CCS, use the continuous update mode of the watch window (expression view) to monitor in real-time the value read by the A/D register (0~3V analog input voltage corresponds to a digital value of 0~4095). And use the GPIO0 pin to measure the S&H + conversion time of SOC0.
Be careful if you use a power supply instead of a signal generator.
Be careful if you use a power supply instead of a signal generator.
Be careful if you use a power supply instead of a signal generator.
Hint
Utilize the interrupts of ePWM1 and ADC to measure the conversion time of the ADC.
Section 1.1 Introduction
Features:
12-bit (single-end) / 16-bit (differential)
4 ADC modules (ADCx, x=A-D)
Each ADC module has 16 independent channels.
All channels share the 16 configurable SOCs (SOCx, x = 0–15) per ADC.
Section 1.2 ADC Conversion Formula
From the user’s guide (for LaunchPad)
VREFHIx = 3V
VREFLOx =0V
Section 1.3 ADC Setting
adc_soc_epwm_cpu01.c (main function)
A. SOCx Trigger Source
B. SOCx Channel selection
C. ADC Module Clock Source
D. SOCx ACQS
Control sample and hold window length.
E. ADC Timing
ADC Interrupt Pulse Position
I. Early Interrupt Mode: the interrupt is triggered at S&H finish.
II. Late Interrupt Mode: the interrupt is triggered at the End Of Conversion (EOC).
F. ADC Interrupt
Section 1.4 SOC Priority
Section 1.5 Experiment Code
[Hidden] Do it yourself!!
[Hidden] Do it yourself!!
[Hidden] Do it yourself!!
Section 1.6 Experimental Results
From NTU EEPRO LAB 學弟 啟元
According to the datasheet, the Acquisition window (Sample and Hold time) can be calculated as (ACQPS + 1) multiplied by the System Clock (SYSCLK) cycle time. Therefore, the Sample and Hold time is approximately (14+1) * (1/10⁶) = 150ns. This allows us to estimate the time from ADC triggering to the completion of the conversion and the generation of an interrupt as approximately (430 + 150) * 10^-9 = 580ns.
Section 2. Advanced Exercise
Connect the ADCINA0 pin to a signal generator, inputting a voltage between 0 and 3V. Use the ePWM2 module, setting the switching frequency at 50kHz and operating in up-down count mode.
A. If the input voltage is between 0 and 1V, the Duty cycle of ePWM2A should be 30%.
B. If the input voltage is between 1 and 2V, the Duty cycle of ePWM2A should be 50%.
C. If the input voltage is between 2 and 3V, the Duty cycle of ePWM2A should be 70%.
Section 2.1 Experiment Code
[Hidden] Do it yourself!!
[Hidden] Do it yourself!!
[Hidden] Do it yourself!!
Section 2.2 Experimental Results
A. If the input voltage is between 0 and 1V, the Duty cycle of ePWM2A should be 30%.
When the input voltage is 494mV, which is less than 1V, the Duty Cycle is 30%.
B. If the input voltage is between 1 and 2V, the Duty cycle of ePWM2A should be 50%.
When the input voltage is 1.38V, falling between 1V and 2V, the Duty Cycle is 50%.
C. If the input voltage is between 2 and 3V, the Duty cycle of ePWM2A should be 70%.
When the input voltage is 2.29V, falling between 2V and 3V, the Duty Cycle is 70%.