RTC clock get time and date from LPC54618

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RTC clock get time and date from LPC54618

跳至解决方案
3,163 次查看
gmk1
Contributor III

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

标签 (4)
1 解答
2,877 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

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.
-------------------------------------------------------------------------------

在原帖中查看解决方案

6 回复数
2,878 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

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.
-------------------------------------------------------------------------------

2,877 次查看
gmk1
Contributor III

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.

0 项奖励
回复
2,877 次查看
gmk1
Contributor III

No worries. Its working. My mistake. I forgot to mount capacitors between crystal and ground.

0 项奖励
回复
2,877 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

That's ok. Thanks for your sharing. :-)

0 项奖励
回复
2,877 次查看
gmk1
Contributor III

Hi ZhangJennie,

Can you help me with this one - https://community.nxp.com/thread/496377 

0 项奖励
回复
2,877 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复