ISR - Remote Bus
Preliminary Specification
Summary
The Inventio Software
standard interface for PCB's not in the same box.
The simplest possible design for a single master, multiple slave RS485 protocol.
A 5 way pluggable connector and 4 core screened cable links remote locations.
Maximum distance 1.0km.
Features
Simple, secure data transfer ( 16 bit checksum/CRC )
Deterministic - minimum number of state-machine states
32 bit data transfer, 8 bit address/control
"PC" Master plus up to 127 multi-dropped slaves
Synchronised for multiple packet transfers
One cable carries data and power.
Terminology
"PC" refers to the Master device on the bus (only one is allowed). This will often be a Personal Computer.
The Master has address 0.
"RU" refers to one of the Remote Units connected on the bus.
Each RU has a unique address from 1 to 127.
"CS" means CheckSum - in this case each byte is XOR'd in turn, starting with an initial value of hex 0FF .
"CRC" means Cyclic Redundancy Check - in this case a 256 byte table is used to give a value for each byte which is XOR'd in turn, starting with an initial value of hex 0FF .
"CRCx" means either CRC or CRC- ( its bitwise inverse ), according to the state of a flag which is toggled on every successful transfer ( including RU not ready exchanges ).
Protocol
Hardware
Dual twisted pair, screened cable ( 4 core + screen )
5 pin 0.2 inch pluggable terminal block :
Pin 1 = 0 Volts
Pin 2 = +12 Volts ( +/- 20% )
Pin 3 = RS485 -
Pin 4 = RS485 +
Pin 5 = Screen ( grounded at one or both ends )
Data Format
RS485 half-duplex operation at 38.4 kBaud, 1 start bit, 8 data bits,
1 stop bit, no parity.
Packet Structure
One 8 bit byte "U" is sent by the PC, the top bit of "U" is the -Read/Write bit , the rest is the channel number.
The addressed slave returns either U' = CRC(U) = value in 256 byte CRC look-up table at address U, or U'- = CRC(U)- , the same value bitwise inverted.
Three possible data transfers are then possible :
i) Remote Unit not ready for transfer ( 2 bytes )
PC : U
RU : U'-
ii) PC Read Transfer ( U bit 7 = 1 ) ( 8 bytes )
PC : U
RU : U' * C1 C2 C3 C4 CS CRCx
iii) PC Write Transfer ( U bit 7 = 0 ) ( 10 bytes )
PC : U C1 C2 C3 C4 CS CRCx
RU : U' * CS CRCx
Notes :
"CRCx" indicates either the CRC of the preceeding bytes or its bitwise inverse CRC- , alternating with each successful transfer to a given remote unit. At power-up, the PC will send CRC, and the Remote Unit will return CRC.
The CS and CRC calculations include the U' character returned by the RU, and all characters sent by either PC or RU since then. ( The line is half duplex...)
"*" above indicates an allowed time interval of 10 mS ( nominal ) for the RU to calculate the checksum/CRC and store/fetch the data.
Master PC Actions : Timeouts and error handling
The PC deals with all timeouts and errors.
All characters should be received not more than 1mS after their due time, with the exception of the two times marked with an asterix, which may take up to an additional 10mS.
The PC must check for the following four errors :
i) The PC times out, as described above.
ii) The PC receives a character other than U' or U'- after it sends a U.
iii) The PC receives an incorrect CS or CRCx value, or both.
iv) The PC receives CRC when it was expecting CRC- or vice versa, and the packets are out of sync. In the case of single packet transfers, this error can be ignored.
Any of the above four conditions cause an abort to the line "purge" routine ( PC sends six nulls ), then the PC must repeat the transfer, using the same state of CRCx .
All of the above conditions not occuring, the PC receiving a correct CS and CRCx means that the data has been successfully transferred.
Slave RU actions : Data Transfer
Three possibilities exist :
i) Remote Unit not ready - if a read is requested means that there is no change to report ( i.e. no key pressed). If a write, the destination is busy ( i.e. printer off line or buffer full ). RU returns the inverted value U'- and the transfer is complete.
ii) PC Read Transfer - After receiving U and returning U', the RU must fetch the requested data and calculate the CS/CRC and send 6 bytes to the PC. It has 10mS before starting to send the 6 bytes.
iii) PC Write Transfer - After receiving the U and returning U', the RU receives 6 more characters ( 4 data + CS + CRC ). If the CS and CRC are correct, the RU has 10 mS to store the data bytes and calculate the CS and CRC of all the characters sent by either the PC or the RU, from the U' inclusive. If the CS and/or CRCx sent by the PC is incorrect, the RU must send two nulls to the PC.
The RU must test for both CRC and CRC- being valid and return the same polarity of CRC.
For multiple packet transfers the RU should check the CRC polarity to ensure that packets are in sync.
The Remote Unit does not have to timeout.
This site designed with
a little help from:
HTML authoring tutorials