Datasheet atmega128a-au — atmel даташит 8- бит микроконтроллеры (mcu) 128k flash 4k eeprom 4k sram 53 io pins

Параметры

ADC Input 8
ADC with Computation No
Angular Timer No
Архитектура 8
CPU Type 8-bit AVR
CRC No
Class B Hardware No
Emulated EEPROM in Flash 4096
High Voltage Capable No
I2C 1
Internal Oscillator Yes
Internal Voltage Reference Yes Bandgap
Lead Count 64
Math Accelerator No
Max 16-Bit Digital Timers 2
Max 8-Bit Digital Timers 2
Max ADC Resolution 10 Bits
Max CPU Speed 16 МГц
Max PWM outputs 6 including complementary
Количество компараторов 1
Operation Voltage Max 5.5 В
Operation Voltage Min 2.7 В
Package Width 14x14x1mm
Peripheral Pin Select / Pin Muxing No
Pin count 64
Размер памяти программ 128 KB
SPI 1
SRAM 4096 Bytes
Temp Range Max 85
Temp Range Min -40
UART 2
Zero Cross detect No

Файл boards.txt

В Windows этот файл расположен в папке с Arduino:

.../hardware/arduino/avr/boards.txt

В Mac OS X:

.../arduino/Contents/Java/hardware/arduino/avr/boards.txt

В конец файла boards.txt среды Arduino добавляем следующие строчки:

###############################################################
atmega128A.name=Custom ATmega 128 Breakout Board using AVRISP

atmega128A.upload.tool=usbasp
atmega128A.upload.maximum_size=126976

atmega128A.bootloader.low_fuses=0xFF
atmega128A.bootloader.high_fuses=0xCA
atmega128A.bootloader.extended_fuses=0xFF
atmega128A.bootloader.path=atmega
atmega128A.bootloader.file=boot_mega128.hex
atmega128A.bootloader.unlock_bits=0x3F
atmega128A.bootloader.lock_bits=0x0F

atmega128A.build.mcu=atmega128
atmega128A.build.f_cpu=8000000L
atmega128A.build.core=arduino
atmega128A.build.variant=mega128

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

###############################################################

atmega128A.name=Custom ATmega128Breakout Board using AVRISP

atmega128A.upload.tool=usbasp

atmega128A.upload.maximum_size=126976

atmega128A.bootloader.low_fuses=0xFF

atmega128A.bootloader.high_fuses=0xCA

atmega128A.bootloader.extended_fuses=0xFF

atmega128A.bootloader.path=atmega

atmega128A.bootloader.file=boot_mega128.hex

atmega128A.bootloader.unlock_bits=0x3F

atmega128A.bootloader.lock_bits=0x0F

atmega128A.build.mcu=atmega128

atmega128A.build.f_cpu=8000000L

atmega128A.build.core=arduino

atmega128A.build.variant=mega128

Обратите внимание на фьюзы загрузчика.  Они в точности должны совпадать с указанными при его прошивке!. Тактовая частота микроконтроллера у меня установлена равной 8 МГц

Тактовая частота микроконтроллера у меня установлена равной 8 МГц.  

Datasheets

Features
• High-performance, Low-power AtmelAVR8-bit Microcontroller
• Advanced RISC Architecture • • • • • •

• — 133 Powerful Instructions — Most Single Clock Cycle Execution
— 32 x 8 General Purpose Working Registers + Peripheral Control Registers
— Fully Static Operation
— Up to 16MIPS Throughput at 16MHz
— On-chip 2-cycle Multiplier
High Endurance Non-volatile Memory segments
— 128Kbytes of In-System Self-programmable Flash program memory
— 4Kbytes EEPROM
— 4Kbytes Internal SRAM
— Write/Erase cycles: 10,000 Flash/100,000 EEPROM
— Data retention: 20 years at 85°C/100 years at 25°C(1)
— Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
— Up to 64Kbytes Optional External Memory Space
— Programming Lock for Software Security
— SPI Interface for In-System Programming
QTouch library support
— Capacitive touch buttons, sliders and wheels

