Sicherung von Rechnern in TCP/IP

Download Report

Transcript Sicherung von Rechnern in TCP/IP

LocoNet
A network for controling
model railroads
by Stefan Bormann
([email protected])
Contents







LocoNet? System overview.
Physical layer
Packet layer
Application layer – an overview
Loco operation
Example: FRED
References.
1a) System overview
LocoNet
Command
Station
DCC
C:>
.
1b) What is LocoNet?

invented by Digitrax

proprietory

Peer to peer

CSMA/CD

~3 Layers.
2a) Physical layer - electrical
master
any device
+12V
15mA
Net
Ground
3V
RX
TX
.
2b) Physikal layer - timing


16600 Baud, 60µs bit time
8N1
600µs
60µs
1
0
1
0
Start D0 D1 D2 D3 D4 D5 D6 D7 Stop
.
3a) Packet layer
Opcode
Data
...
Check

bytes are transmitted back-to-back

packets consist of 2, 4, 6 or N bytes

first byte is „opcode“

last byte is checksum (xor of all other bytes).
3b) Opcode
D7 D6 D5 D4 D3 D2 D1 D0
5 bits to encode 32
possible opcodes.
0
0
0
1
2 bytes
4 bytes
1
0
6 bytes
1
1
N bytes
packet length
(including opcode and checksum)
always 1 (all other bytes have D7=0)
3c) Packet timing, net access
20
6
0..20
CD
MD
PD
bit times

CD: carrier detect (defines end of packet)

MD: master delay (only master may transmit)

PD: priority delay (high prio. = small PD)
.
3d) Packet timing, collisions



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






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 LocoNet.
5a) Loco operation




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
 0 dispatch slot
 >120 are special slots (fast clock,
programming)


loco slots have fields:
5b) Fields of a slot




loco address (14 bits)
state of slot (free/common/idle/IN_USE)
protocol selection (# of speed steps, ...)
state of loco
speed (7 bit)
 functions (9 bits, F0, F1, ..., F8)



consist tree
ID (14 bits, can be a device ID of controller)
5c) Operations on slots
(requests)

requests to master:
OPC_LOCO_ADR: get slot by address
 OPC_RQ_SL_DATA: get slot by slot #
 OPC_WR_SL_DATA: write slot by slot #
 OPC_MOVE_SLOTS: move slot from # to #

dispatch put (destination=0)
 dispatch get (source=0)
 NULL move (source=destination!=0)


OPC_SLOT_STAT1: modify slot status
5d) Operations on slots
(responses, operation)

responses from master:
OPC_LONG_ACK: simple acknowledge
 OPC_SL_RD_DATA: slot data


realtime operation
OPC_LOCO_SPD: 7 bits of speed
 OPC_LOCO_DIRF: direction and F0, ..., F4
 OPC_LOCO_SND: F5, ..., F8

6a) FRED



FRemos Einfacher Drehregler
Simple to use
Can only control one engine
speed,
 direction,
 F0, F1, F2.

6b) FRED: Example for protocol
(acquire loco)
master
FRED
master
FRED
Dispatch Get
Dispatch Get
Slot Read
NACK.
Write Slot
ACK
6c) FRED: Example of protocol
(reconnect)
master
FRED
master
FRED
Get Slot
By Address
Null Move
Slot Read
Slot Read
Write Slot
if slot data changed
ACK.
7. References

This clinic:
http://www.nord-com.net/
stefan.bormann/dcc/dcc_e.html

Digitrax homepage:
http://www.digitrax.com

LocoNet-Hackers mailing list:
http://groups.yahoo.com/group/loconet_hackers.