AVR Microcontroller Architecture [ATMega328/P, Arduino]

Arabinda Verma
Arabinda Verma
19.2 هزار بار بازدید - 6 سال پیش -
https://www.udemy.com/embedded-progra...

The lesson discusses about the various memory components and peripherals available on the ATMega328 microcontroller.

NV Memory - The ATmega328 uC provides 32 kilobytes of on-chip In-system programmable flash memory.

The uC also contains 1K bytes of EEPROM memory that is Electrically Erasable Programmable Read-Only Memory and is a type of non-volatile memory used in computers, integrated in microcontrollers, and other electronic devices to store relatively small amounts of data. It is organized as a separate data space, in which single bytes can be read and written. The EEPROM has an endurance of at least 100,000 write or erase cycles.
SRAM - The uC provides 2 kilobytes of SRAM. SRAM stand for Static Random Access memory. It is a volatile memory meaning the data stored in SRAM is lost when power is removed. It is also called data memory as it stores the data during the program execution.

Notice that the Flash and SRAM are connected to the AVR CPU through different bus. This is the differentiating characteristics of Harvard architecture. The separate program and data buses enables the uC to access the program and data memory independently and facilitates CPU pipelining. The CPU pre-fetches the next instruction while the current instruction is being executed.
Clock generation - The Clock generation module supports various clock sources and can be configured by setting appropriate value in the CKSEL bits in fuse bytes. The uC supports Low power crystal oscillator, Full swing crystal oscillator, Low frequency crystal oscillator. And has two internal RC oscillators and it can work with external clock too. The device is shipped with internal RC oscillator enabled and clock divide by 8 fuse programmed. The frequency of internal oscillator is 8MHz and clock divide by 8 results in the uC running at 1MHz.

Timer - There are three Timer/Counter units with compare modes and PWM and a realtime clock on the uC. The timer0 and timer2 denoted by TC0 and TC2 respectively are 8 bit timers and TC1 is a 16 bit timer. It also provides a programmable watchdog timer with internal oscillator. Watchdog timer is used to recover the system from software failure by resetting the system. TC2 support asynchronous mode. It is operational in power-save mode and allows user to maintain a timer base while the rest of the device is sleeping.

Serial communication - TWI (I2C) SPI & USART - The uC supports three serial communication protocols - SPI, TWI and USART. The Serial Peripheral Interface, SPI, allows high-speed synchronous data transfer between the device and peripheral units, or between several AVR devices. The In-circuit programmer used to flash bootloader & application uses SPI protocol. The Universal Synchronous Asynchronous serial Receiver Transmitter, USART, is a highly flexible serial communication device. The USART can also be used in Master SPI mode. It is commonly used to communication with the development PC. The Two-Wire Serial Interface, TWI, protocol allows the systems designer to interconnect up to 128 different devices. The TWI is compatible with Philips’ I2C protocol

GPIO - The uC has three GPIO ports and 23 IO lines. The ports B and D are 8 bit wide where are port C is 7 bit wide.

ADC/AC - The uC also provides Analog comparator and Analog to Digital Converter. The Analog Comparator compares the two voltages and sets the Analog Comparator output accordingly. The comparator’s output can be set to trigger the Input Capture function of TC1. The ADC converts an analog input voltage to a 10-bit digital value through successive approximation.

Power management - The uC supports six sleep modes. Sleep modes are used to save power by enabling the application to shut down unused modules in the uC. The various sleep modes allow the user to tailor the power consumption according to the application's requirement. The power management of Atmega328 supports Brown-out detection. The BOD circuit monitors the supply voltage and resets the uC if the supply voltage falls below a predefined threshold. The trigger level for the BOD is selected by the BODLEVEL bits in extended Fuse byte.

Power rating slide - The table shows the maximum power rating of ATMega328 uC. The voltage on any pin except reset pin must  be in the range of -0.5 V to Vcc+0.5V with respect to the ground. The reset pin allows the application of -0.5V to 13V. Higher voltage is applied to reset pin in high voltage programming mode to rescue fuses. The maximum operating voltage of the uC is 6 volts. The IO pins can source and sink 40mA of current and the Vcc & ground pins should not be supplied current in excess of 200mA. Take due care not to exceed the voltage and current ratings. The application of excessive power damages the uC & the development board.
6 سال پیش در تاریخ 1397/10/19 منتشر شده است.
19,208 بـار بازدید شده
... بیشتر