Part Number: MSP432P401R
Hi,
I'm trying to calibrate the RTC Crystal Offset Error with the help of RTCCLK output. The measured value is 512,051Hz. This is measured with 3 different devices (R&S RTB2004 200MHz,WIKA Pascal-ET and Fluke 8846A). After setting the calibration value (-96) with help of the API function RTC_C_setCalibrationData the output frequency doesn't change constantly. Only if i use the maximum value of 240 there is a constant change in the measured frequency. Otherwise the frequency changes once in a while an then gets back to the uncorrected.
I also tried to do the calibration without the API calls with the same result.
During debug with CCS i can see the correct values in the corresponding register. After 60 seconds (calibration period according to SLAU356H) it is still no other frequency at pin RTCCLK (except when used 240/-240 as mentioned above).
This behavior is on my own board and also on two different MSP432P401R LaunchPad (Red Rev 2.1). The values for temperature compensation also don't work as i expect.
This are the relevant code parts
.... MAP_CS_setExternalClockSourceFrequency(32768, 48000000); counter=0; fehler=false; while((fehler==false) & (counter <= 1000)){ counter ++; MAP_CS_resetFaultCounter(CS_LFXT_FAULT_COUNTER); MAP_CS_clearInterruptFlag(CS_LFXT_FAULT); fehler = MAP_CS_startLFXT(CS_LFXT_DRIVE3); } .... if(config.freq_cal <0) { config.freq_cal=-config.freq_cal; //MAP_RTC_C_setCalibrationData(RTC_C_CALIBRATION_DOWN1PPM,(signed int)config.freq_cal); RTC_C->CTL0 = (RTC_C->CTL0 & ~RTC_C_CTL0_KEY_MASK) | RTC_C_KEY; RTC_C->OCAL = config.freq_cal + 0x0000; BITBAND_PERI(RTC_C->CTL0, RTC_C_CTL0_KEY_OFS) = 0; config.freq_cal=-config.freq_cal; } else { //MAP_RTC_C_setCalibrationData(RTC_C_CALIBRATION_UP1PPM,(signed int)config.freq_cal); RTC_C->CTL0 = (RTC_C->CTL0 & ~RTC_C_CTL0_KEY_MASK) | RTC_C_KEY; RTC_C->OCAL = config.freq_cal + 0x8000; BITBAND_PERI(RTC_C->CTL0, RTC_C_CTL0_KEY_OFS) = 0; }