Reply to post

Helpful ReplyMCP79400 Backup Battery not working

Author
crashbang_proto
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/05/23 09:03:55
  • Location: 0
  • Status: offline
2015/07/09 12:45:34 (permalink)
0

MCP79400 Backup Battery not working

Hi
 
When removing and re-applying power to the MCP79400, registers are reset despite having the Backup Battery applied.
 
There are a number of other threads on this topic, but the initiators of the threads don't follow up, so I haven't found a resolution.
 
I have an MCP79400 connected to a backup coin cell as recommended in the datasheet (schematic attached).
I have written test code (attached) that, on startup:
- reads the RTCWKDAY register & prints value over UART
- sets the VBATEN bit of the register
- checks if OSCRUN bit of the register is set
- attempts to start the oscillator if OSCRUN not set
- in a loop reports the time over UART
 
On initial power-up, the following occurs (using UART to debug):
- RTCWKDAY register reads 0b00000001: VBATEN and OSCRUN not set
- after setting VBATEN, re-read the RTCWKDAY: value = 0b00001001
- VBATEN was successfully set; Oscillator was not started as OSCRUN not set
- oscillator then starts successfully
- time defaults to power-on values
 
After resetting the connected MCU (to force execution from beginning, no power is cut) I get:
- RTCWKDAY register reads 0b00101001: VBATEN and OSCRUN are set
- time is retained
 
Here's the odd thing: 
If I connect an FTDI USB-Serial board (only connecting RX/TX/GND), and I disconnect power, on reboot:
- RTCWKDAY register reads 0b00111001: VBATEN, OSCRUN and PWRFAIL are set - so it reports a power failure
- time is retained
 
If, while power is disconnected, I disconnect any of the FTDI pins, then all register settings are lost.
 
I'm at a loss... would appreciate any thoughts.
 
Thanks
Andrew
 
(oh, code is for Atmel ATmega328P MCU)
 
 
ric
Super Member
  • Total Posts : 22101
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: MCP79400 Backup Battery not working 2015/07/09 15:19:02 (permalink) ☄ Helpfulby crashbang_proto 2015/07/09 20:56:37
4.5 (2)
Sorry, I can't help you with the battery problem, I've never used that chip.
However
crashbang_proto
...
Here's the odd thing: 
If I connect an FTDI USB-Serial board (only connecting RX/TX/GND), and I disconnect power, on reboot:
- RTCWKDAY register reads 0b00111001: VBATEN, OSCRUN and PWRFAIL are set - so it reports a power failure
- time is retained
 
If, while power is disconnected, I disconnect any of the FTDI pins, then all register settings are lost.

That's easily explainable. The RX pin idles high, so current will be leaking into the MCU, and from there to the RTC chip, supplying enough power to keep the RAM contents alive, but low enough for it to register a "power failure".

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
crashbang_proto
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/05/23 09:03:55
  • Location: 0
  • Status: offline
Re: MCP79400 Backup Battery not working 2015/07/09 20:55:46 (permalink)
4 (1)
The RX pin idles high, so current will be leaking into the MCU, and from there to the RTC chip, supplying enough power to keep the RAM contents alive, but low enough for it to register a "power failure".

Thanks @ric - that makes complete sense, although I'm surprised at the size of leakage and/or the minimal current needed to keep the RAM alive.
 
Your comment, plus a night's sleep, have allowed me to solve the problem.  Head is hanging in embarrassment!  The negative terminal of the coin cell was not making solid contact with the pad on the PCB.  If I dislodge the cell from the holder slightly then all works.
 
I'm using an SMD holder, which uses a pad on the PCB to make contact with the negative terminal of the coin cell.  I guess the soldermask on the board is raised slightly above the HASL-finished pad, preventing contact being made - must be a matter of microns.  A classic case if not seeing what is in front of you - hopefully will help others.  Perhaps that's why the initiators of the other simiular threads suddenly went quiet!!
Guest
Quick Reply: (Open Full Version)
  Enter the random characters shown
Submit Post
Some restrictions apply to prevent link (URL) Spam.
URLs in messages, signatures, and PM's are removed unless you have ...
  • been a member for at least 0 day(s);
  • made a total of 0 post(s);
  • earned at least 0 point(s) for post scores (based on the ratings on your posts);
  • earned at least 0 reward point(s);
Jump to:
© 2018 APG vNext Commercial Version 4.5