PIC18F65K22 RTCC Slow in Sleep Mode

(instructions, reset, WDT, specifications...) PIC17Cxx, PIC18Fxxx

PIC18F65K22 RTCC Slow in Sleep Mode

Postby mayur.k.vadukul » Sat Jul 19, 2014 10:41 pm

Hi,

My RTCC module is using the LF-INTOSC of the PIC18F65K22. When the CPU is running, the RTCC is working correctly. i.e. the time calculation is accurate. However, when the PIC enters the SLEEP mode, it goes slow. The real time 1 sec = 2 second of the RTCC module.

For my application time accuracy is not significantly important and I am using RTCC only to wake up the CPU from sleep mode at various stages of my application.

To find out more, I have output the RTCC clock on the RTCC pin of the micro. I noticed when the CPU is running, it gives Appx 33KHz output but when it is in sleep mode it gives Appx 14KHz output, which explains why is it running slow.

Can anyone help me what settings determine the RTCC clock frequency in sleep mode?

Regards
mayur.k.vadukul
 
Posts: 6
Joined: Sat Jul 19, 2014 10:36 pm

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby Tom Maier » Sun Jul 20, 2014 2:21 pm

What value have you written to CONFIG3L <bit0>?
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby Tom Maier » Sun Jul 20, 2014 2:33 pm

Also, what do you have for REFOCON?
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby mayur.k.vadukul » Sun Jul 20, 2014 9:41 pm

CONFIG3L

Bit 0 = 0; RTCC uses LF INTOSC as reference clock

REF0CON

ROSEL = 1;
ROON = 0 ;
RODIV0 = 0 ;
RODIV1 = 0;
RODIV2 = 0;
RODIV3 = 0;

Regards
mayur.k.vadukul
 
Posts: 6
Joined: Sat Jul 19, 2014 10:36 pm

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby Tom Maier » Tue Jul 22, 2014 2:07 am

Check your REFOCON bits. You have selected external oscillator as source.

Also, ROSSLP bit needs to be set for sleep.
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby mayur.k.vadukul » Tue Jul 22, 2014 9:49 am

Thanks for the response.

I have tried ROSSLP = 1 but it did not make much difference. I have also tried to ROSEL = 0 and it did not work.

I assume since I sent Bit0 of CONFIG3L = 0, which is to use internal LF INTOSC as reference clock, REFOCON is insignificant. And since I am outputting the clock of the RTCC module to RTCC pin, I can monitor the clock of the RTCC module on the oscilloscope. When the CPU is running, it is 33-34KHz but when it is in sleep mode it is 14KHz. So there is the factor of 2 somewhere. I do not understand why my clock frequency from LF-INTOSC to RTCC is half in sleep mode?

Regards
mayur.k.vadukul
 
Posts: 6
Joined: Sat Jul 19, 2014 10:36 pm

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby Tom Maier » Tue Jul 22, 2014 12:45 pm

Can you post the code for all of your setup? Include fuse settings and init code for oscillator.
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby mayur.k.vadukul » Tue Jul 22, 2014 2:03 pm

Hi,

Please see the attached files.

I have created the project with all these files in MPLAB X with ICD3 and Hi-Tech Compiler.

Regards
Attachments
Files.zip
(27.83 KiB) Downloaded 300 times
mayur.k.vadukul
 
Posts: 6
Joined: Sat Jul 19, 2014 10:36 pm

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby Tom Maier » Wed Jul 23, 2014 1:02 pm

Well, I can't find the problem exactly, but I'm suspicious that during sleep mode the chip is changing over oscillators. It has two. That would explain the change in frequency.

Read over chapter 4 about the dual internal oscillator and switchover in sleep mode. It's pretty confusing. I wish they just had a chart of "what I want to achieve" vs. "how to set the registers".

Wish I could point it out for you exactly... it's a mind-bender to understand.
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products

Re: PIC18F65K22 RTCC Slow in Sleep Mode

Postby mayur.k.vadukul » Wed Jul 23, 2014 1:39 pm

I am baffled as well.

I am new to PIC but I have read the datasheet so many times and could not work out why it is slowing.

Another point being, it is LF-INTOSC which is used for RTCC and it does not have any prescaler or postscaler.

I can't get over the problem and is very annoying.

Thanks for your support.
mayur.k.vadukul
 
Posts: 6
Joined: Sat Jul 19, 2014 10:36 pm

Next

Return to 16-Bit Core

Who is online

Users browsing this forum: No registered users and 12 guests

cron