ATmega128(L) — Summary Datasheet

PDF, 471 Кб, Версия: 06-01-2011

Выписка из документа

Features High-performance, Low-power AtmelВAVRВ8-bit Microcontroller Advanced RISC Architecture – 133 Powerful Instructions – Most Single Clock Cycle Execution– 32 x 8 General Purpose Working Registers + Peripheral Control Registers– Fully Static Operation– Up to 16MIPS Throughput at 16MHz– On-chip 2-cycle MultiplierHigh Endurance Non-volatile Memory segments– 128Kbytes of In-System Self-programmable Flash program memory– 4Kbytes EEPROM– 4Kbytes Internal SRAM– Write/Erase cycles: 10,000 Flash/100,000 EEPROM– Data retention: 20 years at 85В°C/100 years at 25В°C(1)– Optional Boot Code Section with Independent Lock BitsIn-System Programming by On-chip Boot ProgramTrue Read-While-Write Operation– Up to 64Kbytes Optional External Memory Space– Programming Lock for Software Security– SPI Interface for In-System ProgrammingQTouchВ library support– Capacitive touch buttons, sliders and wheels– QTouch and QMatrix acquisition– Up to 64 sense channelsJTAG (IEEE std. 1149.1 Compliant) Interface– Boundary-scan Capabilities According to the JTAG Standard …

Datasheets

8-bit AVR Microcontroller ATmega128ADATASHEET COMPLETE IntroductionВ The Atmel ATmega128A is a low-power CMOS 8-bit microcontroller basedВon the AVR enhanced RISC architecture. By executing powerful instructionsin a single clock cycle, the ATmega128A achieves throughputs close to1MIPS per MHz. This empowers system designer to optimize the device forpower consumption versus processing speed. Features High-performance, Low-power Atmel AVR 8-bit MicrocontrollerAdvanced RISC Architecture– 133 Powerful Instructions -Most Single-clock Cycle Execution– 32 Г— 8 General Purpose Working Registers + Peripheral ControlRegisters– Fully Static Operation– Up to 16MIPS Throughput at 16MHz– On-chip 2-cycle MultiplierHigh Endurance Non-volatile Memory segments– 128Kbytes of In-System Self-programmable Flash programmemory– 4Kbytes EEPROM– 4Kbytes Internal SRAM– Write/Erase cycles: 10,000 Flash/100,000 EEPROM– Data retention: 20 years at 85В°C/100 years at 25В°C(1)– Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation …

ATmega128A — Summary Datasheet

PDF, 299 байт, Файл опубликован: 10 дек 2016

Datasheets

Features
• High-performance, Low-power AtmelAVR8-bit Microcontroller
• Advanced RISC Architecture • • • • • •

• — 133 Powerful Instructions — Most Single Clock Cycle Execution
— 32 x 8 General Purpose Working Registers + Peripheral Control Registers
— Fully Static Operation
— Up to 16MIPS Throughput at 16MHz
— On-chip 2-cycle Multiplier
High Endurance Non-volatile Memory segments
— 128Kbytes of In-System Self-programmable Flash program memory
— 4Kbytes EEPROM
— 4Kbytes Internal SRAM
— Write/Erase cycles: 10,000 Flash/100,000 EEPROM
— Data retention: 20 years at 85°C/100 years at 25°C(1)
— Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
— Up to 64Kbytes Optional External Memory Space
— Programming Lock for Software Security
— SPI Interface for In-System Programming
QTouch library support
— Capacitive touch buttons, sliders and wheels

ATmega128(L) — Summary Datasheet

PDF, 471 Кб, Версия: 06-01-2011

Выписка из документа

