I am Using LPC 4088. In which i have using inbuild RTC.The Code Working Properly but after a Removing of VBat. for testing i have Applied VBat Again but that Time RTC Not Working.on Same Code. Even I have reinnetialised RTC After this.So please send me Regarding Changes so that we Can Fixed this Problem.
Hello Victor,
This Issue is Purely based on Software.As RTC Module has Not Getting Supply From VBat and System Supply,RTC SFRs resets Their Value and SFRs get Froze. After Supply Provided to it. RTC will Not Functions Even After Reprogram its.So Problem is to resets all SFR and Re-initialization of RTC.I have Not Getting Code regarding this So Please Reply ASAP Regarding Changes in Code.
Thanking You
Hello chaitanya Kulkarni,
If everything is ok in the hardware then the problem is that you are not initializing the RTC again when you disconnect the system supply and Vbat. I took the the example periph_rtc of the LPCOpen mentioned before (LPCOpen Software for LPC40XX|NXP).
I modified the example to initialize the RTC and set the default hour and date when necessary. To know when I have to initialize the RTC I checked the bit '1' in the CCR register (Clock Control Register) using software. Please see image below, to understand why the bit 1 in the register CCR.
In the example, I added an if condition to check if the RTC need to be initialized then I call the function RTC_INIT and I set the default date and hour. If the RTC is enabled then I do nothing and continue with the program normally to avoid loosing the count of the RTC.
if( (LPC_RTC->CCR & 1) != 1)
{
Chip_RTC_Init(LPC_RTC);
/* Set current time for RTC 2:00:00PM, 2012-10-05 */
Chip_RTC_SetFullTime(LPC_RTC, &FullTime);
}
In the next image you can see the results of running the program.
Hope it helps!
Victor.
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello chaitanya Kulkarni,
I don't know if I understood you correct. When you connect VBAT again the RTC doesn't work at all anymore until you make a reset? Are you using any development board or a custom board?
Regards,
Victor.
Hello Victor,
We are using Custom board and Software Sample code is "LPC Embedded Artist Code".Code is not working After Reset or even after a Reprogram of system still RTC is Not Working.
Hello chaitanya Kulkarni,
Thanks for the reply and for clarifying the information. Are you using the code that is available in the following page: LPCOpen Software for LPC40XX|NXP ?
Since you are using a custom board I will need to take a look into the schematics to rule out hardware problems. A good idea will be to take a look into the schematics of the LPC4088 Experiment Base Board|NXP to use this as a reference to see if everything looks good in your schematics.
Regards,
Victor.
hi chaitanyakulkar!
have you solved?
I have the same problem... RTC get stucked and there is no way to reset it again...
I have the same probem :
with battery inserted sometimes i 'have RTC stuck ,
but the register CCR CLOCKENABLE == 1 is ok and data is ok
There is mode to starting RTC withouth remove battery ? i've also insert a code
https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4088-RTC/td-p/807756
that starting Intit rtc only if CCR bit 0 == 0 .
Now for re-starting RTC i need remove battery , power off and power on and Init_Rtc