|
Arduino AVR In System Programmer |
|
Randall converted an Arduino into AVR chip programming hardware for use with AVRDude. The project programs AVR tiny13 and other tiny AVR chips using an Arduino. He provides code and instructions to implement the Atmel AVR910 In System Programming protocol. I ported the Atmel AVR910 In System Programmer protocol to the Arduino. Now I can write programs to my ATtiny2313 and tiny13 chips. The Arduino sketch is available for download here. It works with the AVRDude programming software. This article will show how to use the Arduino to upload a program to the tiny13. The first step is to download the zip, extract the .pde file, then load it into the Arduino IDE, and write it to the Arduino. Next we can hook up the tiny13 chip.
The original AVR910 programmer didn’t support the tiny13 chip. I added tiny13 support to the Arduino version and assigned it part ID 1. I had to modify the avrdude.conf file also. I just added the following line
avr910_devcode=0x01
to the tiny13 section right after the stk500_devcode line.
1-powerI put the tiny13 chip on a solderless breadboard, and connected power to it from the Arduino. I also put a bypass capacitor from lead 8 to lead 4 on the tiny13. This helps smooth out the power to the chip.
I added LED support when I ported the avr910. The LED turns on when the system is in Programming mode. Add the LED to the breadboard. Connect it to the ground line with a 1Kohm resistor and to the Arduino pin 9. Mind the polarity of the LED. The reset line should also be connected, from pin 10 on the Arduino to pin 1 on the tiny13.2-reset-LED
Next connect the SPI interface. The Arduino’s Mega8 has hardware support for SPI. The SPI lines need to be connected to the tiny13 as follows:
Arduino ATtiny13
Pin 13 (SCK) Pin 7
Pin 12 (MISO) Pin 6
Pin 11 (MOSI) Pin 5
SPI-Cable
I use this cable to connect the SPI lines to the breadboard. The cable has to be twisted once to match up properly when the Arduino is next to the breadboard as in the photos above.
With everything connected you can power up the Arduino and start using AVRDUDE. First you need to know which port the Arduino is using. My USB Arduino shows up on port com4: so I’ll use that in the examples. We need to tell AVRDUDE which port to use, which part we are using, and which ISP programmer we are using. If you run following command line it should connect to the tiny13 and read the device signature (0×1e9007).
> avrdude -P com4 -p t13 -c avr910
AVRDUDE will also complain that it cannot read lfuse properly. Add the -u switch to get past this limitation.
> avrdude -P com4 -p t13 -c avr910 -u
With that working we can go into terminal mode with AVRDUDE and check the tiny13.
> avrdude -P com4 -p t13 -c avr910 -u -t
Enter ’sig’ to view the device signature again:
avrdude> sig
Reading | ################################## | 100% 0.02s
Device signature = 0×1e9007
Enter ‘read flash 0 16′ to read the first 16 bytes of the flash memory. If the chip hasn’t been programmed it should be all 0xFF. You can also use hex numbers as follows: ‘read eeprom 0×10 0×10′.
With AVRDUDE in terminal mode we can write to the eeprom but not the flash on the tiny13. To store the string ‘BEEP’ into the eeprom you could enter the following:
avrdude> write eeprom 0 66 69 69 80 0
avrdude> read eeprom 0 8
If that worked you just wrote to the eeprom and read the contents back. Enter ‘quit’ when you are done with terminal mode.
AVRDUDE won’t write to the tiny13 flash in terminal mode because the flash is programmed in page mode. You have to write the flash from the command line. The -U switch is used to read and write memories from the command line. You can use more than one -U command at a time. Another thing to be aware of is that AVRDUDE will erase the chip before writing flash memory. Anything in EEPROM will have to be reloaded if you write to flash.
Start with the base command:
> avrdude -P com4 -p t13 -c avr910 -u
The add the -U command at the end. To write file ‘target.hex’ to the tiny13 use the following:
-U target.hex
This is the simplified syntax. You can use it when you want to write a hex file to the chip flash. The full syntax to write is:
-U flash:w:target.hex:i
(write target.hex to flash, target.hex is Intel S-Record format.) AVRDUDE can figure out the format of the file, so you can actually leave the :i off.
To write the EEPROM use:
-u eeprom:w:target.eep
You can also read out the chip contents and verify against a file on your disk.
SPI-mega8
The basic development workflow I use is to build the software in AVRStudio 4, then use AVRDUDE to write to the target chip. I’ve used it to program the tiny13, tiny15, tiny2313, and the mega8.
Related Links
Downloads
Arduino AVR In System Programmer - Link
|
|
|
|
Accurate LC Meter
Build your own Accurate LC Meter (Capacitance Inductance Meter) and start making your own coils and inductors. This LC Meter allows to measure incredibly small inductances making it perfect tool for making all types of RF coils and inductors. LC Meter can measure inductances starting from 10nH - 1000nH, 1uH - 1000uH, 1mH - 100mH and capacitances from 0.1pF up to 900nF. The circuit includes an auto ranging as well as reset switch and produces very accurate and stable readings. |
|
PIC Volt Ampere Meter
Volt Ampere Meter measures voltage of 0-70V or 0-500V with 100mV resolution and current consumption 0-10A or more with 10mA resolution. The meter is a perfect addition to any power supply, battery chargers and other electronic projects where voltage and current must be monitored. The meter uses PIC16F876A microcontroller with 16x2 backlighted LCD. |
|
|
|
60MHz Frequency Meter / Counter
Frequency Meter / Counter measures frequency from 10Hz to 60MHz with 10Hz resolution. It is a very useful bench test equipment for testing and finding out the frequency of various devices with unknown frequency such as oscillators, radio receivers, transmitters, function generators, crystals, etc. |
|
1Hz - 2MHz XR2206 Function Generator
1Hz - 2MHz XR2206 Function Generator produces high quality sine, square and triangle waveforms of high-stability and accuracy. The output waveforms can be both amplitude and frequency modulated. Output of 1Hz - 2MHz XR2206 Function Generator can be connected directly to 60MHz Counter for setting precise frequency output. |
|
|
|
BA1404 HI-FI Stereo FM Transmitter
Be "On Air" with your own radio station! BA1404 HI-FI Stereo FM Transmitter broadcasts high quality stereo signal in 88MHz - 108MHz FM band. It can be connected to any type of stereo audio source such as iPod, Computer, Laptop, CD Player, Walkman, Television, Satellite Receiver, Tape Deck or other stereo system to transmit stereo sound with excellent clarity throughout your home, office, yard or camp ground. |
|
USB IO Board
USB IO Board is a tiny spectacular little development board / parallel port replacement featuring PIC18F2455/PIC18F2550 microcontroller. USB IO Board is compatible with Windows / Mac OSX / Linux computers. When attached to Windows IO board will show up as RS232 COM port. You can control 16 individual microcontroller I/O pins by sending simple serial commands. USB IO Board is self-powered by USB port and can provide up to 500mA for electronic projects. USB IO Board is breadboard compatible. |
|
|
|
|
ESR Meter / Capacitance / Inductance / Transistor Tester Kit
ESR Meter kit is an amazing multimeter that measures ESR values, capacitance (100pF - 20,000uF), inductance, resistance (0.1 Ohm - 20 MOhm), tests many different types of transistors such as NPN, PNP, FETs, MOSFETs, Thyristors, SCRs, Triacs and many types of diodes. It also analyzes transistor's characteristics such as voltage and gain. It is an irreplaceable tool for troubleshooting and repairing electronic equipment by determining performance and health of electrolytic capacitors. Unlike other ESR Meters that only measure ESR value this one measures capacitor's ESR value as well as its capacitance all at the same time. |
|
Audiophile Headphone Amplifier Kit
Audiophile headphone amplifier kit includes high quality audio grade components such as Burr Brown OPA2134 opamp, ALPS volume control potentiometer, Ti TLE2426 rail splitter, Ultra-Low ESR 220uF/25V Panasonic FM filtering capacitors, High quality WIMA input and decoupling capacitors and Vishay Dale resistors. 8-DIP machined IC socket allows to swap OPA2134 with many other dual opamp chips such as OPA2132, OPA2227, OPA2228, dual OPA132, OPA627, etc. Headphone amplifier is small enough to fit in Altoids tin box, and thanks to low power consumption may be supplied from a single 9V battery. |
|
|
|
|
|
Arduino Prototype Kit
Arduino Prototype is a spectacular development board fully compatible with Arduino Pro. It's breadboard compatible so it can be plugged into a breadboard for quick prototyping, and it has VCC & GND power pins available on both sides of PCB. It's small, power efficient, yet customizable through onboard 2 x 7 perfboard that can be used for connecting various sensors and connectors. Arduino Prototype uses all standard through-hole components for easy construction, two of which are hidden underneath IC socket. Board features 28-PIN DIP IC socket, user replaceable ATmega328 microcontroller flashed with Arduino bootloader, 16MHz crystal resonator and a reset switch. It has 14 digital input/output pins (0-13) of which 6 can be used as PWM outputs and 6 analog inputs (A0-A5). Arduino sketches are uploaded through any USB-Serial adapter connected to 6-PIN ICSP female header. Board is supplied by 2-5V voltage and may be powered by a battery such as Lithium Ion cell, two AA cells, external power supply or USB power adapter. |
|
200m 4-Channel 433MHz Wireless RF Remote Control
Having the ability to control various appliances inside or outside of your house wirelessly is a huge convenience, and can make your life much easier and fun. RF remote control provides long range of up to 200m / 650ft and can find many uses for controlling different devices, and it works even through the walls. You can control lights, fans, AC system, computer, printer, amplifier, robots, garage door, security systems, motor-driven curtains, motorized window blinds, door locks, sprinklers, motorized projection screens and anything else you can think of. |
|
|
|