chiark / gitweb /
Merge and end branch-hostside-wip-2008-01-25 PROPERLY; cvs up -j branch-hostside...
[trains.git] / cebpic / README.protocol
index cbe015bc05612c511e4f32a905262e03d06dedd0..5169771f37302f4419d0d091e9160e29f873c91f 100644 (file)
@@ -20,20 +20,24 @@ From host to PIC:
  > 1 0001 XXX  0 XXXXXXX  (88+)        PING      Ping `X' (please Pong `X')
  > 1 0010 RRR  E RRR...   (90+)        POLARITY  Set polarity
  > 1 0011 000  0 MMMMMMM  (98+)        WATCHDOG  W'dog reset, t/o <M*16>ms from now
- > 0 0100 001             (21) ON        Power on
- > 0 0100 000             (20) OFF       Power off
+ > 0 0010 001             (11) ON        Power on
+ > 0 0010 000             (10) OFF       Power off
 
- > 00000000                     CRASHED   Acknowledge panic, go to readout mode
- > 00000001                    ACKSERERR RS232 framing or overrung (panic'd)
+;> 00000000                     CRASHED   Acknowledge panic, go to readout mode
+;> 00001010               (0a) TELLMODE  Confirm mode - say HELLO or CRASHED
+;                                          if crashed, undoes the effect of ack
 
 ; In crash readout mode:
 ;
 ;      00000000  MS    Select crash readout mode if not already
 ;                      Reset crash readout pointer to 0
 ;
+;      00001000        Acknowledge RS232 framing error or overrun
+;      00001001        Reboot
+;
 ;      1vvvvvvv  M     Prepare byte 0vvvvvvv for transmission to the slave
 ;
-;      0000nnnn  M     (n>0) prepare to receive nnnn bytes from slave
+;      00000nnn  M     (n>0) prepare to receive nnnn bytes from slave
 ;      0001nnnn  M     (n>0) transmit nnnn bytes of our own from the
 ;                        readout pointer
 ;
@@ -56,9 +60,10 @@ From PIC to host:
 
  < 1 001Y SSS  0 SSSSSSS  (9?) DETECT    Train is (Y=1) or is not (Y=0) at S
  < 1 0001 XXX  0 XXXXXXX  (88+)        PONG      Pong `X' (reply to Ping `X')
+ < 1 100 0001  0 NNNNNNN  (ENQ) SPURIOUS  Number of spurious fault interrupts
  < 0 000 1001             (HT)  HELLO    I am booted
  < 0 000 1011             (VT)  AAARGH   Followed by debug chars (only)
- < 0 000 1101             (CR)  WATCHDOG  Timeout happenedbn
+ < 0 000 1101             (CR)  WTIMEOUT  Watchdog timeout happened
  < 0 000 0111             (BEL) FAULT    Fault exists
  < 0 000 0110             (ACK) FIXED    Fault now fixed
  < 0 0100 PPP             (20+)        POINTED   Point change done using capacitor P
@@ -122,6 +127,11 @@ should be reenabled when the host transmits ON.
                                      (User Fault indicator lit)
 
 
+If OFF is issued in the first 500ms following a short circuit, it will
+be ignored; if the short circuit persists, OFF during the following
+period will go to the `Track and CDU disabled' state without sending
+FIXED.
+
 
 POINTS and CDU
 --------------
@@ -151,6 +161,10 @@ not check that the received P value is 0; they may simply assume it).
        is recharging  <----POINTED----  Point is changing
 
 
+Note that OFF will turn the CDU off, and a short circuit (FAULT) will
+turn it off 500ms later (this delay avoids losing races where the host
+sends a point change instruction just before a short happens).
+
 
 PING and PONG
 -------------
@@ -180,7 +194,8 @@ Bits which do not correspond to defined reversal segments will be
 ignored by the PICs.  The host must send exactly as many bytes as are
 necessary to include all of the reversal segments for each reversers
 board (for every potential reversal segment, regardless of whether
-that segment is a defined segment corresponding to some actual track).
+that segment is a defined segment corresponding to some actual track;
+however a board with _no_ reversers segments used does not count).
 
 For example, if there are 14 reversible segments (numbered 1 to 14)
 then the following message