Other Parts Discussed in Thread: MSP430F6636, MSP430F5659
hi,
I am using internal RTC of MSP430F6636 micro controller in calender mode.
My code for writing and reading RTC is given below
RTCCTL01 |= RTCHOLD + RTCMODE;
RTCDAY = ucGbl_WrDate; // Write date
RTCMON = ucGbl_WrMonth; // Write month
RTCYEAR = ucGbl_WrYear; // Write year
RTCHOUR = ucGbl_WrHr; // Write hour
RTCMIN = ucGbl_WrMin; // Write minute
RTCSEC = ucGbl_WrSec; // Write second
RTCCTL01 &= ~(RTCHOLD);
After this i am reading RTC using following code
while(!( RTCCTL01 & RTCRDY )); // Wait for RTC to be ready for read
ucGbl_RdHr = RTCHOUR; // Read hout
ucGbl_RdMin = RTCMIN; // Read minute
ucGbl_RdSec = RTCSEC; // Read second
ucGbl_RdDate = RTCDAY; // Read date
ucGbl_RdMonth = RTCMON; // Read month
ucGbl_RdYear = RTCYEAR; // Read year
I have found that some times RTCRDY bit is not getting high.
so code gets stuck in while loop.
What can be reason for that ?