Tuesday, November 20, 2012

Switch On Switch Off and Sleep and Wake Up

Power Switch
It's been a while, since I switched on blog.  We make  SCADA technology which has to be there when the chips are down - powered down that is.  Something as simple as a Power Switch can create a whole design controversy.  This blog post is a discussion of how simple something like a Power Switch can get.

Front and centre on the SCD5200 CPU is a big red power switch. It has two states, On and Off.  What I like about this is that is means what it says.  When you switch it on.  Power is applied to the brain of the CPU and it's bus connectors and off you go things start up and operate.  Switch it off, and the power is disconnected again and everything goes dead. Or does it ?..

Clock Tick
When the power is off, and just pretend its black all around you.. if you listen closely you may be able to hear the real-time clock running. Of course it doesn't make much sound. At about -200dB and 14.3MHz or so you could be forgiven for missing it. The real-time clock keeps ticking over - it's crystal has some drift, but not so much so that when the power is switched on some time later, the clock is still reasonably valid.  What powers the clock ?.  Most of these units have either a backup battery, which will provide enough power to keep the clock going.  How long will it last ? Well some specifications say 3-6 months. So let's say 3 months without power, we would expect that when the winter is over, and we get the door open, that we might need to switch the power back on and that the clock should come up with a time within a few seconds of the real world time.

For an RTU, other things are important to remember when the power goes off. For example, security settings, IP addresses, which firmware version, special timers and counters. Special application states.  In order to manage this the SCD5200 for example has Flash RAM on board and Static Non-Volatile RAM which is kept powered by the backup battery when the power is down. The Flash RAM handles the file system, while the Non-Volatile RAM handles key data we don't want to lose track of.

Given some intelligence in the Power Supply design, it actually takes up to 2 seconds for the power to go off, after the switch is operated. This is to give time for diagnostics to be created and for the unit to shut down gracefully.

For many imbedded systems, there are a number of startup modes, which allow the unit to operate with gradually increasing levels of functionality.  The two primary modes which come to mind are:-
  • Bootstrap Mode
  • Running Mode
SCD5200 SEN...RST Toggle
A 3 position toggle SEN/.../RST switch was introduced some time back to enable the CPU to start up in one or two modes.  These being RUNNING or BOOTSTRAP mode. A RST command from the toggle switch sent the CPU back to the initialize state, regardless of the mode it was running in. A SEN[SE] command initiated from the toggle switch was applied immediately after an RST command to ensure that the Flash File System was disabled and thus allow the CPU to start and end up in BOOTSTRAP mode.

Depending on the 'Running' or 'Bootstrap' mode, a variety of functionality then becomes available as indicated in the figure 'Power State Diagram'.

Thus the simple Power Switch results in the initiation of a reasonably complex State diagram for the processor.  Keeping in mind the requirement to preserve key clocks, variables and logs on Power down, a battery backup is introduced which keeps power to a small component of RAM and the clock - all of which has to stay operable for several months - possibly at a very cold temperature. The quality of the remote terminal unit often depends on how practical it is in handling these particular state transitions.  This epic story is just one of many which describes some of the features of the CPU for the SCD5200.

As with all the blog postings, your commentary is welcome. Some of our best suggestions come from readers, particularly our own engineers and users who might like to see improvements for the next generation.  - Chris J Smith Nov 2012.

PS: I plan to rain hail or shine this every Tuesday henceforward. So look forward to weekly updates. Happy thanksgiving to all readers from North America. Hope you have a welcome break with your families. - CJS.

























No comments:

Post a Comment

Popular Posts