RTC Initialization issue with LPC4367

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTC Initialization issue with LPC4367

835 Views
gauravmore
Contributor III

Hi 

I am LPC4367 and I am testing internal RTC with my customize development board of my project. I am facing issue with RTC init . Follwing is the initialization sequence

Chip_Clock_RTCEnable();

/* 2-Second delay after enabling RTC clock */
LPC_ATIMER->DOWNCOUNTER = 2048;
while (LPC_ATIMER->DOWNCOUNTER);

/* Disable RTC */
Chip_RTC_Enable(pRTC, DISABLE);

/* Disable Calibration */
Chip_RTC_CalibCounterCmd(pRTC, DISABLE);

/* Reset RTC Clock */
Chip_RTC_ResetClockTickCounter(pRTC);

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

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

But when i runt the code in debug mode using LPClink2 , 

The program was unable to run through the do-while loop after the LPC_RTC->CCR |= RTC_CCR_CTCRST statement inside "Chip_RTC_ResetClockTickCounter(pRTC);"Then it crashed eventually. What is the problem? Please help!

But the same code when I run with the evaluation board OM13088 then it work fine. I have attached the project for your reference.

I also refered https://community.nxp.com/thread/438393 but there also no such solution found. 

Thanks, 

Gaurav More

Labels (2)
0 Kudos
5 Replies

644 Views
gauravmore
Contributor III

Hi,

Any input regarding the query ?. Please share the same since it is required in my project 

Thanks

Gaurav More

0 Kudos

644 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Gaurav More,

If the project can work well on demo board, while failed on your custom board,

I  think you need check your hardware, also I will use a LPClink2 to debug your project, will

tell you the result .ASAP.

BR

Alice

0 Kudos

644 Views
gauravmore
Contributor III

Hi Alice,

RTC Issue resolved.

 

I checked the hardware the compare it with eval board the problem was related to the crystal. It was connected in reverse. made the modification and checked. it is working .

Thanks 

Gaurav More

0 Kudos

644 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Gaurav More,

OK,thanks for your sharing, I have test your code on my side, it can work well.

BR

Alice

0 Kudos

644 Views
gauravmore
Contributor III

Hi Alice,

I checked the hardware of OM13088 with respect to the RTC Circuit and also compared it with the customized the board circuit. Check for the attached schematic for the same.

pastedImage_1.png

the controller used in the eval board is LPC4367JET100 and programming is done using the LPClink2 debugger.

Also the schematic of the customize board given below

pastedImage_2.png

The controller used is LPC4367JBD208E. But the same code is working fine with the eval board. also i tried to chec by shorting the crystal Y2 and checked whether it stuck in the code but it worked fine and I am able to reset the RTC using 

LPC_RTC->CCR |= RTC_CCR_CTCRST this statement while the same code stuck in thei line and the code crashes.

Let me know if I am missing any initialization routine. also one more thing I am using LPCLink2 debugger of OM13088 to debug my customize board.

Waiting for your reply. 

Thanks 

Gaurav More

0 Kudos