From: ian Date: Sat, 17 May 2008 14:45:46 +0000 (+0000) Subject: ping/pong spots loopback X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=99c019e868ceb4207c87a38ac4a2889324e8a830;p=trains.git ping/pong spots loopback --- diff --git a/cebpic/README.protocol b/cebpic/README.protocol index abc89e8..f400d92 100644 --- a/cebpic/README.protocol +++ b/cebpic/README.protocol @@ -17,7 +17,7 @@ From host to PIC: > 1 0100 TTT 0 TTTTTTT (a0) POINT Point T fire > 1 1111 111 .... (ff) NMRADATA NMRA data - > 1 0001 XXX 0 XXXXXXX (88+) PING Ping `X' (please Pong `X') + > 1 0001 XXX 0 XXXXXXX (88+) PING Ping `X' (please Pong `X(+)0x5a') > 1 0010 RRR E RRR... (90+) POLARITY Set polarity > 1 0011 000 0 MMMMMMM (98+) WATCHDOG W'dog reset, t/o ms from now > 0 0010 001 (11) ON Power on @@ -61,7 +61,7 @@ From host to PIC: 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 0001 XXX 0 XXXXXXX (88+) PONG Pong `X' (reply to Ping `X(+)0x5a') < 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) @@ -117,19 +117,28 @@ should send FIXED but not fully reenable track power; track power should be reenabled when the host transmits ON. - Track and CDU Track and CDU - disabled -------ON-------> enabled - . __ __ - /|\ |`-._ ON ,-'| | - | `-._ ,-' |Short circuit detected - | OFF `-._ ,-' | - OFF| ,-' _ FAULT - | ,-' `-._ | - | ,-' `-._ V - ' ` - Track disabled Wait for post-fault - CDU enabled <-----500ms------ minimum off time - User Fault lit RETRIABLE + Track and CDU Track and CDU ----->-----. + disabled -------ON-------> enabled \ + . __ __ | + /|\ |`-._ ON ,-'| |,--------<-------. | + | `-._ ,-' | | | + OFF| OFF `-._ ,-' |Short | | + | ,-' _ FAULT| circuit | | + ,->-'| ,+' `-._ | detected | | + / | ,-' | `-._ V | | + | ' | ` | | + | Track disabled | Wait for post-fault | | + | CDU enabled <-----500ms------ minimum off time | | + | User Fault | RETRIABLE User fault | | + | flashes slowly | flashes rapidly | | + | / | | + \ ' | | + `----- Track disabled ---------------->-------------------' / + CDU enabled ----------------<----------------------' + User Fault lit WTIMEOUT watchdog timer runs out + + + If ON or OFF are issued in the first 500ms following a short circuit, @@ -173,8 +182,9 @@ PING and PONG ------------- The host may send PING at any time; the PIC should reply with PONG -with the same X as was in the PING message. The host may not send -another PING until the first one's PONG has come back. +with the same X as was in the PING message, but with the bottom byte +xor'd with 0x5a.. The host may not send another PING until the first +one's PONG has come back. POLARITY diff --git a/detpic/program.asm b/detpic/program.asm index 8f2595d..48180f1 100644 --- a/detpic/program.asm +++ b/detpic/program.asm @@ -179,7 +179,8 @@ command_ping mov_fw POSTINC0 mov_ff INDF0, t call serial_addbyte - mov_fw t + mov_lw 0x5a + xor_wfw t bra_n command_ping_bad goto serial_addbyte_another diff --git a/hostside/skelproto-pic.h b/hostside/skelproto-pic.h index 5232693..b4ff693 100644 --- a/hostside/skelproto-pic.h +++ b/hostside/skelproto-pic.h @@ -40,4 +40,6 @@ struct PicInsnInfo { extern const PicInsnInfo pic_command_infos[], pic_reply_infos[]; +#define PING_PONG_PATTERN 0x5a + #endif /*AUPROTO_PIC_H*/