photo logo fab lab puebla_zpsf84vuacy.jpg
 photo fab-academy2_zpszvqovjt6.jpg
 photo fab-academy2_zpszvqovjt6.jpg

Huber Girón Nieto

Electronic and Mechatronic Engineer

Contact

e-mail: huber.giron.nieto@iberopuebla.mx

phone: +52 (222) 372 3000 ext.12917

FABLAB Puebla Researcher

WEEK ASSIGNMENT:

Embedded Programming

Read a micro-controller data sheet, program your board to do something, with as many different programming languages and programming environments as possible

 

 

 

 

 

For this week  activity ,we investigate how to program an AVR micro-controller using Arduino-IDE and Atmel Studio.

For Programming first we need a programming environment, like Arduino IDE or Atmel Studio. With the IDE of Arduino we can program the Attiny44a using directly another Arduino Board configured as ISP Programmer. The arduino IDE and the Atmel Studio generate a Hex file and the AvrDude can use this Hex file to program the micro-controller using another Arduino Board configured as ISP Programmer.

 photo diagrama programa_zpsnzpkl6tg.jpg

Using Arduino IDE

First you need to program the Arduino Board as a Arduino ISP, and configure the programming default pins.

 photo ardisp_zpshqo2mn3p.jpg

To program an Attiny44a you need to integrate the Attiny library in the Arduino IDE environment and use the Arduino ISP programmer configuration.

 

 photo ard2_zpsvaqubf6x.jpg
 photo ard3_zpsfobkj7rk.jpg
 photo ard4_zpsxes8t34t.jpg

To program you only need to compile your wiring code and download to the attiny Micro-controller.

Its important to configure and select correctly the data pins, because the attiny library rename the Attiny44a pins, I connected a LED to PB2 port.

 

 

 photo 20150307_210047_zps5nxsvxdc.jpg
 photo ard5_zpsavbchrdg.jpg

Obtain Arduino IDE HEX file

To obtain the Code Hex file you need to get the temporal root that the IDE uses to generate that file:

 

Obtain HEX file using Atmel Studio

 photo ard6_zpsyslx6cqu.jpg

Also you can use the Atmel Studio to obtain the HEX File. In Atmel Studio we program in C language and use the ports name that are indicated in the datasheet:

 

 

 photo dip_zpskdzxec76.jpg
 photo atmel_zpsstwweamn.jpg

Using AvrDUDE with a Hex File

To use the Arduino Board and the Avrdude to download the HEX file into the Attiny micro-controller we need to configure the Windows terminal with the COM port,  a baud rate with 19200 and a stk500V1 programmer type:

 

 

 

 photo dude_zpsqcremx9o.jpg
 photo dude2_zpsuct3j5bz.jpg

Tests

First we use only an Attiny44a with a LED using the Blinky example and configure a 1MHz internal oscillator:

 

 photo 20150307_145018_zps7gchfqbh.jpg
 photo 20150307_144729_zpscnjzstci.jpg

Finally we use the Attiny44a board made in the last assignment, with a LED using the Blinky example and configure a 20MHz external oscillator:

I used a LED  in port PB2 and a Button in port  PA7.

 

 photo 20150307_212309_zpsulln5wtw.jpg