AVR Based Embedded Systems

EMBEDDED AVR FAMILY

Introduction:

Basically, it is an 8-bit Reduced instruction set computer microcontroller device manufactured by the company ATMEL.

This peculiar architecture was proposed by two Norwegian students and was again remodified at ATMEL Norway.

ATMEL Norway was like the subsidiary of ATMEL manufactured by two intelligent architects.

DEVICE MEMORY:

The Architecture of devices employed into these devices employed a re-modified Harvard architecture.

Memory Features:

  1. The internal memory was utilized for program data and program instructions.
  2. External memory was completely left free.
  3. Quicker access and enhanced capacity were achieved by employing separate buses for data and program instructions.
  4. Each memory was located on a single chip on the CPU core cut each Memory is separated from each other.
  5. E.g.Address 0 contained within program memory is unique from the address 0 within data memory.
TYPES OF AVR FAMILIES:-
  • AVR classic
  • Tiny AVR
  • Mega AVR
Basic Components:

1.GPIO(General purpose Input Output Registers):

Each port has specifically three registers:-

1.) DDRx

2.) PORTx

3.) PINx

2.RESET PIN

  1. The Reset pin within the AVR family is mainly active low pin which resets the computing processor and all of it’s related peripherals.
  2. AVR’S also comprises of a watchdog timer that resets the CPU itself after count finish(0 to FF(255)).

USES OF RESET PIN:

  1. Debugging General Purpose Input Output Registers
  2. In system serial Programming.

3.INTERRUPTS:

  • This architecture of AVR’S can support multiple interrupts
  • Some signal filtering or debounce logic must be applied as button bounce issues can arise at any time.
  • Many of the modern AVR’S have a dedicated interrupt pin INT0.
  • The older versions could produce an interrupt on a low, high or falling edge of any signal.
  • Each specific interrupt creates a jump or transition with In memory address.
  1. TIMER/COUNTERS:
  • They have at least ONE 8-BIT COUNTER known as timer
  • In normal mode, the counter counts from zero to FF(Rollover) and sets the flag bit(TF0)
  • The CTOC(Clean Timer on Compare mode ):- Allows timer to be cleared when matching a corresponding value in the register before the timer proceeds to the highest value and overflows.

5.EEPROM:-

  1. It is non- volatile in nature(non-erasable).
  2. They can be re-written with a minimum number of 100,000 times.
  3. Each  Electronic Erasable Programmable read-only memory is FF16.
  4. Most of the AVR’S have encountered an error while writing data to address 0 so ATMEL suggested avoiding that address, especially during unintentional power outage conditions.

6.FUSE SETTINGS:-

  1. The Fuse is essentially an EEPROM bit that has various pins assigned and certain low-level functions.
  2. They contain features before the chip can come out of the RESET stage and start computing instructions.
  3. Usually, these fuse settings are used:-
  • Crystal Oscillator strength
  • JTAG pins
  • Reset pin
  • Brownout voltage-trigger points and Brown out detect enable
TYPES OF PROGRAMMING INTERFACES:

1.) IN SYSTEM PROGRAMMING:

It is done with the aid of Serial Peripheral Interface.

2.) HIGH VOLTAGE SERIAL PROGRAMMING:

Mostly the backup mode on smaller AVR’s

3.) HIGH VOLTAGE PARALLEL PROGRAMMING:

Backup mode on larger AVR’S.

4.) BOOTLOADER SECTION:

A vast majority of the ATMEL chips have a separate bootloader memory region. Here the reprogrammed code resides.

At power on, the bootloader runs- first and takes the decision whether to boot the main program or to initiate reprogramming code.

Various types of memories in AVR microcontrollers:

  1. Electronic Erasable Programmable read-only memory(EEPROM)
  2. Fuse Bits
  3. Flash Memory
  4. Data memory comprising:-
  • Registers
  • Input/Output Registers
  • SRAM

