Offline
Newbie
Karma: 0
Posts: 10
|
 |
« on: January 20, 2013, 08:44:53 am » |
Hi, I want to program a ATTiny2313 with a hex file and since I recently got myself an Arduino Uno, I am trying to use it as an ISP and upload the hex file with avrdude. I am working with OSX. Mainly I have been following this tutorial: http://www.ernstc.dk/arduino/2313.htmI also read (among many other stuff) this thread: ( http://arduino.cc/forum/index.php/topic,84943.0.html) According to the tutorial I connected the 2313 to the Arduino board. Some things are not clear to me, hopefully someone can help me a bit. I do not want to program the 2313 using the Arduino IDE, I just want to upload an existing hex file with avrdude. Do I need to install the Tiny-core as explained in the tutorial for this? If so, I need some help with that as well. I tried to install it according to the ReadMe.txt but I can't get the new options to show up in the Tools->Board menu in the Arduino IDE. I extracted the Tiny-core into Documents/Arduino/libraries/hardware/ while the IDE was closed, but when I started it again I didn't have any new options. I figured out how to install the Tiny-core. For anyone who might also have problems with this: Go to your application folder and Ctrl-Click the Arduino.app file and choose Show Package Contents. Then navigate to the Contents/Resources/Java/hardware folder and copy the tiny folder into it. I uploaded the ArduinoISP sketch to the Arduino and tested it with an LED, which was fading on and off so I guess at least that worked. Hopefully someone can give me a few pointers in the right direction.
|
|
|
|
« Last Edit: January 20, 2013, 12:39:52 pm by gringle »
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #1 on: January 20, 2013, 02:32:59 pm » |
OK, so you are using and Arduino as ISP and attempting to upload a sketch? You should be able to use avrdude from the command line to do that. Also I have a sketch that uploads .hex files without using avrdude at all (the wiring is slightly different). It should work for that chip but I haven't tested it. Read more here: http://www.gammon.com.au/forum/?id=11638My main PC is being repaired so I can't give more details right now. Maybe someone else can.
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
God Member
Karma: 19
Posts: 674
|
 |
« Reply #2 on: January 20, 2013, 04:12:52 pm » |
I have no experience with OSX, but the principle should be the same. Try doing an upload using the ArduinoISP to the Attiny2313, for example the blink sketch. Enable verbose output: File->preference -> check the box: verbose during upload You can now see how the Arduino IDE handles the upload. On a Windows machine it looks something like this (stripped fot the path information) avrdude -p t2313 -c arduino -P COM3 -b115200 -D -Uflash:w:Blink.hex:i Now you can copy this line to a command line, and substitute the Blink.hex with the hex file you wnat to upload. A guide to using Avrdude: http://www.ladyada.net/learn/avr/avrdude.html
|
|
|
|
« Last Edit: January 20, 2013, 04:14:25 pm by Erni »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #3 on: January 21, 2013, 12:27:53 pm » |
Thanks for your answers.
Nick, I had a look at your solution, it looks interesting but might be a bit too much for what I'm trying to do.
Thanks for the tip about the verbose output, Erni. Since I was able to install Tiny-core now, I'll give it a try. Maybe I tried the wrong avrdude command.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #4 on: January 22, 2013, 03:17:51 am » |
Ok, so I rechecked the wiring and did everything according to http://www.ernstc.dk/arduino/2313.htm. I uploaded ArduinoISP and checked with an LED on pin 9. Then I unplugged the Arduino Board, connected the capacitor from Ground to Reset, plugged it in again, chose ATtiny2313@1MHz in the Board menu and tried to upload the Blink sketch. This is what I got: avrdude: stk500_getsync(): not in sync: resp=0xe0 I unplugged and replugged the Arduino again and tried the same with ATtiny@8Mhz: Same error. This is all with AVR ISP chosen as programmer. When I try this with Arduino as ISP, I get a lot more avrdude: Send and avrdude: Recv messages but it ends with avrdude: ser_recv(): programmer is not responding avrdude: stk500_recv(): programmer is not responding Any idea what I might be doing wrong?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10134
|
 |
« Reply #5 on: January 22, 2013, 03:24:34 am » |
How did you disable auto-reset on your Uno?
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
God Member
Karma: 19
Posts: 674
|
 |
« Reply #6 on: January 22, 2013, 04:43:23 am » |
When I try this with Arduino as ISP That is the correct option. I have updated the tutorial in http://www.ernstc.dk/arduino/2313.htm
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #7 on: January 22, 2013, 05:59:57 am » |
Thanks for the update, I will try this when I get home this evening. @Coding Badly: I thought this was done with the 10 µF capacitor from reset to ground as it was mentioned in Ernis tutorial and also at http://arduino.cc/en/Tutorial/ArduinoISP. Do I also need a 120 Ohm resistor between 5V and Reset?
|
|
|
|
|
Logged
|
|
|
|
|
South Texas
Offline
God Member
Karma: 8
Posts: 976
|
 |
