![]()
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
APC's smart protocolCreditsThe APC UPS protocol was originally analyzed by Pavel Korensky with additions from Andre H. Hendrick beginning in 1995, and we want to give credit for good, hard work, where credit is due. After having said that, you will see that Steven Freed built much of the orginal apcupsd information file. [Comment inserted by Riccardo Facchetti]The start of this chapter of the apcupsd manual in HTML format was pulled from the Network UPS Tools (NUT) site. It has been an invaluable tool in improving apcupsd, and I consider it the Bible of APC UPS programming. In the course of using it, I have added information gleaned from apcupsd and information graciously supplied by APC. Hopefully, the additions made herein can benefit the original author and his programming project, and maybe some day, the Apcupsd project and the NUT project can join forces. DescriptionHere's the information on the elusive APC smart signaling protocol used by their higher end units (Back-UPS Pro, Smart-UPS, Matrix-UPS, etc). What you see here has been collected from a variety of sources. Some people analyzed the chatter between PowerChute and their hardware. Others sent various characters to the UPS and figured out what the results meant.RS-232 differencesNormal 9 pin serial connections have TxD on 3 and RxD on 2. APC's smart serial ports put TxD on pin 1 and RxD on pin 2. This means you go nowhere if you use a normal straight through serial cable. In fact, you might even power down the load if you plug one of those cables in. This is due to the odd routing of pins - DTR and RTS from the PC usually wind up driving the on/off line. So, when you open the port, they go high and *poof* your computer dies.Originally this evil hack was used to connect the UPS to the PC when this page was first being built. As you can see, I cheated and neglected the ground (only 2 wires!) and it still worked. This method can be used for playing around, but for professional systems this is obviously not a viable option. That hack didn't work out so well (damned cats), so it was retired quite awhile back. The most practical solution was to go out and BUY the DOS/Win version of PowerChute just for the black (smart) cable. I recommend doing the same thing if you actually care about this thing working properly. Of course, if you have one of the newer packages that came with PowerChute, you already have the cable you need. Diagram for cable hackersIf you are handy with cable creation tools, check out the 940-0024C clone diagram. That's the black "smart" cable normally provided with APC models sold after 1996. The loopback pins on that diagram are used to keep PowerChute happy by allowing cable detection. If you use the NUT apcsmart driver, those pins don't matter.Many thanks to Steve Draper for providing this scan. For additional information on cables, see the cables section of this manual. The Smart ProtocolDespite the lack of official information from APC, this table has been constructed. It's standard RS-232 serial communications at 2400 bps/8N1. Don't rush the UPS while transmitting or it may stop talking to you. This isn't a problem with the normal single character queries, but it really does matter for multi-char things like "@000". Sprinkle a few calls to usleep() in your code and everything will work a lot better.The following table describes the single character Code or command that you can send to the UPS, its meaning, and what sort of response the UPS will provide. Typically, the response shown below is followed by a newline (\n in C) and a carriage return (\r in C). If you send the UPS a command that it does not recognize or that is not available on your UPS, it will normally respond by "NA" for not available, otherwise the response is given in the "Typical results" column.
Dip switch info
Status bitsThis is probably the most important register of the UPS, which indicates the overall UPS status. Some common things you'll see:
Alert messagesThese single character messages are sent by the UPS any time there is an Alert condition. All other responses indicated above are sent by the UPS only in response to a query or action command.
Register 1All bits are valid on the Matrix UPS. SmartUPS models only support bits 6 and 7. Other models do not respond.
Register 2Matrix UPS models report bits 0-5. SmartUPS models only support bits 4 and 6. SmartUPS v/s and BackUPS Pro report bits 4, 6, 7. Unused bits are set to 0. Other models do not respond.
Register 3All bits are valid on the Matrix UPS and 3rd generation SmartUPS models. SmartUPS v/s and BackUPS Pro models report bits 0-5. All others report 0-4. State change of bits 1,2,5,6,7 are reported asynchronously with ? and = messages.
Interpretation of the Old Firmware RevisionThe Old Firmware Revision is obtained with the "V" command, which gives a typical response such as "GWD" or "IWI", and can be interpreted as follows:
Old Firmware revision and model ID String for SmartUPS & MatrixUPS
This is a three character string XYZ
where X == Smart-UPS or Matrix-UPS ID Code.
range 0-9 and A-P
1 == unknown
0 == Matrix 3000
5 == Matrix 5000
the rest are Smart-UPS and Smart-UPS-XL
2 == 250 3 == 400 4 == 400
6 == 600 7 == 900 8 == 1250
9 == 2000 A == 1400 B == 1000
C == 650 D == 420 E == 280
F == 450 G == 700 H == 700XL
I == 1000 J == 1000XL K == 1400
L == 1400XL M == 2200 N == 2200XL
O == 3000 P == 5000
where Y == Possible Level of Smart Features, unknown???
G == Stand Alone
T == Stand Alone
V == ???
W == Rack Mount
where Z == National Model Use Only Codes
D == Domestic 115 Volts
I == International 230 Volts
A == Asia ?? 100 Volts
J == Japan ?? 100 Volts
Interpretation of the New Firmware RevisionThe New Firmware Revision is obtained with the "b" command, which give a typical response such as "50.9.D" or "60.11.I", and can be interpreted as follows:
New Firmware revison and model ID String in NN.M.L is the format
where NN == UPS ID Code.
12 == Back-UPS Pro 650
13 == Back-UPS Pro 1000
52 == Smart-UPS 700
60 == SmartUPS 1000
72 == Smart-UPS 1400
where NN now Nn has possible meanings.
N == Class of UPS
1n == Back-UPS Pro
5n == Smart-UPS
7n == Smart-UPS NET
n == Level of intelligence
N1 == Simple Signal, if detectable WAG(*)
N2 == Full Set of Smart Signals
N3 == Micro Subset of Smart Signals
where M == Possible Level of Smart Features, unknown???
1 == Stand Alone
8 == Rack Mount
9 == Rack Mount
where L == National Model Use Only Codes
D == Domestic 115 Volts
I == International 230 Volts
A == Asia ?? 100 Volts
J == Japan ?? 100 Volts
M == North America 208 Volts (Servers)
EEPROM ValuesUpon sending a ^Z, your UPS will probably spit back approximately 254 characters something like the following (truncated here for the example):#uD43132135138129uM43229234239224uA43110112114108 .... It looks bizarre and ugly, but is easily parsed. The # is some kind of marker/ident character. Skip it. The rest fits this form:
Matrix-UPS models have ## between each grouping for some reason. Here is an example broken out to be more readable:
CMD DFO RSP FSZ FVL
u D 4 3 127 130 133 136
u M 4 3 229 234 239 224
u A 4 3 108 110 112 114
u I 4 3 253 257 261 265
l D 4 3 106 103 100 097
l M 4 3 177 172 168 182
l A 4 3 092 090 088 086
l I 4 3 208 204 200 196
e 4 4 2 00 15 50 90
o D 1 3 115
o J 1 3 100
o I 1 3 230 240 220 225
o M 1 3 208
s 4 4 1 H M L L
q 4 4 2 02 05 07 10
p 4 4 3 020 180 300 600
k 4 4 1 0 T L N
r 4 4 3 000 060 180 300
E 4 4 3 336 168 ON OFF
CMD == UPSlink Command.
u = upper transfer voltage
l = lower transfer voltage
e = return threshold
o = output voltage
s = sensitivity
p = shutdown grace delay
q = low battery warning
k = alarm delay
r = wakeup delay
E = self test interval
DFO == (4)-all-countries (D)omestic (I)nternational (A)sia (J)apan
(M) North America - servers.
RSP == Total number possible answers returned by a given CMD.
FSZ == Max. number of field positions to be filled.
FVL == Values that are returned and legal.
Programming the UPS EEPROMThere are at this time a maximum of 12 different values that can be programmed into the UPS EEPROM. They are:
The first two cases (Ident and Batt date) are somewhat special in that you tell the UPS you want to change the value, then you supply 8 characters that are saved in the EEPROM. The last ten item are programmed by telling the UPS that you want it to cycle to the next permitted value. In each case, you indicate to the UPS that you want to change the EEPROM by first sending the appropriate query command (e.g. "c" for the UPS ID or "u" for the Upper Transfer voltage. This command is then immediately followed by the cycle EEPROM command or "-". In the case of the UPS Id or the battery date, you follow the cycle command by the eight characters that you want to put in the EEPROM. In the case of the other ten items, there is nothing more to enter. The UPS will respond by "OK" and approximately 5 seconds later by a vertical bar (|) to indicate that the EEPROM was changed. AcknowledgementsThe apcupsd has a rather long and tormented history. Many thanks to the guys that, with time, contributed to the general public knowledge.
Pavel Korensky <pavelk@dator3.anet.cz>, 26 November 1999 additions by: Kern Sibbald <kern@sibbald.com> 21 December 1999additional credits by: Riccardo Facchetti 08 February 2000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||