SIMULATION:

The application of software can be an effective means of assistance before implementing the actual physical hardware design.

Debugging interface is absent.

The software packages that provide the property for simulation are:-

  • VM lab
  • Proteus
  • AvRora

ATMEL Studio makes use of assembly level language to manipulate the internal registers within the AVR core.
HAP sim: A collection of virtual devices that connect to AVR studio

TYPES OF COMMUNICATION:

SERIAL COMMUNICATION:-

  • They support a wide range of serial communication protocols such as:-

1.Universal Asynchronous Receiver Transmitter

a.)Universal:-Utilized in different serial communication devices.

b.)Synchronous:- In the same clock cycle serial communication is done.

c.)Asynchronous:- Transfer takes place without clock signal but becomes same on the data signal.

d.)Receiver:- AVR gets data through hardware

e.)Transmitter:- Hardware will transfer serial data.

SPI(Serial Peripheral interface):-

It comprises the master to slave serial protocol having a clock input(synchronous).

The three main components are:-

  • Master in Slave out
  • Master out slave in
  • Serial clock

Since the transfer of serial data takes place forth and back SPI interface is known as a bidirectional shift register.

Disadvantage:-

The master can only assign as many as slaves as the number of extra output pins provides, it cannot simply exceed. This is achieved by utilizing a different decoder.

RS-232 ( UART protocol ):-

  1. This particular specification calls for a negative voltage.
  2. This type of communication permit voltages from +3v to +15v and -3V to -15V.
  3. It has a comparatively shorter transmission cable length.
  4. RS-482 enables long distance
  5. Speeds include 20 Kbps for every 15 meters(50 feet)

TWO WIRE INTERFACE:

  • This is known as I2C
  • Comprises of two main wires for communication namely:-
  1. Serial Clock(SCA)
  2. Serial data(SDA)
  • It uses a common ground for connection in a way that all the existing devices must be at equal ground potential to avoid ground loops.
  • E.g The AVR’S Two-wire interface can behave either as slave or master and transmit data at 400 kbits/s.

PARALLEL COMMUNICATION:

  • An example of parallel communication is the transfer of data within USB connected from printer to computer.(6 m distance)
CONJOINT HARDWARE:
  • In addition to the existing peripherals(UART, ADC, SPI) AVR’S also incorporates the following hardware components:-

1.)LCD driver:-

  • For E.g in the AVR Butterfly, an LCD is integrated.
  • The module performs exact timing to display pixels forward and backward at the same rate.

2.)US Interface:-

  1. AT90USB series employ various USB functions such as:-

(I)   On the  GO

(II)  USB host(interfacing with slave)

(III) USB slave

2. If no internal USB is there then an external USB can be  interfaced

3.FOr little functionality and lower speeds, the only firmware is needed.

3.)Temperature sensor:

  • The modern AVR models comprise a temperature sensor module hooked with the  ADC(Analog Digital Converter)

PROTOCOL ISSUES AND REQUIREMENTS:-

  • These three above mentioned protocols( I2C, RS232, SPI) are only defined by the number of bits or bytes transferred.
  • They point to the physical layer of the Operating System.
  • The SPI in case of power failures it should be able to recover data and must employ a wide range of functions.
  • The protocol must be able to resynchronize the transmitter and receiver in case of power outages so the beys of data transferred are not lost.

DEBUGGING INTERFACES:

1.) Join test action group(JTAG):

It gives access to an on-chip property of debugging.

Various types of JTAG are:-

  • AVR Dragon
  • JTAGICE mkll
  • JTAGICE adapter

2.) DebugWIRE

Was unable to deliver the four secondary pins responsible for debugging(JTAG).

FIRMWARE PROGRAMMING:

If the firmware is absent then there is not much a microcontroller can do.

A number of languages can be used for coding purposes namely:-

  1. C
  2. C++

  3. 3 AVR assembly language
  4. Python