Features High-performance, Low-power AtmelВAVRВ8-bit Microcontroller Advanced RISC Architecture – 133 Powerful Instructions – Most Single Clock Cycle Execution– 32 x 8 General Purpose Working Registers + Peripheral Control Registers– Fully Static Operation– Up to 16MIPS Throughput at 16MHz– On-chip 2-cycle MultiplierHigh Endurance Non-volatile Memory segments– 128Kbytes of In-System Self-programmable Flash program memory– 4Kbytes EEPROM– 4Kbytes Internal SRAM– Write/Erase cycles: 10,000 Flash/100,000 EEPROM– Data retention: 20 years at 85В°C/100 years at 25В°C(1)– Optional Boot Code Section with Independent Lock BitsIn-System Programming by On-chip Boot ProgramTrue Read-While-Write Operation– Up to 64Kbytes Optional External Memory Space– Programming Lock for Software Security– SPI Interface for In-System ProgrammingQTouchВ library support– Capacitive touch buttons, sliders and wheels– QTouch and QMatrix acquisition– Up to 64 sense channelsJTAG (IEEE std. 1149.1 Compliant) Interface– Boundary-scan Capabilities According to the JTAG Standard …

Загрузчик для ATmega128A

Для того, чтобы записать программу в память микроконтроллера непосредственно из Arduino IDE потребуется специальная программа-загрузчик (bootloader), размещенная в специальной области памяти микроконтроллера, которая постоянно опрашивает UART.

Это немного измененная версия загрузчика с сайта www.chip45.com.

Bootloader Mega128 bootloader_mega128.zip
10.0 KiB 1738 Downloads

Category: Programs
Date: 27.10.2015

Для компиляции я использовал AVR-GCC.

$ avr-gcc -mmcu=atmega128 -Wall -Os -o boot_mega128.o boot_mega128.c
$ avr-objcopy -O ihex boot_mega128.o boot_mega128.hex

1
2

$avr-gcc-mmcu=atmega128-Wall-Os-oboot_mega128.oboot_mega128.c

$avr-objcopy-Oihex boot_mega128.oboot_mega128.hex

В архиве содержится исходный C-файл, объектый файл и готовый hex-файл. Для дальнейших действий понадобится только последний.

Устанавливаем фьюзы микроконтроллера и прошиваем загрузчик, используя программатор USBasp и AVRDUDE:

$ sudo avrdude -p m128 -c usbasp -P usbasp -Uefuse:w:0xff:m -Uhfuse:w:0xca:m -Ulfuse:w:0xff:m -Ulock:w:0x3F:m
$ sudo avrdude -p m128 -c usbasp -e -U flash:w:boot_mega128.hex -Ulock:w:0x0F:m

1
2

$sudo avrdude-pm128-cusbasp-Pusbasp-Uefusew0xffm-Uhfusew0xcam-Ulfusew0xffm-Ulockw0x3Fm

$sudo avrdude-pm128-cusbasp-e-Uflashwboot_mega128.hex-Ulockw0x0Fm

В Windows sudo писать не нужно.

Создадим папку atmega128 и перепишем в нее файл boot_mega128.hex в папке с загрузчиками среды Arduino для того, чтобы можно было прошивать bootloader прямо из Arduino IDE.

В MacOS X путь к папке с загрузчиками выглядит следующим образом:

.../arduino/Contents/Java/hardware/arduino/avr/bootloaders  

Hello, world!

Осталось проверить работоспособность. Подключаем к выводу PB4 светодиод (12 пин) и наслаждаемся его незамысловатым миганием, предварительно загрузив представленный ниже скетч в микроконтроллер, выбрав  микроконтроллер Custom ATmega 128 Breakout Board using AVRISP и программатор USBasp из среды Arduino IDE.

int ledPin=12;

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

1
2
3
4
5
6
7
8
9
10
11
12

intledPin=12;

voidsetup(){

 pinMode(ledPin,OUTPUT);

}
 

voidloop(){

 digitalWrite(ledPin,HIGH);

 delay(1000);

 digitalWrite(ledPin,LOW);

 delay(1000);

}

Оцените статью:
Оставить комментарий