A Made IT project


http://www.made-it.com
info@made-it.com

BiSync, BSC

Introduction
BiSync or BSC is a half-duplex point-to-point contension type protocol, mostly used in IBM 3780 or 2780 applications. A derivative version is known as MSV from Siemens. All these data-link protocols are a subset of the standard 'Basic Mode Control Protocol'.

Description
The BSC protocol is used in a point-to-point connection between 2 block-oriented synchronous terminals. The basic transmission unit is a screen, where a special 'send' key is used to send the information of a complete terminal screen.

The transmission is based on the sending of special characters to control the data link. Below you'll find the table for both ASCII and EBCDIC Transmission Control Characters.

The connection can be described in 5 phases. Of which this document only describes 2, 3, and 4. The first phase is the one in which the modems connect. As soon as the connection is established (DCE Ready on a RS232 interface) phase 2 starts and after phase 4 the last phase (5) is tearing down the connection.

Synchronisation
The beginning of a transmission can be started with a leading PAD (a couple of 0's and 1's: 010101), which is used to sync the modems. They are not always used. What must follow are at least 2 SYN characters.
The trailing PAD that has to follow every transmission action consists of seven or eight consecutive 1's (FF or 7F).

Leading pad characters (could be sync characters, while trailing pad characters assure that the transmission is held long enough for the last critical character to have been received (usually an "FF" character).

Phase 2: Building the logical connection
The initiazing station sends a ENQ, which is answered by an ACK0, when the other station is ready to receive characters.

If the receiving station is not able to receive data, it will send a NAK. Another option is that the slave knows it can't recieve data now, but it will be in a short notice. Some slaves have the WACK character for this. It should be send within 2 seconds after the ENQ is received. The requesting station will reply with another ENQ. This can be repeated several times, dependend on the 'retry-counter' (0, 3, or 6 times).

After a NAK or the end of the 'retry-counter' the stations will continue with phase 4.

A last possible occurance in the reply scheme is the no-reply option. If this happens the sending station will send a ENQ after the 'receive time-out' has ended. Again the 'retry-counter' is responsible for if and how many times this is repeated.

But what happens if both stations send an ENQ at the same time? This is called 'contention'. The solution for this is that one of the stations has a higher priority then the other and is thus called the 'primary-station' which leaves the other as a 'secondary-station'. The difference between the two is that a primary-station has a shorter 'receive time-out.

The result of this is that the primary station resends its ENQ while the secondary station is still waiting on its response on a ENQ. So a ENQ response on an ENQ means that the station is secondary and it has to decide weather it is able to receive data (send ACK0, NAK, or WACK)

Phase 3: The transport phase
This is the phase in which the actual data transport is taking place. The sending station is called the master, and the receiving slave. A slave always listens to the master, and it is the master that decides when a connection needs to be broken down.

Every package that is transmitted is packed between an STX and an ETX character, followed by one (LRC-check) or two (CRC-check) BCCs (Block Check Character). After this (and the check on the receiving side) the slave will send an ACK.

The response on a received package (when everything is okay) is based Affermative Acknowledgement. Which means that the first package is replied with an ACK1 and the second with ACK0, and so on. This way missing packages can be detected easily.

On an BCC error a NAK is send.

Transmission modes

The sending of control characters
Before information is send it might be necessary to send a couple of control characters that sets the device in the right mode, like a printer control characters. To indicate that this 'special' information is being send it is preceded by a SOH character.
The sending of data
Next to the sending of plain ASCII or EBCDIC text, there is also the possebility of sending binary data. To realize this data is send in a so called 'transparency-mode'. Which means that every transmission control character is preceded by a DLE character. This way STX and ETX are always recognized as being control and not data characters. This however leaves the DLE character as a potential problem. To solve this every DLE that is in the transmitted data is followed by another DLE. So two DLEs in a row are reduced on the receiving end as one DLE of data.

Transmission problems/controls

No Reply
If the master does not receive any response from the slave within the receive time-out time (about 3 seconds), it will send an ENQ to request for a retransmission of the reply. Depending on the reply the following can be deduced:
If the reply is the same ACK as the former (e.g. both ACK0), then the master knows it has to resend it's data, apparently that data got lost.
If it receives another ACK then the former (e.g. ACK0 while the former was ACK1), it knows that the reply got lost and all is okay now, so it will send the next block of data.
Receiver delay
If the slave can't cope with the speed of the master is can send a WACK to deplay the sending of data to prevent buffer overflows. The procedure is identical as the one in phase 2.
Sender delay
If the master station can't present it's data as fast as the receiving end can it uses a TTD (Temporary Text Delay) character to hold the line (to overcome the non-activity time-out of the slave).
Actually a TTD is an illegal sequence of characters (STX, ENQ) on which the slave responds with a NAK. However if the TTDs continue to appear until the retry-counter has reached his end, the connection is lost anyway.
Abort
To abort a block that is already partially send the master sends ENQ, on this 'block abort' the slave responds with a NAK and drops all already received data (from this block).
If the master sends a EOT before a ETX is received by the station it means a 'station abort' and both stations will continue with phase 4.
Interrupts
If the slave no longer wants to be slave (for whatever technical reason) it has the ability to send an interrupt to the master. This 'block interrupt' can be accomplished in two ways, depending on the whish of the slave:
If the slave wants a complete end of the transmission it will end an EOT instead of an ACKn. This will result in both stations followin the phase 4 procedure. If the slave however wants to become master it will send an RVI instead of the ACKn. The master may send one more bloack to empty its buffers and then has to continue with the phase 4 procedure.

Phase 4: Breaking up the logical connection
If no more data is to be send the master will initiate the breaking up of the logical connection by sending an EOT. The slave has now the possibility to send a ENQ, if it has also something to send and everything starts in the opposite direction starting at phase 2.

For leased line connection phase 4 ends here. For dial-up connections however there will also be send an DLE, EOT (after some time to give the slave a possibility to become master). This last character sequence will disconnect the modem connection.

A last security mechanism also disconnects the modem connection when there is no line activity for more then 20 seconds.

Transmission Control Characters
Control Function ASCII Code EBCDIC Code
Character Hex* Character Hex
ACK 0 DLE, 0 10, 30 DLE, '70' 10, 70
ACK 1 DLE, 1 10, 31 DLE, / 10, 61
DLE DLE 10 DLE 10
DLE, EOT DLE, EOT 10, 04 DLE, EOT 10, 37
ENQ ENQ 05 ENQ 2D
EOT EOT 04 EOT 37
ETB ETB 17 ETB 26
ETX ETX 03 ETX 03
ITB US 1F IUS 1F
NAK NAK 15 NAK 3D
PAD DEL FF 'FF' FF
RVI DLE, < 10, 3C DLE, @ 10, 7C
SOH SOH 01 SOH 01
STX STX 02 STX 02
SYN SYN 16 SYN 32
TTD STX, ENQ 02, 05 STX, ENQ 02, 2D
WACK DLE, ; 10, 3B DLE, , 10, 6B
*The addition of parity may cause the transmitted ASCII character to differ from this chart.

SYN (Synchronous Idle)
Provides the hardware recognizable bit pattern rquired to establish character synchronization at the receiving adapter
ENQ (Enquiry)
Recognized as a request for a response, or a bid for line control. In some cases it may be used to signify an abnormal end of text or message 'abort'.
SOH (Start of Header)
Indicates the inclusion of auxiliary data preceding the message text.
STX (Start of Text)
Indicates the beginning of data in a block. STX may be preceded by a header. Directly behind the STX is the first character of the data field.
NAK (Negative Acknowledgement)
Indicates that there was an error in a data block. Also used as a response to a bid for line control to indicate a 'Not Ready' condition.
ETB (End of Transmission Block)
Indicates an end of data block, but more will follow. Is used to instruct the receiving unit to perform error checking and acknowledge.
ETX (End of Text)
Same as ETB, only no more blocks will follow.
EOT (End of Transmission)
Indicates that a station has no data to transmit.
DLE (Data Link Escape)
Multiple usage as a control character modifier.
ITB (End of Intermediate Transmission Block)
Same as ETB, except that the receiving statio will not acknowledge after the error checking.
ACK0, ACK1 (positive Acknowledgements)
ACK0 ackowledges 'even' numbered blocks (and as a positive response to a line bid) and ACK1 acknowledges 'odd' numbered blocks.
DLE EOT (Mandatory Disconnect)
Used on a dial-up line to indicate that the dialing unit is hangup and an instruction for the receiving unit to do the same.
RVI (Reverse Interrupt Request)
Transmitted instead of a positive acknowledgement to indicate the need to send a high priority message to the station in control of the line.
TTD (Temporary Text Delay)
Sent by a station in control, in response to a positive acknowledgement.

Resources:
http://www.ibm.com
IBM site