Using RTC on LPC-Link2

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

Using RTC on LPC-Link2

1,697 次查看
mtenw
Contributor I

Hi all,

I have been trying to run the periph_rtc example on the LPC-Link2 (LPC4370) board but was not successful. So questions come up:

- Can we run periph_rtc example on LPC-Link2 board? Or it requires other board modification, perhaps adding an external oscillator?

- If RTC can be used on LPC-Link2 board directly. Can anybody kindly point out the tips?

Thank you in advance!

标签 (6)
0 项奖励
回复
5 回复数

1,105 次查看
gauravmore
Contributor III

Hi Mtenw,

I am using LPC4367 for my development and I also faced the same issue while executing  "LPC_RTC->CCR |= RTC_CCR_CTCRST statement"  it crashed eventually.

But then I found problem is in my customize board where the 32.768KHZ crystal required for the RTC was connected in reverse. So  modified the same and checked , now it is working.

I refered the schematic of OM13088 and replicated the same and now it is working fine.

Thanks 

Gaurav More

0 项奖励
回复

1,105 次查看
hmyoong
Contributor III

Hi:

  I was also want to use RTC on LPC-Link2.  I notice from the LPC-Link2 schematic (Revision C) that the VBAT pin is NOT connected VIO_3V3 but to GND via a capacitor.  I could not find C19 from the board.  Can NXP support verify this?

0 项奖励
回复

1,105 次查看
mtenw
Contributor I

This is the code to enable RTC, set time, and read time from it. I use the LPC-Link2 as the debug probe and connect to another LPC-Link2 board. The program was unable to run through the do-while loop after the LPC_RTC->CCR |= RTC_CCR_CTCRST statement. Then it crashed eventually. What is the problem? Please help!

Chip_Clock_RTCEnable();

delay(3000);

/* Disable RTC */
LPC_RTC->CCR &= (~RTC_CCR_CLKEN) & RTC_CCR_BITMASK;

/* Disable Calibration */
LPC_RTC->CCR |= RTC_CCR_CCALEN;

/* Reset RTC Clock */
LPC_RTC->CCR |= RTC_CCR_CTCRST;
do {
} while ((LPC_RTC->CCR & RTC_CCR_CTCRST) != RTC_CCR_CTCRST);

/* Finish resetting RTC clock */
LPC_RTC->CCR &= (~RTC_CCR_CTCRST) & RTC_CCR_BITMASK;
do {
} while (LPC_RTC->CCR & RTC_CCR_CTCRST);

/* Clear counter increment and alarm interrupt */
LPC_RTC->ILR = RTC_IRL_RTCCIF | RTC_IRL_RTCALF;
while (LPC_RTC->ILR != 0) {}

/* Clear all register to be default */
LPC_RTC->CIIR = 0x00;
LPC_RTC->AMR = 0xFF;
LPC_RTC->CALIBRATION = 0x00;

   
// Set time
Chip_RTC_SetFullTime(LPC_RTC, &FullTime);

// Enable RTC time counters
Chip_RTC_Enable(LPC_RTC, ENABLE);

// Read time
Chip_RTC_GetFullTime(LPC_RTC, &FullTime);

0 项奖励
回复

1,105 次查看
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Mtenw,

There are no special connection requirements to run this example but please notice that it will take a few seconds to fully initialize the demo and start running, this is due to the implementation of this RTC block in the 3-core system (many different timing domains) and due to the strong focus on low power implementation.

Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 项奖励
回复

1,105 次查看
mtenw
Contributor I

Hi Carlos,

Thanks for the reply, but unfortunately it did not help me much.

I do not find the periph_rtc example waiting for the RTC to be fully initialized. Also, the periph_rtc demo does not run through Chip_RTC_Init(LPC_RTC).

Can you tell me if the pseudo-code above is correct? When does the program need to wait a few seconds to fully initialize?

If any of my statements do not make sense or are incorrect, please point out the mistakes. Thank you.

0 项奖励
回复