IrDA lite protocol stack for Atmel AVR microcontrollers

 this Site as pdf-file

Features:

IrDA lite protocol fully implemented in firmware (only IR-transceiver required)

  • secondary only device
  • fixed speed of 9600 bps, data size =64bytes, window size =1, max. turn arround time 500 ms, disconnect/treshold time of 3 seconds, additional BOFs =0
  • implemented layers: physical, frame wraper, payload and LAP , LMP , TinyTP , IrCOMM and IAS
  • IrCOMM 3 and 9-Wire serial emulation

used

  • one external interrupt input, one general I/O pin as output and one 8-bit timer for timing
  • ca 200 Byte of SRAM
  • ca 3 kByte of Program FLASH


 written in AVR Studio 4.11 (assembler)

IrDA lite for Atmel AVR

 

 

  The IrDA Lite was developed for simple electronic devices with small system resources. For IrDA lite does not exist a defined specification. A Lite implementation can range from a minimum Lite up to a complete IrDA implementation. IrDA Lite is compatible with a fully implemented IrDA stack.

 


Main program (main.asm)

Initialization

- clearing of SRAM and register

- set port D that on INT0 is the input

- set timer TIMER0, enable interrupt overflow

- set and enable external interrupt at the falling edge of INT0

- UART set only for the example, otherwise it is not needed

- initialization of the IrDA subsystem

The main program loop is very simple. It is only required to check following flags:

 Callback functions

The IrDA subsystem is calling a number of callback functions of the user program.

 

 


IrDA subsystem (irdavr_ls.asm)

It is not recommended that the IrDA subsystem is modified by the user. For inquiries and questions please contact irdavr@psh-mikro.sk

 

Interrupts

The start bit of the serial infrared data stream triggers the external interrupt INT0. This interrupt is disabled and the timer starts measuring the single bits. When timer overflow it is looked for the pulse. Pulse means logic 0 and no pulse means logic 1. After one character is received, it is moved on and the external interrupt INT0 is enable again.

When sending the TIMER0 is used to measure the length of the single bits. External interrupt INT0 is disabled to avoid reflections. The flag TXBYTE is set what means that the sending is finished.

 


Implemented example

 

For an easy start an example is implemented. After PON Reset AVR sends the string "IrDA Demo V.2.04 11.04.2005" on the serial port (115,2k @ 7, and 3, 6864  MHz, 9600 @ 2.0000 MHz).

IrDA communication

For PalmOS PDA you can use a terminal programm like "Online" from www.marktspace.com

Select communication over infrared, 9600 Baud, 8N1N and open port. Then type "r" and you should get back a memory dump of internal AVR memory space 0x200-0x210.

The AVR is confirming by sending back the received character over the serial port.

 

The same can be tested with a Windows based PC.

In the taskbar you should be seeing

To get an IrCOMM connection you must have running a program like hyperterm that accesses the COM emulation of IrCOMM. For virtual COMM driver for winXP see: http://www.ircomm2k.de/

 AVR IrCOMM connection with WindowsXP PC

 


Hints about hardware

It should also be noted that the IR transceiver LED timing is completely software controlled.
To increase the effective range of the link it is common to calculate the current limiting resistor for the transceiver LED for pulse operation (average current). If the AVR device leaves the LED on continually then the IR transceiver may be permanently damaged.

 

 


Useful links:

IrDA related resources:

AVR related resources:

Palm  related resources:

Windows  related resources:

 

All logos, trademarks and brands are property of their respective owners.

 last update: 22.05.2005