Serial IR Format

Serial IR Format

Post by --- » Mon, 19 Mar 2007 10:31:45



I am experimenting with using the IR port for primitive serial communication
with a custom device I am designing. I was surprised to see what the IR
waveform looks like. It does not look like usual async that I have seen many
times on a scope. Instead of Mark and Space pulses that fill up the entire bit
cell, these IR pulses are just 11 usec. long and are either there or not there
for '0's and '1's. (The bit cell time at 9600 baud is 104 usec.)

The IR pulses appear to be at the correct baudrate (about 104 usec. apart) and
other than being way too short, they make sense in every other way - there is a
start pulse and LSB to MSB in that order.

I can see how this shortened pulse format can save battery power by minimizing
the time that the IR LED is on. But is this always the way the IR port will
appear? I want to design a device with a regular UART to interface with this
port. I guess I can use some one-shots to stretch the pulses going into my
micro and truncate the pulses going the other way, but before I go to all that
trouble, I want to know if this is necessary. Has anyone ever looked at these
pulses at this level?

I created the port with CreateFile( _T("COM2:"),... and then used SetupComm(),
SetCommTimeouts(), GetCommState(), SetCommState(). All these functions return
without error. Then on timer hits I call WriteFile() with a single character
that runs from 0x40 to 0x5F repeatedly so I can watch the bits on a scope. I am
detecting the bits with a fast photodiode and transimpedance amplifier so I can
see what is going on at the lowest level. COM2: seems to be the correct port by
looking at the registry under HKLM\Comm\IrDA\Linkage, and then
HKLM\Comm\IrSir1\Parms\Port. The device is a iPAQ rx1955 running WM5.0. Adding
a call to EscapeCommFunction(h, SETIR) makes no difference.


Robert Scott
Ypsilanti, Michigan
 
 
 

Serial IR Format

Post by --- » Tue, 20 Mar 2007 20:45:30

Well, I found the answer to my question. Apparently this is part of the IrDA
standard. No one uses straight async converted to levels of light. All serial
IR devices use the system I observed. Async "Mark" is indicated by the presence
of a 11 usec. pulse of light and "Space" is indicated by the absense of that
pulse. Apparently there are special UARTS with an IR mode that knows how to
decode these shortened pulses.


Robert Scott
Ypsilanti, Michigan