© 2000 Ubicom, Inc. All rights reserved. - 9 - www.ubicom.com SX IrDA Virtual Peripheral Implementation AN16 3.3.2  Connection Set-up Once  a  primary  IrDA  device  has  discovered  a  another
device  it  can  open  a  connection  with  it  allowing  the  bi-
directional   transfer   of   reliable   data.   The   IrDA   Virtual
Peripheral is secondary only and so cannot initiate a con-
nection.
The request for connection frame (set-normal-response-
mode  SNRM  frame)  from  the  primary  IrDA  device  con-
tains   the   destination   32-bit   address,   its   own   32-bit
address, a 1 byte connection address, and a list of sup-
ported connection parameters.
If the destination address matches the 32-bit IrDA Virtual
Peripheral  device  address  then  a  connection  acknowl-
edge  frame  (unnumbered-acknowledgment  UA  frame)
will  be  sent  in  reply  indicating  the  actual  connection
parameters.  The  actual  connection  parameters  are  the
highest  commonly  supported  options  between  the  two
devices.
Once the UA reply frame has been sent by the secondary
station it applies the determined connection parameters.
The primary station receiving the UA frame will read the
connection parameters from the frame, apply them, and
reply with a receive-ready (RR) frame at the new speed.
The connection has now been established and data can
now be transferred.
3.3.3   Connection Parameters The main parameter that is negotiated is the baud rate.
The   IrDA   Virtual   Peripheral   supports   9600,   19200,
38400,  57600,  and  115200bps.  The  IrDA  standard  also
includes optional support for 2400bps only devices, but
this is not supported by the IrDA Virtual Peripheral.
All other parameters are set to the lowest values so they
do not need to be negotiated but instead can be sent as
fixed data (as suggested in the IrDA Lite documentation).
The window size is the maximum number of unacknowl-
edged data frames that can exist at one time. The IrDA
Virtual Peripheral does not buffer the data frames and so
negotiates  the  window  size  to  be  1.  This  means  that  a
station  can  only  send  1  frame  before  passing  control
back to the other station.
The  maximum  payload  data  size  is  set  to  the  minimum
(and default) of 64 bytes to avoid having to process and
remember  the  maximum  supported  size  of  the  initiating
station.
The minimum turnaround time should be sent as the cor-
rect time for the specific IR transceiver used. The value
transmitted is 5 ms and can be changed in the string seg-
ment  of  the  payload  layer  (plSNRMParam).  Related  to
the  turnaround  time  is  the  additional  BOFs  parameter.
This is a request for additional BOF characters to be sent
at the beginning of a frame to allow for a slow interrupt
response. The IrDA Virtual Peripheral does not process
or  store  the  minimum  turnaround  time  or  the  additional
BOF request from the initiating station but instead always
sends 10 ms worth of additional BOF bytes at the start of
each frame. The 10 ms time is the worst possible case so
that  the  IrDA  Virtual  Peripheral  can  communicate  with
any IrDA device however it should be possible to reduce
this time to 5 ms and maintain compatibility. The number
of additional BOFs sent can be changed in the lap layer
(lmpMinTurnaround).
The turnaround time is the maximum time a station can
have  control  of  the  IR  medium  before  passing  control
back to the other station. For “ASYNC” speeds (speeds
up to 115200bps) the turnaround time must be 500ms.
The link disconnect threshold time is the maximum time
to  wait  without  hearing  from  the  remote  station  before
assuming that the connection has been lost. The discon-
nect time is set to the minimum of 3 seconds.
3.3.4   Data Flow During a connection, only one frame will be sent by a sta-
tion before it passes control (permission to send a frame)
back   to   the   other   station.   The   passing   of   control   is
achieved  by  setting  the  “final”  bit  in  the  command  byte
and so this bit should be set for all frames. Any frames
received that do not have the final bit set will be ignored
as suggested in the IrDA Lite documentation.
One frame (S or I) will be sent from the primary station
and the control will be passed to the secondary station.
The secondary station will reply with one frame (S or I)
and pass control back to the primary station.
If there is data to be sent then an I frame will be sent. The
command byte of an I frame contains a 3 bit frame num-
ber  as  well  a  3-bit  acknowledge  number.  The  acknowl-
edge  number  is  used  to  confirm  the  receipt  of  frames
numbered up to but non including the acknowledge num-
ber. If there is no data to be sent then a S frame will be
sent. S frames do not contain data and so are not num-
bered, but do contain a 3-bit acknowledge number used
in a similar way as a I frame acknowledgment. If a error is
detected in a received frame then a S frame will be sent
in reply to explicitly reject the frame.
A connection can be maintained indefinitely without data
by use of S frames.
3.3.5   Disconnection The connection is disconnected by an incoming discon-
nect (DISC) frame from the primary station. Upon receipt
of  a  DISC  frame  the  default  connection  parameters  will
be  reinstated  (9600bps,  10  ms  minimum  turnaround).
The   secondary   can   send   a   request   disconnect   (RD)
frame if it wishes to disconnect which should result in a
DISC reply from the primary, however, the RD frame can
only be sent when the secondary station has control (i.e.
in its turn). The connection is also covered by a 3 second
watchdog  (WD)  timer.  If  no  valid  frames  are  received
within the 3 second timeout then the connection will be
assumed to be dead and will be handled in the same way
as for a received DISC frame.
3.3.6   Frame Structure Figure  3-4  shows  the  LAP  Frame  Format.  The  address
byte  consists  of  a  7  bit  connection  address  and  a  1  bit
command/response  bit  (LSB).  The  IrDA  Virtual  Periph-
eral  implementation  uses  an  8-bit  connection  address
register  and  will  only  accept  frames  with  the  matching
byte in the address field. When the LAP layer is idle (i.e.
the  normal-disconnect-mode  (NDM)  state)  the  connec-