Loco Net n A network for controling n

  • Slides: 19
Download presentation
Loco. Net n A network for controling n model railroads by Stefan Bormann (stefan.

Loco. Net n A network for controling n model railroads by Stefan Bormann (stefan. bormann@gmx. de)

Contents n n n n Loco. Net? System overview. Physical layer Packet layer Application

Contents n n n n Loco. Net? System overview. Physical layer Packet layer Application layer – an overview Loco operation Example: FRED References.

1 a) System overview Loco. Net Command Station DCC C: > .

1 a) System overview Loco. Net Command Station DCC C: > .

1 b) What is Loco. Net? n invented by Digitrax n proprietory n Peer

1 b) What is Loco. Net? n invented by Digitrax n proprietory n Peer to peer n CSMA/CD n ~3 Layers.

2 a) Physical layer - electrical master any device +12 V 15 m. A

2 a) Physical layer - electrical master any device +12 V 15 m. A Net Ground 3 V RX TX.

2 b) Physikal layer - timing n n 16600 Baud, 60µs bit time 8

2 b) Physikal layer - timing n n 16600 Baud, 60µs bit time 8 N 1 60µs 600µs 1 0 Start D 0 D 1 D 2 D 3 D 4 D 5 D 6 D 7 Stop .

3 a) Packet layer Opcode Data . . . Check n bytes are transmitted

3 a) Packet layer Opcode Data . . . Check n bytes are transmitted back-to-back n packets consist of 2, 4, 6 or N bytes n first byte is „opcode“ n last byte is checksum (xor of all other bytes).

3 b) Opcode D 7 D 6 D 5 D 4 D 3 D

3 b) Opcode D 7 D 6 D 5 D 4 D 3 D 2 D 1 D 0 5 bits to encode 32 possible opcodes. 0 0 2 bytes 0 1 4 bytes 1 0 6 bytes 1 1 N bytes packet length (including opcode and checksum) always 1 (all other bytes have D 7=0)

3 c) Packet timing, net access 20 6 0. . 20 CD MD PD

3 c) Packet timing, net access 20 6 0. . 20 CD MD PD bit times n CD: carrier detect (defines end of packet) n MD: master delay (only master may transmit) n PD: priority delay (high prio. = small PD) .

3 d) Packet timing, collisions n n n Collisions are avoided, by shortening the

3 d) Packet timing, collisions n n n Collisions are avoided, by shortening the time between still observing the net is idle until the first bit is transmitted onto the net. Collision is detected, when a 0 is seen on the net, while a 1 is being transmitted On detection of a collision, a break (15 bit times 0) is transmitted.

4. Application layer -- an overview n n n turnouts signals message exchange decoder

4. Application layer -- an overview n n n turnouts signals message exchange decoder programming fast clock loco operation station local not used control locally well, interesting. . . YES Only limited mission for layout-wide Loco. Net.

5 a) Loco operation n n Table with loco data in command station Slot

5 a) Loco operation n n Table with loco data in command station Slot # = Index in table = Handle Slot # is a 7 bit number 128 Slots: 1. . 120 are loco slots u 0 dispatch slot u >120 are special slots (fast clock, programming) u n loco slots have fields:

5 b) Fields of a slot n n loco address (14 bits) state of

5 b) Fields of a slot n n loco address (14 bits) state of slot (free/common/idle/IN_USE) protocol selection (# of speed steps, . . . ) state of loco speed (7 bit) u functions (9 bits, F 0, F 1, . . . , F 8) u n n consist tree ID (14 bits, can be a device ID of controller)

5 c) Operations on slots (requests) n requests to master: OPC_LOCO_ADR: get slot by

5 c) Operations on slots (requests) n requests to master: OPC_LOCO_ADR: get slot by address u OPC_RQ_SL_DATA: get slot by slot # u OPC_WR_SL_DATA: write slot by slot # u OPC_MOVE_SLOTS: move slot from # to # u dispatch put (destination=0) F dispatch get (source=0) F NULL move (source=destination!=0) F u OPC_SLOT_STAT 1: modify slot status

5 d) Operations on slots (responses, operation) n responses from master: OPC_LONG_ACK: simple acknowledge

5 d) Operations on slots (responses, operation) n responses from master: OPC_LONG_ACK: simple acknowledge u OPC_SL_RD_DATA: slot data u n realtime operation OPC_LOCO_SPD: 7 bits of speed u OPC_LOCO_DIRF: direction and F 0, . . . , F 4 u OPC_LOCO_SND: F 5, . . . , F 8 u

6 a) FRED n n n FRemos Einfacher Drehregler Simple to use Can only

6 a) FRED n n n FRemos Einfacher Drehregler Simple to use Can only control one engine speed, u direction, u F 0, F 1, F 2. u

6 b) FRED: Example for protocol (acquire loco) master FRED Dispatch Get Slot Read

6 b) FRED: Example for protocol (acquire loco) master FRED Dispatch Get Slot Read NACK. Write Slot ACK

6 c) FRED: Example of protocol (reconnect) master FRED Get Slot By Address Null

6 c) FRED: Example of protocol (reconnect) master FRED Get Slot By Address Null Move Slot Read Write Slot if slot data changed ACK.

7. References n This clinic: http: //www. nord-com. net/ stefan. bormann/dcc_e. html n Digitrax

7. References n This clinic: http: //www. nord-com. net/ stefan. bormann/dcc_e. html n Digitrax homepage: http: //www. digitrax. com n Loco. Net-Hackers mailing list: http: //groups. yahoo. com/group/loconet_hackers.