Bootloader Features
www.ti.com
186
SPRUI07–March 2020
Submit Documentation Feedback
Copyright © 2020, Texas Instruments Incorporated
Boot ROM
2.2.14 ADC_cal Assembly Routine
The ADC_cal() routine is programmed into TI reserved OTP memory by the factory. The boot ROM
automatically calls the ADC_cal() routine to initialize the ADCREFSEL and ADCOFFTRIM registers with
device specific calibration data. During normal operation, this process occurs automatically and no action
is required by the user.
If the boot ROM is bypassed by Code Composer Studio during the development process, then
ADCREFSEL and ADCOFFTRIM must be initialized by the application. For working examples, see the
ADC initialization in C2000Ware.
NOTE: Failure to initialize these registers will cause the ADC to function out of specification. The
following three steps describe how to call the ADC_cal routine from an application.
Step 1. Add the ADC_cal assembly function to your project. The source is included in C2000Ware.
Example 2-5 shows the contents of the ADC_cal function. The values 0xAAAA and 0xBBBB
are place holders. The actual values programmed by TI are device specific.
Step 2. Add the .adc_cal section to your linker command file as shown in Example 2-6.
Step 3. Call the ADC_cal function before using the ADC. The ADC clocks must be enabled before
making this call. See Example 2-7.
Example 2-5. Step 1: Add ADC_cal.asm to the Project
;-----------------------------------------------
;This is the ADC cal routine. This routine is
;programmed into reserved memory by the factory.
;0xAAAA and 0xBBBB are place holders. The actual
;values programmed by TI are device specific.
;
;The ADC clock must be enabled before calling
;this function.
;-----------------------------------------------
.def _ADC_cal
.asg "0x711C", ADCREFSEL_LOC
.sect ".adc_cal"
_ADC_cal
MOVW DP, #ADCREFSEL_LOC >> 6
MOV @28, #0xAAAA
MOV @29, #0xBBBB
LRETR
Example 2-6. Step 2: Modify the Application Linker Command file to Access ADC_cal()
MEMORY
{
PAGE 0 :
...
ADC_CAL : origin = 0x380080, length = 0x000009
...
}
SECTIONS
{
...
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD
...
}