Hi,
I want to use the Arduino hardware to run the USBtiny software. The reason is that I want to be able to offer my customers firmware updates for their ATTINY-based product but I don't want them to have to buy a USBtiny to deliver it (they all have an Arduino, so why not use that as the programmer).
Is this possible? Has it been done? if not, what changes to the USBtiny source code would be required, other than timing adjustment?
I suspect it may be a much bigger job than that, but I would like to know what you think.
I'm aware of the High-Low Lab Arduino-as-ISP method, but it seems that an implementation of USBtiny on the Arduino hardware would be a much more versatile thing to have. For one thing, the ATTINY13 (my target device in this case) is not supported in the Arduino IDE and requires extensive further hacking which would be beyond many of my audience. For another thing, lots of people when they move up from Arduino will be programming and compiling their apps in other environments (AVR studio for example) and they just want a low cost way to get their hex file onto their target device.
Look forward to hearing people's ideas on this, thanks.
// Simon
Is it possible to use the Arduino as a USBtiny ???
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 30
- Joined: Sun Jun 28, 2009 4:29 am
-
- Posts: 101
- Joined: Sat Jul 28, 2012 8:01 am
Re: Is it possible to use the Arduino as a USBtiny ???
A simple Google search turned up this.......
Programming an ATtiny w/ Arduino 1.0.1
http://hlt.media.m it.edu/?p=1695 (remove space between - m it)
This procedure is explained in the tutorial:
1. You need to add the ATtiny chip support to the Arduino software
2. Unplug the chip from the board
3. Insert chip into a breadboard and connect / wire it to the Arduino
4. Use AVRdude to re program the chip.
Happy bricking!!!
Programming an ATtiny w/ Arduino 1.0.1
http://hlt.media.m it.edu/?p=1695 (remove space between - m it)
This procedure is explained in the tutorial:
1. You need to add the ATtiny chip support to the Arduino software
2. Unplug the chip from the board
3. Insert chip into a breadboard and connect / wire it to the Arduino
4. Use AVRdude to re program the chip.
Happy bricking!!!
-
- Posts: 30
- Joined: Sun Jun 28, 2009 4:29 am
Re: Is it possible to use the Arduino as a USBtiny ???
Thanks for replying.
Without meaning to be rude, I did specifically say that I am aware of this method and it does not work for me.
What I want to do is to run a port of the USBtiny software on the Arduino.
Without meaning to be rude, I did specifically say that I am aware of this method and it does not work for me.
What I want to do is to run a port of the USBtiny software on the Arduino.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Is it possible to use the Arduino as a USBtiny ???
Actually, I think JD3 has given you the right answer. Why do you think this won't work for you? The page links to instructions for using an Arduino as a programmer.
The rest of the instructions are written for programing the ATtiny as a bare chip, but they note that you can also program the chip in a circuit by using the ISP header pins (or equivalent):
The rest of the instructions are written for programing the ATtiny as a bare chip, but they note that you can also program the chip in a circuit by using the ISP header pins (or equivalent):
So, they to be everything you need - how to program an ATtiny in arduino, and how to use an arduino as a programmer.Connecting the ATtiny
You’ll need to provide power to the ATtiny and connect it to your programmer. That is, connecting MISO, MOSI, SCK, RESET, VCC, and GND of the programmer to the corresponding pins on the ATtiny. (Or, if you’re using an circuit w/ an ATtiny, simply connect the programmer to the ISP header on the board – you may also need to power the board separately.)
-
- Posts: 30
- Joined: Sun Jun 28, 2009 4:29 am
Re: Is it possible to use the Arduino as a USBtiny ???
That whole tutorial is based around the idea of programming the target device in the Arduino IDE, which I don't want to do and can't anyway in this case b/c the TINY13 isn't supported. @JD3 in his summary instructions mentioned avrdude, but the page itself doesn't mention using avrdude. However, if it were possible to skip the Arduino IDE and deal directly with avrdude, then this might indeed do exactly what I want (perhaps that is what @JD3 was suggesting) How would I discover the avrdude syntax to address the Arduino-as-programmer from the command line? It would be interesting to see what programmer option is specified when you choose 'Arduino as ISP' from the Programmer menu. What I mean is, when I program a TINY13 using my Sparkfun pocket programmer, I say:
avrdude -c usbtiny -p T13 -U flash:w:prog.hex
When the IDE (invisibly) addresses the Arduino as ISP, does it also say "-c usbtiny" or is the Arduino emulating a different programmer?
avrdude -c usbtiny -p T13 -U flash:w:prog.hex
When the IDE (invisibly) addresses the Arduino as ISP, does it also say "-c usbtiny" or is the Arduino emulating a different programmer?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Is it possible to use the Arduino as a USBtiny ???
The answer is in the page on using an arduino as an ISP;
If you look at that sketch, it says that it emulates an STK500 programmer. You would configure avrdude accordingly. If you're not sure about how to do that, go into preferences in the Arduino IDE and select verbose output during upload. The IDE uses avrdude to do its programming. You can just copy whatever avrdude command the IDE issues.Turning the Arduino board into a programmer
We’re going to use the Arduino board to program the ATtiny. First, we’ll need to turn the Arduino board into an “in-system programmer” (ISP). To this:
Run the Arduino development environment.
Open the ArduinoISP sketch from the examples menu.
Note for Arduino 1.0: you need to make a small change to the ArduinoISP sketch before uploading it. Find the line in the heartbeat() function that says “delay(40);” and change it to “delay(20);”.
Select the board and serial port that correspond to your Arduino board.
Upload the ArduinoISP sketch.
-
- Posts: 30
- Joined: Sun Jun 28, 2009 4:29 am
Re: Is it possible to use the Arduino as a USBtiny ???
Good point. I had forgotten about the verbose option.
This ought to work just fine. I will test it later today and let you know. Thanks for your input!
This ought to work just fine. I will test it later today and let you know. Thanks for your input!
-
- Posts: 30
- Joined: Sun Jun 28, 2009 4:29 am
Re: Is it possible to use the Arduino as a USBtiny ???
So it does work. The _MIT_ Arduino sketch turns the Arduino into a STK500v1 emulator. It's a little flaky (sometimes there's a failure to communicate with the target device, but then retrying results in success). The capacitor on the Arduino's reset pin is necessary on my Duemilanove.
If you just want to use the Arduino as a programmer to upload hex files to tiny and mega chips you can do that. There's no need to install the attiny45_85 pack. I do recommend that you do an upload (of anything, it doesn't matter) to your Arduino with verbose output enabled so that you can copy the path part of the avrdude syntax to the clipboard, as it will simplify using avrdude once the Arduino-as-ISP sketch is loaded. You will see what I mean in a minute.
The avrdude syntax to upload test.hex to a tiny13 is:
Note: The com port is the same one normally used by the Arduino IDE to communicate with the Arduino board.
I have made a /hex folder under my winXP username.COMPUTERNAME folder where I put hex files to be uploaded to AVRs. Then when I open a command prompt I can just type cd hex and I'm where I need to be.
I just realised that I can simplify the avrdude syntax by putting everything up to ..com6 into a batch file called avrprog (which also sits in my /hex folder)
Then I just have to type, for example.
The batch file (avrprog.bat) is a text file containing just this:
The %1, %2 etc are the command line arguments that we want to pass to avrdude. 5 should be enough.
I hope this is useful to someone. I don't think it's very widely known that when you are ready to move up from the Arduino, you don't necessarily have to buy a programmer.
If you just want to use the Arduino as a programmer to upload hex files to tiny and mega chips you can do that. There's no need to install the attiny45_85 pack. I do recommend that you do an upload (of anything, it doesn't matter) to your Arduino with verbose output enabled so that you can copy the path part of the avrdude syntax to the clipboard, as it will simplify using avrdude once the Arduino-as-ISP sketch is loaded. You will see what I mean in a minute.
The avrdude syntax to upload test.hex to a tiny13 is:
Code: Select all
[full_path_to]/avrdude.exe -C [full_path_to]/avrdude.conf -c stk500v1 -b 19200 -P\\.\com6 -p t13 -U flash:w:test.hex
I have made a /hex folder under my winXP username.COMPUTERNAME folder where I put hex files to be uploaded to AVRs. Then when I open a command prompt I can just type cd hex and I'm where I need to be.
I just realised that I can simplify the avrdude syntax by putting everything up to ..com6 into a batch file called avrprog (which also sits in my /hex folder)
Then I just have to type
Code: Select all
avrprog -p t13 -U flash:w:test.hex
The batch file (avrprog.bat) is a text file containing just this:
Code: Select all
[full_path_to]/avrdude.exe -C [full_path_to]/avrdude.conf -c stk500v1 -b 19200 -P\\.\com6 %1 %2 %3 %4 %5
I hope this is useful to someone. I don't think it's very widely known that when you are ready to move up from the Arduino, you don't necessarily have to buy a programmer.
Please be positive and constructive with your questions and comments.