# Sending and receiving FSK data

The ADI service is capable of sending and receiving frequency shift key (FSK) data. The transmit function is an implementation of the modem portion of Bellcore advisory TA-NWT-000030. The basic modulation is continuous-phase binary FSK at 1200 baud between 1200 Hz (mark) and 2200 Hz (space). The only supported baud rate is 1200.

This topic presents:

- Sending FSK data

- Terminating FSK data transmission

- Receiving FSK data

- Terminating FSK data reception

## Sending FSK data

To send FSK data, call adiStartSendingFSK.

While it is running, the FSK transmitter is in one of the following states:

- Idle

- Sending channel seizure

- Sending mark

- Sending data

An FSK transmission consists of a sequence of states used to transmit a data packet, and it is bracketed by silence or the idle state.

An FSK transmission with analog display services interface (ADSI) feature phones consists of the following sequence of data: sending mark, sending data. The sending channel seizure state never occurs in ADSI feature phones. Therefore, noseizureflag in the ADI_FSKSEND_PARMS structure must be set to 1.

### Parameters for sending FSK data

adiStartSendingFSK requires the following parameters defined in the ADI_FSKSEND_PARMS structure:

Field name | Description | Default value | Valid values
--- | --- | --- | ---
noseizureflag | 0: Allows send channel seizure state and sending mark state. 1: Allows only sending mark state. | 1 | 0, 1
level | Transmit output level. | -14 dBm | -
seizetime | Length of channel seizure in milliseconds; ignored if noseizureflag is set to 1. | 1000 | -
marktime | Length of initial mark signal in milliseconds. | 500 | -
baudrate | Transmission baud rate. | 1200 | 1200

## Terminating FSK data transmission

Use adiStopSendingFSK to stop the send function. The event value field contains CTA_REASON_STOPPED. The number of bytes sent before the function was stopped cannot be determined.

## Receiving FSK data

Call adiStartReceivingFSK to enable an application to receive FSK data. While it is running, the FSK receiver is in one of the following four states:

- Idle

- Receiving channel seizure

- Receiving mark

- Receiving data

A complete packet of FSK data consists of either of the following sequences:

- Receive channel seizure, receive mark, receive data

- Receive mark, receive data

During the receive process, errors can occur that cause the function to terminate prematurely. If errors occur, ADIEVN_FSK_RECEIVE_DONE is sent with one of the following reasons:

Reason | Description
--- | ---
ADI_REASON_DROP_IN_DATA | Stopped because of drop in data. The noseizureflag signal dropped to silence during data, not during stop mark period.
ADI_REASON_BAD_STOP_BIT | Stopped because of data framing error. The stop bit at the end of data was a space, not a mark.

### Parameters for receiving FSK data

adiStartReceivingFSK requires the following parameters defined in the ADI_FSKRECEIVE_PARMS structure:

Field | Description | Default value
--- | --- | ---
minlevel | Required minimum receive level. | -35 dBm
minmark | Required minimum initial mark and seizure time, in milliseconds. | 10
mindrop | Minimum dropout to silence before a packet is considered terminated, in milliseconds. | 5
baudrate | Transmission baud rate. | 1200

## Terminating FSK data reception

Use adiStopReceivingFSK to stop the receive function. The event value field contains CTA_REASON_STOPPED. The size of the partial buffer received is stored in the size field of the event structure.