I'm trying to use the internal RTC clock module as per configuration below. Initialization seems okay.
But variable "date" does not increment seconds and so is the variable "mydate".
What could be wrong?
Here is my RTC config -
rtc_datetime_t date;
rtc_datetime_t mydate;
In Main
{
RTC_Config();
while(1)
{
RTC_GetDatetime(RTC,&date); // seconds should be incrementing at 1 sec rate but it doesn't
mydate = date;
}
}
void RTC_Config(void)
{
/* Enable the external RTC 32K Oscillator */
SYSCON->RTCOSCCTRL |= SYSCON_RTCOSCCTRL_EN_MASK;
/* Init RTC */
RTC_Init(RTC);
/* Set a start date & time */
date.year = 2019U;
date.month = 2U;
date.day = 9U;
date.hour = 9U;
date.minute = 0;
date.second = 0;
/* RTC time counter has to be stopped before setting the date & time in the TSR register */
RTC_StopTimer(RTC);
/* Set RTC time to default */
RTC_SetDatetime(RTC, &date);
/* Start the RTC time counter */
RTC_StartTimer(RTC);
}
-Gmk
Solved! Go to Solution.
Hi
I don't have exact your board, but I just tested your issue with my LPC54608 board.
I use mcuxpresso demo code under ..\LPC54608\SDK_2.5.0_LPCXpresso54608\boards\lpcxpresso54608\driver_examples\rtc
I commented
// RTC_EnableInterrupts(RTC, kRTC_AlarmInterruptEnable);
// EnableIRQ(RTC_IRQn);
Thus my code should be same as yours.
when I step over code, I can see RTC->COUNT value changed after "RTC_StartTimer()". So I can't reproduce your issue.
I would suggest you test the same demo code on your side, comparing the register setting of the demo with your working project to shoot trouble.
Have a great day,
Jun Zhang
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi
I don't have exact your board, but I just tested your issue with my LPC54608 board.
I use mcuxpresso demo code under ..\LPC54608\SDK_2.5.0_LPCXpresso54608\boards\lpcxpresso54608\driver_examples\rtc
I commented
// RTC_EnableInterrupts(RTC, kRTC_AlarmInterruptEnable);
// EnableIRQ(RTC_IRQn);
Thus my code should be same as yours.
when I step over code, I can see RTC->COUNT value changed after "RTC_StartTimer()". So I can't reproduce your issue.
I would suggest you test the same demo code on your side, comparing the register setting of the demo with your working project to shoot trouble.
Have a great day,
Jun Zhang
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Actually I forgot to mount capacitors near crystal section and thus not providing ground to it.
Now its working. I've already replied myself to the question about this and it is under moderation when I'm writing this.
Thanks anyway.
No worries. Its working. My mistake. I forgot to mount capacitors between crystal and ground.
That's ok. Thanks for your sharing. :-)
Hi ZhangJennie,
Can you help me with this one - https://community.nxp.com/thread/496377
Hi Manikata,
I checked internally that my colleague has taken your CAN transmission thread and is working on it. Don't worry.
Have a nice day,
Jennie Zhang