« Reply #8 on: January 22, 2013, 12:02:33 pm » |
When I have used my Arduino as ISP I used a 120 ohm resistor and no capacitor. Programmed ATMega328s and ATtiny2313s. I was developing an ATTiny2313 based Stepper Driver - http://arduino.cc/forum/index.php/topic,84809.15.html - if you look at reply 25 there is a picture of the board I made for programming 328s and 2313s. I put the resistor as part of the connector that plugs into the Arduino. I made a cable that goes to a 6 oin ISP plug that is done in a similar fashion. As is always the rule when having problems - double check your wiring yet again.
|
|
|
|
« Last Edit: January 22, 2013, 12:04:04 pm by kf2qd »
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10134
|
 |
« Reply #9 on: January 22, 2013, 01:20:29 pm » |
It is. Do I also need a 120 Ohm resistor between 5V and Reset? That is very very unlikely.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10134
|
 |
« Reply #10 on: January 22, 2013, 01:21:44 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #11 on: January 22, 2013, 01:36:37 pm » |
Still the same result, I uploaded the different ArduinoISP sketch, unplugged the board, put the capacitor in, selected ATtiny2313@1Mhz and Ardunino as ISP and then clicked Upload with programmer.
programmer is not responding.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10134
|
 |
« Reply #12 on: January 22, 2013, 01:48:08 pm » |
The suggestion was meant to overcome this... avrdude: stk500_getsync(): not in sync: resp=0xe0 I suggest posting verbose output from avrdude. Please use [code] [/code] tags.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #13 on: January 22, 2013, 02:18:01 pm » |
Oh, sorry, the "not in sync" error was due to the "AVR ISP" I had set as programmer. When I switched it to "Arduino as ISP" I only get the "programmer not responding" error. Here is the avrdude output: avrdude: Version 5.11, compiled on Sep 2 2011 at 18:52:52 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf" User configuration file is "/Users/gringle/.avrduderc" User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/tty.usbmodem1d11 Using Programmer : stk500v1 Overriding Baud Rate : 19200 avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] avrdude: Recv: . [14] avrdude: Recv: . [10] AVR Part : ATtiny2313 Chip Erase delay : 9000 us PAGEL : PD4 BS2 : PD6 RESET disposition : possible i/o RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail :
Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 6 4 0 no 128 4 0 4000 4500 0xff 0xff Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- flash 65 6 32 0 yes 2048 32 64 4500 4500 0xff 0xff Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00
Programmer Type : STK500 Description : Atmel STK500 Version 1.x firmware avrdude: Send: A [41] . [80] [20] avrdude: Recv: . [14] avrdude: Recv: . [02] avrdude: Recv: . [10] avrdude: Send: A [41] . [81] [20] avrdude: Recv: . [14] avrdude: Recv: . [01] avrdude: Recv: . [10] avrdude: Send: A [41] . [82] [20] avrdude: Recv: . [14] avrdude: Recv: . [12] avrdude: Recv: . [10] avrdude: Send: A [41] . [98] [20] avrdude: Recv: . [14] avrdude: Recv: . [00] avrdude: Recv: . [10] Hardware Version: 2 Firmware Version: 1.18 Topcard : Unknown avrdude: Send: A [41] . [84] [20] avrdude: Recv: . [14] avrdude: Recv: . [00] avrdude: Recv: . [10] avrdude: Send: A [41] . [85] [20] avrdude: Recv: . [14] avrdude: Recv: . [00] avrdude: Recv: . [10] avrdude: Send: A [41] . [86] [20] avrdude: Recv: . [14] avrdude: Recv: . [00] avrdude: Recv: . [10] avrdude: Send: A [41] . [87] [20] avrdude: Recv: . [14] avrdude: Recv: . [00] avrdude: Recv: . [10] avrdude: Send: A [41] . [89] [20] avrdude: Recv: . [14] avrdude: Recv: . [00] avrdude: Recv: . [10] Vtarget : 0.0 V Varef : 0.0 V Oscillator : Off SCK period : 0.1 us
avrdude: Send: A [41] . [81] [20] avrdude: Recv: . [14] avrdude: Recv: . [01] avrdude: Recv: . [10] avrdude: Send: A [41] . [82] [20] avrdude: Recv: . [14] avrdude: Recv: . [12] avrdude: Recv: . [10] avrdude: Send: B [42] # [23] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] [20] . [00] . [80] . [00] . [00] . [08] . [00] [20] avrdude: Recv: . [14] avrdude: Recv: . [10] avrdude: Send: E [45] . [05] . [04] . [d4] . [d6] . [01] [20] avrdude: Recv: . [14] avrdude: Recv: . [10] avrdude: Send: P [50] [20] avrdude: ser_recv(): programmer is not responding avrdude: stk500_recv(): programmer is not responding
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10134
|
 |
« Reply #14 on: January 22, 2013, 02:36:00 pm » |
Your wiring is wrong. Very likely a short-circuit brought about when the programmer (your Uno) attempts to enable programming mode on the target (the ATtiny2313).
I suggest you put 220 ohm (or higher) series resistors on the SPI and RESET connections between the programmer and the target before you damage one or both sides.
|
|
|
|
|
Logged
|
|
|
|
|
|