PC RTC does not run while PC is turned off - FIXED - Page 1
Forum section: electronics / projects

author: AndersJ
author_rank: Frequent Contributor
timestamp: July 04, 2016, 05:04:48 pm
content: The RTC seems to not run while the PC is turned off.As if the oscillator is dead.After setting the time, all is well while the machine runs.I don't know if the RTC is used while operating or if time is kept by software.If so, perhaps the RTC never runs at all.I have:- Checked the battery, it is OK.- Disabled and reenabled the RTC from within the system manager- Remove the battery a few minutes- Set the bios to its defaultsThe machine is a HP wx4600 workstation, Windows 10.The issue was identical previously under W7.Any ideas?

author: helius
author_rank: Super Contributor
timestamp: July 04, 2016, 05:09:37 pm
content: defective 32 kHz crystalIt is built into larger "Mostek Timekeeper" type devices, but may also be discrete

author: AndersJ
author_rank: Frequent Contributor
timestamp: July 04, 2016, 05:42:28 pm
content: Excellent suggestion, but no, unfortunately.It oscillates at 0,6 Vpp at 32768 Hz.

author: kfitch42
author_rank: Frequent Contributor
timestamp: July 04, 2016, 06:41:05 pm
content: Most OSes these days read the RTC on boot, and write to it at shutdown, and don't touch it inbetween.You have a couple of options if you want to really diagnose this thing:1) Boot a linux CD/usb image. (e.g. Knoppix)2) Note the reported time.3) Wait a bit just to be sure.4) Pull the plug from the wall (so it can't have a chance to touch the RTC).5) Boot linux again and note the reported time. If it hasn't changed much from (2) then it seems the RTC is just stuck. If it has updated, then perhaps there is something wrong with the powersupply doing something funny in standby?!?! Then again the backup battery should take care of that, right?!?Another option would be to directly access the RTC chip. I know how to do this in Linux, not so sure about Windows. Again, something like Knoppix might help here.Compile/run a quick and dirty program like this (this is just off the top of my head, so it might be a little off):// begin seconds.c#include <sys/io.h>#include <stdio.h>#include <unistd.h>int main(void) {// RTC and CMOS battery backed RAM are on ports 0x70 and 0x71// for more info seehttp://bochs.sourceforge.net/techspec/PORTS.LSTioperm(0x070, 0x2, 1);// address 0 is the RTC secondsoutb(0x70, 0);printf("Seconds: %d\n", inb(0x71));}// end seconds.c# #Compile the program# gcc -o seconds seconds.c# # Run it as root# sudo ./seconds# # wait a bit# sleep 10# # run it again# sudo ./secondsThis should see if the RTC is updating.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: July 04, 2016, 08:34:51 pm
content: @kfitch42:The code compiles without errors, and runs, but produces no output for me, just returns me to the command prompt. What am I doing wrong?This prints "test: 23"Code:#include <sys/io.h>#include <stdio.h>#include <unistd.h>int main(void) {ioperm(0x070, 0x2, 1);// outb(0x70, 0);// printf("Seconds: %d\n",inb(0x71));printf("test: %d\n", 23);}But this prints nothing, just returns me to the command prompt:Code:#include <sys/io.h>#include <stdio.h>#include <unistd.h>int main(void) {ioperm(0x070, 0x2, 1);outb(0x70, 0);printf("Seconds: %d\n",inb(0x71));printf("test: %d\n", 23);}

author: NiHaoMike
author_rank: Super Contributor
timestamp: July 04, 2016, 11:44:20 pm
content: There's already a command - hwclock - for interacting with the RTC.http://linux.die.net/man/8/hwclock

author: AndersJ
author_rank: Frequent Contributor
timestamp: July 05, 2016, 01:03:34 pm
content: I fixed it!I'm not absolutely sure what fixed this,but,it seems the RTC and the cmos ram might NOT be cleared/resetjust by taking out the battery for a few minutes.When I also pulled the mains cord, and had the battery out,then there were major Bios complaining about CMOS-setups being corrupt.With only the battery out I did not get theses error messages.After resetting bios settings, the RTC ran also while the PC was powered down.So,my follow up questions is:Is it reasonable to believe that on some machines,the CMOS RAM and RTC will be powered by the incoming mains,even when the PC is turned off?I can easily try this,but after a few hours of head scratching I prefer to notrisk ending up in a similar situation again.

author: Monkeh
author_rank: Super Contributor
timestamp: July 05, 2016, 02:09:50 pm
content: Quote from: AndersJ on July 05, 2016, 01:03:34 pmThis is standard practice, yes. Why drain your battery when you have a standby supply? All ATX supplies have a permanent +5V rail.

author: AndersJ
author_rank: Frequent Contributor
timestamp: July 05, 2016, 02:24:09 pm
content: When did this become "standard practice"?I have never seen this mentioned until today.All I've seen is "remove the battery and put it back after a few minutes"?

author: Monkeh
author_rank: Super Contributor
timestamp: July 05, 2016, 02:25:43 pm
content: Quote from: AndersJ on July 05, 2016, 02:24:09 pmUh.. since always. That instruction assumes you have alreadydisconnected the power supply. As you always should when working inside equipment unless you know exactly what you're doing (not knowing about +5VSB.. yeah.).

author: AndersJ
author_rank: Frequent Contributor
timestamp: July 05, 2016, 03:32:48 pm
content: I would like to think I know what I am doing after 40+ years in the electronics design business.Since I do "know", I compromise at times, and occasionally fall into traps like this one.It never occurred to me that the standby 5V is used for anything else,but for power on standby circuitry.Not a day without learning something new.Does anyone have a motherboard schematic diagram that illustrates howthe 5V standby voltage is gated with the battery to supply the RTC?

author: edavid
author_rank: Super Contributor
timestamp: July 05, 2016, 03:54:54 pm
content: Did you happen to notice the "clear CMOS" jumper posts next to the battery holder?

author: Jeroen3
author_rank: Super Contributor
timestamp: July 05, 2016, 04:04:08 pm
content: Quote from: AndersJ on July 05, 2016, 03:32:48 pmThe RTC is part of the power-on circuit. It is powered up to perform wake on alarm.Also powered up:The nic (wake on lan)The usb hub (wake on keyboard)That is condering you're at S5. Windows 8+ tries to not go that low unless you excplitely ask shutdown.

author: Monkeh
author_rank: Super Contributor
timestamp: July 05, 2016, 04:04:45 pm
content: Quote from: AndersJ on July 05, 2016, 03:32:48 pmFair enough. The 5V is usually regulated down to 3.3V, and then diode OR'd with the battery. Nothing runs off 5V directly these days!You'll also find the chipset fed by that 3.3V supply separately, as well as typically several other supplies (an ICH9 requires four different supplies in 'suspend' mode).Off the top of my head, a little googling will find an Abit IP35 Pro schematic (I happen to have a few of these, so that's one I know is around).

author: AndersJ
author_rank: Frequent Contributor
timestamp: July 05, 2016, 05:50:10 pm
content: Quote from: edavid on July 05, 2016, 03:54:54 pmYes, there are undocumented jumpers in the battery area.I did not however want to short them while power was on.There is a pushbutton, which did not work, at least not with the battery in place.I unplugged the power cord, removed the battery, shorted the jumpers, and pressed the button.Not sure if any of these actions where redundant, but after this, the RTC runs during power down.

author: Jeroen3
author_rank: Super Contributor
timestamp: July 05, 2016, 06:19:20 pm
content: You can use the jumpers with the battery inserted. Some motherboards have reset buttons, this suggests unplugging the power supply is not required either.Just don't do it when the system is on or hibernating.