circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 139 February 2002
What Good is IrD, Eh?
Part 2: Wireless Communication

 


byJeff Bachiochi

Short Stories

If you don’t have the protocol documentation on each layer printed and spread out all over the desk, it’s difficult to follow much of what I just went over. There is so much more that I haven’t talked about. As Arlo Guthrie sang in "Alice’s Restaurant," "I told you that story, so I can tell you this one…." If you needed to add IrDA to an embedded system, you had a ton of code to write in support of the standard, until now.

Microchip released a preprogrammed micro that handles all of the messy IrDA stuff (see Figure 9). Well, not all protocols, just the IrDA stack and serial emulation via the IrCOMM service. You hang an infrared transceiver onto the MCP2150 and it handles IrLAP, IrLMP, IAS, TINY-TP, and IrCOMM. You interface directly to the RX and TX pins on your micro. Additionally, DSR, CTS, RTS, and CD must be implemented by your micro’s hardware or emulated in software with additional I/O bits. These control lines allow you to monitor the status and activity of the link. Notably though, you no longer need to be concerned with the nitty-gritty of the IrDA standard.

Figure 9—I used this circuit to experiment with IrDA communications with my laptop. It handles most of the messy IrDA stuff. RS-232-level shifters are not necessary when connecting directly to a microprocessor. These signals are available at J3.

If you recall from last month, I touched on some devices that handled formatting the datastream from a UART into IrDA-compatible IR communications. This was accomplished by decoding asynchronous non-idle bits of the UART into IR pulses and decoding IR pulses back into non-idle asynchronous bit times. One of the devices mentioned was the MCP2120 from Microchip. The MCP2150 adds the upper-level software IrDA layers to the physical interfacing abilities of the ’2120 to reduce design time to market. Although the MCP2150 does not support multi-point (more than two devices at a time) applications, the most common applications require only two devices—a primary device sending or receiving communication to or from a secondary device.

On the system side, the MCP2150 communicates with the serial port of the system at one of four fixed data rates (9600 to 115,200 bps). This system communications rate is independent from the IR data rate, which, as discussed earlier, defaults to 9600 bps and is automatically negotiated up to 115,200 bps. The MCP2150 requires an 11.0592-MHz crystal to generate the timing for both the system and IR data rate generation.

You may be asking, "Why are there extra control signals necessary beyond the normal TX and RX?" Well, the input and output buffers of the MCP2150 are limited to 64 bytes and the device can handle communication in one direction at a time. There must be a way of indicating the status of the communications link to the system.

These extra signals are similar to those used by an external modem connected to the system, thus, they are defined to emulate the same functions. The CD output (carrier detect) tells the system when a negotiated link has been established to perform a task. The data set ready (DSR) output indicates that the MCP2150 has initialized itself and is ready to go to work. The clear to send (CTS) output reflects the state of the input buffer, noting when the system can send data through TX.

Additionally, two input signals are used. The ready to send (RTS) input lets the MCP2150 know when the system is ready to receive data through RX. Lastly, the data terminal ready (DTR) input can be tied low, disabling Device ID Programming mode. This mode is necessary only if you wish to change the default device name, MCP 9-wire, within the MCP2150 to something more appropriate. For those of you who are highly interested in reducing current consumption to an absolute minimum, the ’2150 also provides an enable (EN) input that will reduce device consumption from milliamperes to microamperes.