CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC24EP512GP806 - RTCC implementation question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 575
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PIC24EP512GP806 - RTCC implementation question
PostPosted: Mon Apr 14, 2025 6:54 am     Reply with quote

Device: PIC24EP512GP806
Compiler: 5.116

Hi guys,

Two quick questions on whoever has used the RTCC module, this is my first time using it.....

Power:
If your whole circuit is powered off some external source such as a USB 5V adapter or whatever it may be, what battery backup mechanism did you implement to keep the RTCC running on the PIC when main power goes down? For instance, on a DS1307, there's a VBat pin to maintain the RTCC running off a coincell.... that's simple, easy to implement, reliable and effective. So how did you implement such feature on the PIC? I could technically use something like a TPS25942 IC like I've used in other designs but that's kind of overkill.

RTCC base clock:
The DS1307 uses an external 32.768KHz. For the PIC24, it uses SOSCO/SOSCI for the 32K so that the RTCC will keep running if the MCU reboots because using the PIC's primary clocking will screw-up the RTCC during reboot.... that's right?


Basically, as much as the RTCC feature is available on the PIC itself, considering that I'm not designing stuff for mass production therefore cost of components is not an issue, wouldn't it be just simpler to use the DS1307 with a coincell? I mean, the DS1307 only require a coincell and all parts cost less than 15$ of parts.

If I use the PIC's native RTCC feature, then I need to figure-out how to keep the RTCC running if main power goes-down therefore will require more parts for the 'battery backup' and presumably, this will also keep the entire MCU running therefore the entire circuit since there doesn't appear to be an external way to keep only the MCU's RTCC running, therefore, the backup will not be only a coincell but more like a 9V that will drain in no time vs a coincell which can last for much longer since it draws less than 500nA when running off the coincell....

Does this make any sense? I'm trying to see what will be the easiest to implement which will also be the most reliable.

Thanks,

Ben
Ttelmah



Joined: 11 Mar 2010
Posts: 19779

View user's profile Send private message

PostPosted: Mon Apr 14, 2025 10:27 am     Reply with quote

This chip is not one that supports a separate battery supply for the RTCC.

You have to keep the chip powered but program it down to low power
mode. It draws about 100uA in this mode, so it is not hard to keep
running for reasonable times, provided you design the supply so the chip
can be kept powered with the external circuitry mot supplied.
Relatively easy with a rechargeable battery to supply for days or weeks,
but if you want something that can run off a coin cell for years, then you have
to look at lower power solutions. For example an I2C clock chip are this
can be left running. There are other PIC's that do support a separate supply
connection for the RTCC, but they tend not to have the features of this chip.
benoitstjean



Joined: 30 Oct 2007
Posts: 575
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Mon Apr 14, 2025 10:51 am     Reply with quote

Alrighty, then I will continue with the DS1307 I2C chip.

Thanks.
temtronic



Joined: 01 Jul 2010
Posts: 9457
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Apr 14, 2025 5:07 pm     Reply with quote

Hay Ben
Why not upgrade ! DS3231 is a better RTC and WITH an AT24C32 EEP, coin holder, PCB for $1.50 CDN.
I've used a few years ago when I wanted a better RTC, havign the EEP was a bonus .

Just an option to think about ??

Jay
benoitstjean



Joined: 30 Oct 2007
Posts: 575
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Apr 15, 2025 6:25 am     Reply with quote

Hmmm.... I've already placed two orders for the DS1307 and DS1302, my boss is not going to be happy.... :(
benoitstjean



Joined: 30 Oct 2007
Posts: 575
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Apr 15, 2025 10:20 am     Reply with quote

So I have an MPL3115A2 I2C altimeter tied to the I2C bus alongside the DS1307.

The MPL is a 3.5V device, the DS is a 5V device.

I pulled-up the I2C lines to 3.5V using a 10K resistor.

The DS datasheet states that an logic input '1' is minimum 2.2V therefore being tied to 3.5V should work.

When the MCU boots, it sees the MPL but not the DS. I tried a second DS and same result. When I look at the logic analyzer, the DS just always returns 0xFF...

Anyone used them before with a 3.5V MCU? I've posted a message on the Analog Devices website since it's their part but just thought I'd check here as well since there are smart people on this board and it is tied to a PIC MCU and I may be doing something wrong.

Thanks!

Ben
temtronic



Joined: 01 Jul 2010
Posts: 9457
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 15, 2025 2:08 pm     Reply with quote

Make your boss happy, upgrade to the DS3231.
..it'll run at both 3 v and 5 v !!!
Also more accurate
so....
'time' to upgrade !!!
benoitstjean



Joined: 30 Oct 2007
Posts: 575
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Wed Apr 16, 2025 9:29 am     Reply with quote

Just ordered it. Thanks for the info.
temtronic



Joined: 01 Jul 2010
Posts: 9457
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Apr 16, 2025 2:58 pm     Reply with quote

GREAT, Now PLEASE order some warmth and sunshine !
Dang COLD,wet, windy, raw here in Hamilton..
cheers
Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group