chiark / gitweb /
fixes and work in progress for I2C debugging
[trains.git] / cebpic / README.protocol
1 NMRA
2 ====
3
4 NMRA packets from the computer to the PIC should consist of 8-bit bytes.
5
6 bits 6-0 contain the data to be sent to the track
7 bit 7 is 1 if the byte is the last in the packet and 0 otherwise
8  
9 The first 14 data bits in the NMRA packet should be 1s.
10 (i.e. the first two complete bytes should be 01111111 01111111)
11 (packets beginning with some other sequence are reserved for non-NMRA messages)
12
13 Maximum NMRA message length = 15 bytes (i.e. 105 bits).
14 Messages longer than this will cause things to get confused at the moment.
15
16 baud rate 9600
17 most significant bit first
18 8n1
19
20
21 Flash memory ID locations
22 =========================
23
24 Byte 20 0000h
25                 bits 7-5        = 000
26                 bits 4-0        PIC number 
27                                 (guaranteed to be in range 0..31 inclusive)
28                 
29
30 Byte 20 0001h
31                 bit 7           1 for the main PIC (#0)
32                                 0 otherwise
33                 0-6             currently unused, set to 0
34
35
36 I2C
37 ===
38 (slave addresses will be 10xxxxx where xxxxx=PIC number above)