Assignment Week7
Embedded Programming





This week’s assignment, I try to read data sheet of ATtiny44, and programing

Connect the ATtiny44A board and AVR ISP Mk2




1. I checked my ATtiny44 board that have made last week's assignment.



Open my EAGLE file and check circuit pattern route.

Next I opened ATtiny44A data sheet.
I checked my board's "pin-assign" to connect ATtiny44A and AVR ISP Mk2.
So, I connected them.



Next, I checked Block Diagram.

This figure describes architecture of ATtiny44.



I found, This IC has many analog input port. Because, ADC is connected to all portA pins.

I thought, It is better than ATMEGA328. I want to use ATtiny44 for Final Project!!



But I had the question. It is about "4.6 Instruction Execution Timing" in data sheet.

I can't understand it. Where is it used?

I want to research about how to manage timing of AVR.

Send boot loader to ATtiny44A




2. I opened Arduino IDE. It can download here.

Arduino IDE window




3. We must select microcontrol board name that we want to use.
Select this : Tools > microcontrol board > ATTiny44A (external 20MHz clock)
If we don't connect external resonator on your board, we should select 1MHz, and it can change to 8MHz.
Internal clock is depending to fuse bit.
It's detail is described in data sheet of ATtiny44A, section 6 "Clock System".





4. I try to install "boot loader". we can it using Arduino ISP.
Select this : Tools > burn boot loader
But when I do this, error message displayed in message box of Arduino IDE.  






avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: Send: Q [51] [20]
avrdude: Recv: . [10]
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x10
avrdude done. Thank you.

Arduino error message of burn boot loader




Just in case, I tried to send sample program to ATtiny44A.
I expected to display another error message, because not installed boot loader.
But, it display same error message.

So, I understand that cause of error is maybe not software. It's hardware.



5. So I used FTDI cable.
This is used for send program as serial communication.
First, I downloaded FTDI driver. It can download here.





This is FTDI cable. It use FT232RL chip.

But this time, I use this for supply Vcc and GND to ATtiny44A
I was taught from Instructor "TAKE" that AVR ISP Mk2 can't supply Vcc.
So, we must prepare another power supply.



I sent boot loader again. Then, It have done!



Send program






6. I tried to send program to ATtiny44A.
The program is for blink on-board LED.
This sample is stored in Arduino IDE.
But Arduino IDE sample is made for Arduino UNO that powerd by ATmega328.
So, pin number is different.

I changed pin number 13 to 7.
Pin number 7 is number to control pin 6 of ATtiny44A using Arduino IDE.

So, it have blinked !!

int led = 7;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
Program for blink on-board LED




7. Next, I added button movement to this program.
Button pin number of ATtiny44A is pin number 3

When I want to send to ATtiny or other microcontrol board using ArduinoIDE,
click left arrow icon.





int led = 7;
void setup() {
pinMode(led, OUTPUT);
}
int led = 7;
int button = 3;
void setup() {
pinMode(led, OUTPUT);
pinMode(button, INPUT);
}
void loop() {
if (digitalRead(button) == HIGH)
{
digitalWrite(led, HIGH);
}
else{
digitalWrite(led, LOW);
}
}
}


This program's behavior is here.