Device API
µCon bus
General
The µCon bus is built as a current loop. Every device on it sends and receives on the same line. Transmission is half duplex, so only one transmitter may ever be active.
Transmission uses UART at a baud rate of 65200 baud, 8n1.
The checksum (CRC) is the XOR of every preceding byte.
Bus timing
The bus timing is set by the LoDi-Rektor. It also sends every command. A µCon device may only transmit once it has been addressed, and the answer has to come within 600 µs.
Commands that need no answer are sent twice, with a gap of 600 µs between the two packets.
If a slave does not know a command, or was not addressed, it has to ignore every byte that follows until a pause of 300 µs is detected in the data stream.
Packet needing no answer
| Rektor write | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rektor data | Header | Addr | 0..n x data | CRC | Header | Addr | 0..n x data | CRC | ||||
| Time | 600µs | 26µs | 160µs | 160µs | 0..n x 160µs | 160µs | 600µs | 160µs | 160µs | 0..n x 160µs | 160µs |
Packet needing an answer
| Rektor write | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rektor data | Header | Addr | n x data | CRC | ||||||||
| Slave write | ||||||||||||
| Slave data | Header | Addr | n x data | CRC | ||||||||
| Time | 600µs | 26µs | 160µs | 160µs | n x 160µs | 160µs | <600µs | 26µs | 160µs | 160µs | n x 160µs | 160µs |
General commands
General commands have to be understood and answered by every µCon device, although the answer may differ from device to device.
µCon Read Version
This command is sent by the LoDi-Rektor to identify a device newly detected on the bus.
The LoDi-Rektor sends:
| Header | Addr | CRC |
|---|---|---|
| 0xB0 | 1..63 | 0x00 .. 0xFF |
An addressed device answers:
| Header | Addr | Device type | Major | Minor | CRC |
|---|---|---|---|---|---|
| 0xB1 | 1..63 | 0x00 .. 0xFF | 0 .. 255 | 0 .. 255 | 0x00 .. 0xFF |
Device type:
- 0x01: µCon-Booster
- 0x02: µCon-Railspeed
- 0x03: LoDi-Booster
- 0x04: LoDi-CDE
- 0x05: LoDi-TrainSpeed
- 0x06: LoDi-Booster 10A
- 0x07: LoDi-Booster 20A
- 0x08: LoDi-DC-Car-Booster
µCon Device-Poll
This command is sent onto the bus by the LoDi-Rektor at regular intervals for every device address. An addressed µCon device has to answer it. That is how changes on the bus are detected.
The LoDi-Rektor sends:
| Header | Addr | CRC |
|---|---|---|
| 0xE1 | 1..63 | 0x00 .. 0xFF |
An addressed booster answers:
| Header | Addr | Status | Current 1 | Current 2 | CRC |
|---|---|---|---|---|---|
| 0xF2 | 1..63 | 0x00 .. 0xFF | 0 .. 255 | 0 .. 255 | 0x00 .. 0xFF |
The status is bit-coded.
