Other Parts Discussed in Thread: C2000WARE
Hello,
I want to know if I need to call the SysCtl_deviceCal when I run my debugger with a flash config. The documentation of the driver lib says:
#ifndef _FLASH
//
// Call Device_cal function when run using debugger
// This function is called as part of the Boot code. The function is called
// in the Device_init function since during debug time resets, the boot code
// will not be executed and the gel script will reinitialize all the
// registers and the calibrated values will be lost.
// Sysctl_deviceCal is a wrapper function for Device_Cal
//
SysCtl_deviceCal();
#endif
But in a flash config _FLASH is defined, which is a little bit misleading and should probably set to the DEBUG?
Furthermore, I looked into the gel script containg:
OnFileLoaded(int nErrorCode, int bSymbolsOnly)
{
if (!bSymbolsOnly) {
Device_Cal();
}
}
Which again lead me to the question, is it called or not? When debugging and checking the differences between not calling and calling SysCtl_deviceCal _cal, I experienced following behavior:
If I call SysCtl_deviceCal(), ADCOFFTRIM is set. If I not call it, it is initially not set -> So it is not called.
But after starting my ADC modules after calliing the following c2000ware functions, the ADCCOFFTRIM register is set...
ADC_setVREF(…)
ADC_setPrescaler(ADCX_BASE, ADC_CLK_DIV_2_0);
ADC_setInterruptPulseMode(ADCX_BASE;ADC_PULSE_END_OF_CONV);
ADC_enableConverter(ADCX_BASE)
2) If I need to call it when using the debugger, is there any down side of always calling:
SysCtl_deviceCal();
3) After resetting the device, the calibration values should be loaded properly even with SysCtl_deviceCal(); commented out?
If this is the safe solution I would prefer to do it.
4) Technical Reference Manual (Rev. D) 13.11 ADC Calibration:
…
The boot ROM will call the calibration functions, so trim values should be initially populated without user intervention.
Where in the boot rom is it called? Could you tell me the line and the file?
Thanks in advance