Just not quite ready to zap my only working Arduino.... I guess I am wearing my chicken suit...
OK, I just checked the binaries and fuse settings for the 16U2 chip on the Uno-R3, and they're all the same as for the 8U2. So to upload to the Uno R3 all you need to do is modify line 11 of program_usbisp.bat
to read
-p [color=red]atmega16U2[/color] -P com%PORT% -b %BAUD% -c stk500v1 -v -e -u ^
Cool,
One ques. The jumper, does it need to be held constant? Or can I like put a pushbutton there and just hold it while I first plug it in, or just when uploading?
To stay in ISP mode the jumper needs to be constantly in-place. As soon as the jumper is removed it reverts to "normal" mode (or after a few seconds timeout, if in the middle of executing a programming command).
I had a go at converting Adaloader to write the 8U2 firmware, but it seems to get its flash pages in a muddle. If I can get it to work you won't need the second Arduino: updating the 8U2 would be as simple as loading a sketch, connecting a few wires, and hitting reset.
I think that im gonna put a mini dipswitch when I get my board, a jumper I think is more prone to get lost lol
So with this setup is it possible to bootload a chip without having a bootloaded chip already and with only 1 arduino uno?
I fried my chip and accidentally bought blank chips...
I have an Uno R3 and I can't get this setup to work.
Forgive me if I'm being stupid.
Whalen, right now you need two Arduinos to make this work. And at least one of those Arduinos has to have a working bootloader on the ATmega328p chip. See the instructions and pictures in the zip file on my web page for more detail.
In theory it's possible with just one Arduino, but I haven't got this working yet.
Well, I have a bootloaded chip on the way but I'm about as patient as a 7 year old on Christmas Eve.
Can I use my usbasp to upload this to the 16u2?
If I use avrdude all I need to change is the at90usb162 and -c usbasp, do the fuses and upload that hex right? Id try it now but im repairing my 10 to 6pin connector and ran out of butane for my iron
That sounds right, but I'm unfamiliar with the usbasp programmer.
Ok so I think im successful with my uno r3 and the usbasp, however I don't have proper jumpers to actually test it
but this works with ide 1.0 right? All I should need to do is connect jumper and upload using arduino as isp?
To test the serial mode you don't need any jumpers - just use the board as if it were a totally normal Uno.
Running test_serial.bat
will connect avrdude to the 328P's bootloader and report the Optiboot version number (amongst other things).
To try the ISP mode, connect the 8U2 to the 328p ISP header as follows:
- MISO-16U2 to MISO-328p
- SCK-16U2 to SCK-328p
- MOSI-16U2 to MOSI-328p
- PB7-16U2 to RST-328p
- PB6-16U2 to PB4-16U2
Check the drawings in the docs folder of the zip file for the relevant pin locations.
In this mode the 16U2 chip will behave just like an ArduinoISP. Running test_isp.bat
will connect avrdude to the 16U2's ISP code and report the arduino-usbisp version number (of which the minor version number is really the number of bytes of free memory).
With the jumpers in place you may update the 328p's bootloader with the IDE: Select "Board -> Uno", "Programmer -> Arduino as ISP", followed by "Burn bootloader".
I tested the serial uploading programs to a bootloaded 328 with the ide, I had to reinstall the driver I guess with different firmware it was a different version, still neeed to try the isp, unfortunately I gotta wait for some female-female jumpers to come, I dont have anything to bootleg to the pins other than female headers and that gets messy and wastes headers lol,
I haven't used arduino as isp before but would a 328 instead of a 328p cause problems with the signature?
Be Very careful of using 'mini' dip switches... they have a reputation for Failure when frequently or infrequently used.
Back in the day, before I retired I had occasion to use them (Dip Switches and hand soldering would 'kill them' regularly
if they were for example not all off or on, I can't remember now which but after 2 'failed, intermittent design's I quit
specifying them in my work.
Doc.
The programmer doesn't care about the chip signature, so you can use it to burn a bootloader to the 328(not-P) chip. You might not be able to do it with the IDE GUI, however -- AFAIK all the official Arduino boards use the 328P.
Here's a little script to write the Uno bootloader to a blank chip (change set BINARY=
to point to your preferred bootloader). With the -F options it should ignore the chip signature and upload to a 328(not-P), although I don't have one of these chips myself. Paste the code into a .bat file inside the hardware\arduino\firmwares\arduino-usbisp
directory. Let us know how you get on.
@echo off
REM 8U2 in ISP mode
REM Burn Optiboot bootloader
set TOOLS=..\..\..\tools
set AVRDUDE="%TOOLS%\avr\bin\avrdude"
set AVRCONF="%TOOLS%\avr\etc\avrdude.conf"
set BINARY=..\..\bootloaders\optiboot\optiboot_atmega328.hex
set BAUD=19200
set /p PORT=Enter port number:
"%AVRDUDE%" -C %AVRCONF% ^
-p atmega328p -F -P COM%PORT% -b %BAUD% -c stk500v1 -e -u ^
-U lock:w:0x3f:m ^
-U efuse:w:0x05:m ^
-U hfuse:w:0xDE:m ^
-U lfuse:w:0xFF:m
"%AVRDUDE%" -C %AVRCONF% ^
-p atmega328p -F -P COM%PORT% -b %BAUD% -c stk500v1 -v ^
-U flash:w:%BINARY% ^
-U lock:w:0x2f:m
pause
Yeah im actually using a mini non momemtary push button I found, I couldn't find a single dip switch, all I had was a quad and more
ill let you know how the chips go in a bit, just bought three 328p from digikey
How about taking this idea and making a board that could replace the FTDI Breakout Board with the additional feature of an on-board ISP? 2 functions for about the price of either. One of the vendors like Sparkfun or others might be interested.
The chips came in, and the jumpers of ebay
I already reprogrammed the 16u2 in my rev3 with a usbisp
I added a nonmomemtary push button across the right pins,
I selected arduino as isp in the ide, clicked burn bootloader
then uploaded a fresh blink sketch
100% perfect success, I think they should add this to rev.4
Then since it will come preloaded on the 16u2 just about anyone who buys an arduino can very easily burn bootloaders without any additional hardware or isp their own board for some extra space,
excellent and thank you for this project!
Ooof, first feedback! Thanks for the report and the kind comments.
In the meantime I've made an Arduino sketch to update the 8U2/16U2 (thanks to some neat work by Nick Gammon), so it is now possible to make an Uno update itself - no need for a second Arduino or other programmer. If any body fancies trying it I'll dig it out.