This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
After a write to RTCOCAL (Crystal Compensation) I need to apply/re-apply the temperature compensation via the RTCTCMP register, however according to the debugger (CCS10.1.0, MSP-FET430UIF) this write is failing....
bool RTC_C_setTemperatureCompensation(uint16_t baseAddress, uint16_t offsetDirection, uint8_t offsetValue) { while(!(HWREG8(baseAddress + OFS_RTCTCMP_H) & RTCTCRDY_H)) { ; } HWREG16(baseAddress + OFS_RTCTCMP) = offsetValue + offsetDirection; if(HWREG8(baseAddress + OFS_RTCTCMP_H) & RTCTCOK_H) { return(STATUS_SUCCESS); } else { return(STATUS_FAIL); } }
Does anyone have a clue to what is going on?
Best Regards
Carl
Hi Carl,
RTCOCAL is 'Key Protected'. First, RTCKEY must be written to unlock the RTC_C module.
Best regards
Christoph
Thanks Christoph
But I am aware of that, I can successfully write to RTCOCAL, that is not my issue... once I write to RTCOCAL, It would appear that I cannot write to RTCTCMP, or at least it does not update via the debugger.
Kind Regards
Carl
void RTC_C_setCalibrationData(uint16_t baseAddress, uint8_t offsetDirection, uint8_t offsetValue) { HWREG8(baseAddress + OFS_RTCCTL0_H) = RTCKEY_H; HWREG16(baseAddress + OFS_RTCOCAL) = offsetValue + offsetDirection; HWREG8(baseAddress + OFS_RTCCTL0_H) = 0x00; }
In the register view in CCS if you right click on RTCTCMP and select View memory at address it will open a memory view showing the memory that these registers are mapped to.
Do you see the expected values there?
Regards,
John
Hi John/Christoph.
Sorry for the delay in getting back to you, I got pulled off the RTC compensation task, and havent had the chance to get back to it till today.
The problem would seem to be related CCS 10.1 or perhaps a project file corruption. I have since updated to CCS 10.2.00009, and did a clean project creation and the problem has corrected itself.
Although the debugger does not extactly behave as outlined in the datasheet, I can now successfully modify the contents of RTCTCMP after I have modified RTCOCAL
Registers before Modification
RTCOCAL = 0x0000
RTCTCMP = 0xC000
Registers After write to RTCOCAL
RTCOCAL = 0x0010 (Memory contents match register contents)
RTCTCMP = 0x4010 (Note how RTCTCMP has not been 'reset' as it states in the datasheet)
Registers After write to RTCTCMP
RTCOCAL = 0x0010
RTCTCMP = 0xE007
Many Thanks for your support in this matter
Carl
**Attention** This is a public forum