© 2000 Ubicom, Inc. All rights reserved.
- 21 -
www.ubicom.com
SX IrDA Virtual Peripheral Implementation
AN16
4.0
Sample Applications Using the Virtual Peripheral
The IrDA Virtual Peripheral can be used in two different
scenarios: for communication with another SX running
the Virtual Peripheral or with a Windows 95 computer (or
similar) with an IrDA port. The next two sections describe
three demonstrations of the Virtual Peripheral in these
two scenarios.
Note:Since the Virtual Peripheral complies with the IrDA
standard it will communicate with any other IrDA compli-
ant device (such as a 3Com PalmPilot or digital camera).
For this to be useful, the other device would also need to
support IrComm (there are many high protocols at the top
level of the IrDA stack and all are optional) or the SX
would need to support the particular protocol used by the
device.
4.
1
SX TO WINDOWS COMMUNICATION (IRCOMM)
4.1.1 Transparent IrComm Application Description
The Transparent IrComm sample application connects
the Debug UART port to the IrComm virtual COM port of
a PC using the IrDA IrComm reliable connection based
protocol. Once a connection has been established by the
PC any characters sent down the PCs virtual com port
will appear out the SX Debug port and vice-versa.
The application does not buffer the data and does not
send the valid/error messages out the debug port. In the
rare case that an error occurs both the corrupt data and
the valid data will be displayed. All frame errors, transmit
not-acknowledges, and receive frame numbering errors
will still be shown on the ERR LED.
The application cannot transmit data until it has control of
the IR link and so any characters received down the
debug port for transmission must be stored until trans-
mission is possible. To achieve this the application
includes an 8-byte buffer for data pending transmission.
4.1.2 SX to PC IrComm Application Description
The SX to PC IrComm sample application will respond
to user commands entered into a terminal window con-
nected to the virtual IrComm port of the PC. The SX will
respond as follows:
? will return the text string SX IrComm Terminal to the
user.
c will return the value of port c (raw byte) to the user.
r will return the 128 byte general register file (raw
bytes) to the user.
The application is completely reliable in that it will cor-
rectly discard invalid received data and will correctly re-
send any transmitted data as requested.
4.1.3 IrComm requirements
MS Windows 95/98 machine.
Infrared IrDA port.
Infrared drivers installed
(The Windows 95 IrDA driver can be found at
www.microsoft.com/windows/95downloads/).
A serial connection to the SX if debug is of interest (The
serial cable should be a straight-through cable with at
least TX, RX, and GND connections.
Windows terminal software capable of connecting to
the IrDA virtual com port.
Note:Windows 95 HyperTerminal can only connect to
COM1-4 and if the PC has a physical COM4 then the vir-
tual com port will be higher.
4.1.4 IrComm Operation
Double-click on the Infrared icon in control panel to
show the Infrared window.
Under Options ensure that Search for devices in
range is selected (typically every 3 seconds).
Under Options note the Providing application support
virtual LPT and COM port numbers.
Open a terminal program for the debug on the appro-
priate COM port at 115200,n,8,1, no handshaking.
Power up the SX. Power is indicated by the PWR
LED.
The Infrared monitor should indicate that there is a de-
vice in range called SX IrComm Device
The IR RX indication LED should be indicating received
data about every 3 seconds. The IR TX indication LED
should flash at a random interval into the RX phase in-
dicating a reply in a random slot number.
Open another terminal program for the IrDA virtual com
port. Use the application support COM port number
noted from the Infrared monitor with any parameters
(they are irrelevant). Note that Windows does not make
these virtual ports available to a DOS window.
The Infrared monitor should say Communicating with
Name: SX IrComm Device, Description: SX IrDA Ir-
Comm Demonstration, Good at 115.2 kbps.
If the ShowConnect debug is enabled in the SX code
then the debug window will show a [when the connec-
tion has been established and a ] when the connection
has been terminated or lost.
If the Transparent IrComm application code is being
used on the SX then anything entered into the virtual
COM port terminal window will appear in the debug ter-
minal window and vice-versa.
If the SX 2 PC IrComm application code is being used
on the SX then the SX will respond to a ? (in the virtual
COM port terminal window) by returning the text string
SX IrComm Terminal, a c by returning the value of
port c, and to a r by returning the 128 byte register
dump.
Connection will be maintained until the virtual COM
port is closed or the devices cannot see each other for
more than 3 seconds.
Another interesting test is to install a printer driver in
windows connected to the virtual LPT port. With the
Transparent IrComm application, all the graphical
printer data will be sent out the debug port of the SX.