I've finally got myself a virgin ATMega328p and without uploading a bootloader, I've uploaded a simple variation of Blink and thought it was broken until I realised that because I hadn't set the fuses, the MCU was just using internal clock and running at 1MHz intead of 16MHz (I've included a crystal on my board).
So I'm thinking that if I set my fuses to the same as my ATMega328p Uno then I should be OK.
But I can't find what the bytes should be - could someone tell me please (I've given up trying to read them out from my Uno :( )
And of course, if the fuses should be different for a non-bootloader 16Mhz crystal clocked ATMega328p than my Uno, could I have those instead :)
regards
Simon
I had exactly the same issue when I programmed my first 328! You can work out the fuse settings you need at http://www.engbedded.com/fusecalc (http://www.engbedded.com/fusecalc).
PS - If you just want the same ones as used in a standard Arduino, you can find them in the boards.txt file:
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
boards.txt
Ta :)
I used the values in there and used my little USBasp programmer with
avrdude -c usbasp -p m328p -C ../etc/avrdude.conf -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m
and my project imeidiately started running at the correct speed :)
Simon
How about these:
Fuse calculator: http://www.engbedded.com/fusecalc/
Arduino Default Fuses: http://www.codingwithcody.com/2011/04/arduino-default-fuse-settings/
Don
Hi,
These setting did it for me too... 16mhz atmega328p.
lfuse = 0xff
hfuse = 0xde
efuse = 0x05
Thanks.
Have you heard of the phrase "a day late and a dollar short" out there in zeroland?
What has this post (to a stale thread) added that wasn't already said in the very first reply?
Don
I had exactly the same issue when I programmed my first 328! You can work out the fuse settings you need at http://www.engbedded.com/fusecalc (http://www.engbedded.com/fusecalc).
PS - If you just want the same ones as used in a standard Arduino, you can find them in the boards.txt file:
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
Hi dc42.
I am getting similar issues as this with a 328p-au..
I've tried alsorts but am a bit stuck:
http://arduino.cc/forum/index.php/topic,129740.0.html (http://arduino.cc/forum/index.php/topic,129740.0.html)
Any ideas?
Thanks in advance.
I've tried alsorts but am a bit stuck:
Have you tried either the default values or the values recommended in this thread?
Don
When I use the Arduino IDE to flash the bootloader it always sets the proper fuses without any interaction on my behalf.
I've been doing the same - burn a Uno bootloader to set the fuses.Then upload my sketch via File :Upload Using programmer.
Hi dc42.
I am getting similar issues as this with a 328p-au..
I've tried alsorts but am a bit stuck:
http://arduino.cc/forum/index.php/topic,129740.0.html (http://arduino.cc/forum/index.php/topic,129740.0.html)
Any ideas?
Thanks in advance.
Looking at your post #7 in that thread, you are setting the baud rate to 300 on the mcu but then you have to set the PC to 2400 to communicate with it. So the UART in the mcu is running 8x faster than it should be. This isn't a problem with the CLKSEL fuse bit, that would cause the mcu to run 8x slower instead.
Are you sure that you have F_CPU set correctly in the boards.txt file you are using? Do you also find that delay and delayMicroseconds calls also execute 8x faster than they should?
Hi dc42.
I am getting similar issues as this with a 328p-au..
I've tried alsorts but am a bit stuck:
http://arduino.cc/forum/index.php/topic,129740.0.html (http://arduino.cc/forum/index.php/topic,129740.0.html)
Any ideas?
Thanks in advance.
Looking at your post #7 in that thread, you are setting the baud rate to 300 on the mcu but then you have to set the PC to 2400 to communicate with it. So the UART in the mcu is running 8x faster than it should be. This isn't a problem with the CLKSEL fuse bit, that would cause the mcu to run 8x slower instead.
Are you sure that you have F_CPU set correctly in the boards.txt file you are using? Do you also find that delay and delayMicroseconds calls also execute 8x faster than they should?
Thanks for getting back to me Don.
From using the calculator I managed to get the baud correct with:
lfuse:w:0x77:m
(I know this is probably incorrect).
..and from messing about trying to set the fuses again I am back to the same issue of the baud reading out incorrectly and chasing my tail..
The board.txt is set to:
--------------------------------------------------------------------------------------
##############################################################
uno.name=Arduino Uno
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard
--------------------------------------------------------------------------------------
The following worked when I had the baud reading at the correct rate:
- IDE does not upload
- AVRDude upload via Arduino ISP works
- Upload in IDE via Arduino ISP works
- Serial feedback (TX-RX loop) works [328 bypassed]
- Serial feedback via 328P works
- Holding reset at various times before/during/on upload no dice
- f_cpu=16000000L
I've double checked all my schematics, including the pull down 1k, 100nf cap between the 8u2 and the reset on the 328P-AU.
I have also removed and resoldered these components.
Could this be an issue with the 8u2?
I have managed to run the DFU many times with the same code I uploaded on to my R3 and this still uploads and works.
Thanks in advance for any suggestions!
So do delay() calls in sketches you upload delay for the correct amount of time or not?
So do delay() calls in sketches you upload delay for the correct amount of time or not?
Sorry, got my last post incorrect..
A delay(1000) posts at roughly 1 second. However the baud is mismatched.
So do delay() calls in sketches you upload delay for the correct amount of time or not?
If you mean in a main body of code, they are not, also my baud is mismatching again..
Do they take too long? or not enough time? By what factor are they wrong?
So do delay() calls in sketches you upload delay for the correct amount of time or not?
If you mean in a main body of code, they are not, also my baud is mismatching again..
Do they take too long? or not enough time? By what factor are they wrong?
Sorry, I tried that again.
A delay(1000) posts roughly every second. The baud is mismatched..
Is the baud rate mismatched only when you are uploading a program through the bootloader, or it is also mismatched when you do a Serial.begin followed by a Serial.print ?
My head is spinning a little so please excuse me if I have missunderstood you here, but..
This is the sketch I am using:
--------------------------------------------
void setup()
{
Serial.begin(300);
void loop()
{
Serial.println("Hello world!");
delay(1000);
}
--------------------------------------------
When I bring up the serial monitor it posts at baud 2400 every second.
In summary:
1. Delay calls execute in the correct amount of time. So the clock is almost certainly running at the right speed.
2. To communicate with the serial port of the device, you have to set the PC to a baud rate 8x higher than the device is supposedly set to.
Therefore, either the PC software is at fault and is running at a baud rate 8x lower than you ask for, or the UART in your 328p-au is running at a baud rate 8x higher than you ask for. Can you connect to a standard Arduino at 2400 baud using the same board setting, to verify that the PC software is operating correctly?
I've just tried to communicate with my Arduino Uno at 300 baud, and it doesn't work. It works at higher baud rates. Maybe a bug in the Arduino software? Try a higher baud rate.
You might also like to upload the following sketch to see what the UART baud rate divisor is set to:
void setup()
{
Serial.begin(2400);
}
void loop()
{
Serial.print((int)UBRR0H, HEX);
Serial.write(',');
Serial.print((int)UBRR0L, HEX);
Serial.write(',');
Serial.println((int)UCSR0A, HEX);
delay(1000);
}
I tried changing my port settings, this seemed to make no difference regardless of what I set the baud to..
I uploaded the sketch you kindly put up.
I had to change the begin from (2400) to (14400) as there was no option for x8 baud in the serial monitor.
This is what I got back:
"0, 8A, 2
0, 8A, 42
0, 8A, 42
0, 8A, 42
0, 8A, 42..." (repeats)
Until I hit reset and then it repeats from "0, 8A, 2".
All possible serials that are readable by IDE (serial x8):
14400 / serial 115200:
"0, 8A, 2
0, 8A, 42
0, 8A, 42
0, 8A, 42.."
4800 / serial 38400:
"1, A0, 2
1, A0, 42
1, A0, 42
1, A0, 42.."
2400 / serial 19200:
"3, 40, 2
3, 40, 42
3, 40, 42
3, 40, 42.."
1200 / serial 9600:
"6, 82, 2
6, 82, 42
6, 82, 42
6, 82, 42.."
and finally
300 / serial 2400:
"D, 4, 0
D, 4, 40
D, 4, 40
D, 4, 40.."
Can you remind me what you have connected between the microcontroller TxData pin and the PC?
The bad rate divisors from your data look OK to me. I'm wondering whether the USART is operating in synchronous master mode instead of asynch mode - that could explain the x8 speed. Try this sketch, which reads back all the USTAT control registers:
void setup()
{
}
void loop()
{
Serial.begin(2400);
byte ubrr0h = UBRR0H;
byte ubrr0l = UBRR0L;
byte ucsr0a = UCSR0A;
byte ucsr0b = UCSR0B;
byte ucsr0c = UCSR0C;
//Serial.begin(2400);
Serial.print((unsigned int)ubrr0h, HEX);
Serial.write(',');
Serial.print((unsigned int)ubrr0l, HEX);
Serial.write(',');
Serial.print((unsigned int)ucsr0a, HEX);
Serial.write(',');
Serial.print((unsigned int)ucsr0b, HEX);
Serial.write(',');
Serial.println((unsigned int)ucsr0c, HEX);
delay(1000);
}
At 2400 baud I get: 3,40,62,98,6.
Running the low fuse CLKDIV8 (0x77) posts at the selected baud but 8x slower, as expected..
I get back:
Serial(S)/Result(R):
S:300
R:??"?|?"
(All other bauds are similar garbage)
S:1200
R:"6, 82, 2
6, 82, 42.."
S:2400
R:"3, 40, 2
3, 40, 42.."
S:4800
R:"1, A0, 2
1, A0, 42.."
S:9600
R:"0, CF, 2
0, CF, 42.."
S:14400
R:",` @¢ü,` Pm ,` Pm "
(All other bauds are similar garbage)
S:19200
R:"0, 67, 2
0, 67, 42.."
S:28800
R:"¸øó¸¸h¸¸h"
(All other bauds are similar garbage)
S:38400
R:"0, 33, 2
0, 33, 42.."
S:57600
R:"0, 10, 0
0, 10, 40.."
S:115200
R:"0, 10, 2
0, 10, 42.."
The Delay(1000) is now running posts at roughly 8 seconds (which I gather is expected?).
I hope this helps in some way.
I was just reading up on these commands and from what I gather they are to do with the Usart.
In terms of design, could noise from the crystal or other sources cause this issue, or is my design safe in terms of the mechanics?
IE is this a definite IC issue..
Could this be caused by the IC overheating, or is it something software orientated?
I'm just wondering as if my design is stable, at least I can move on from the actual design of the PCB itself, and start to focus on changing over IC's etc instead of having to knock up board after board trying new things..
Can you remind me what you have connected between the microcontroller TxData pin and the PC?
The bad rate divisors from your data look OK to me. I'm wondering whether the USART is operating in synchronous master mode instead of asynch mode - that could explain the x8 speed. Try this sketch, which reads back all the USTAT control registers:
void setup()
{
}
void loop()
{
Serial.begin(2400);
byte ubrr0h = UBRR0H;
byte ubrr0l = UBRR0L;
byte ucsr0a = UCSR0A;
byte ucsr0b = UCSR0B;
byte ucsr0c = UCSR0C;
//Serial.begin(2400);
Serial.print((unsigned int)ubrr0h, HEX);
Serial.write(',');
Serial.print((unsigned int)ubrr0l, HEX);
Serial.write(',');
Serial.print((unsigned int)ucsr0a, HEX);
Serial.write(',');
Serial.print((unsigned int)ucsr0b, HEX);
Serial.write(',');
Serial.println((unsigned int)ucsr0c, HEX);
delay(1000);
}
At 2400 baud I get: 3,40,62,98,6.
Upon changing the fuses back to default:
I get: 3,40,62,98,6.
So that checks out!
I am using an ATMEGA8u2-AU for Tx/Rx..
The programming on the atmega328p looks OK, and if delay calls are taking the right amount of time then the clock speed is correct. So my best guess it that it's something to do with the 8u2 programming, or the PC device driver, or a mismatch between the two. I think the PC sends a code to the 8u2 to tell it what baud rate to use, but maybe the meanings assigned to the codes in the 8u2 software are not the same as the ones used in the PC driver.
I had a feeling there might be a problem between the PC and 8U2..
At least I'm not going nuts..
Basically the firmware I use for my R3 16u2 works for DFU over USB.
As far as I understand there is no difference between the 8u2 and -au?
I had wondered before if I would need to burn the fuses on the 8u2 but believed it to be able to work straight 'out of the box'. (This is the first time I have got this far..)
Is there a way of buring the fuses via USB, or will I need to ISP?
I've just looked at the default settings for the 8u2 fuses in http://www.engbedded.com/fusecalc (http://www.engbedded.com/fusecalc) and it appears that it defaults to dividing the clock frequency by 8, just like the atmega328p. This explains why you need to set the PC to 8x the actual baud rate. I suggest you read the 8u2 datasheet to confirm this.
Unless you have put any bootloading code on the 8u2, you will need to program it via ICSP. How did you program it in the first place?
Ah.. I didnt..
Also I havent included a header in this design, I had messed up another part anyway, so just as well!
For now I will get this sorted, and hopefully it wil all lock in.
Fantastic, thanks for the help!
I have an Arduino Uno. Using PROGISP I think I accidentally overwrote the fuse settings to 0xD9E1, this thread says it should be set to 0x5DEFF. My Arduino was running blink code and it still is, but with the new clock its really slow, probably 10x slower. Unfortunately I can't just reset the fuse back to 0x5DEFF, PROGISP says it "Chip Enable Program Error." Arduino IDE gives
avrdude: stk500_getsync(): not in sync: resp=0x00
whenever I try to upload anything. Any suggestions on how to fix this? Did I brick my Arduino?
Reburn the bootloader from the IDE using an AVR ISP Programmer. That should reset the fuses.
If you can't, then it's time for a new chip.
If you've really set HFUSE to 0xE1, then you've disabled SPI programming, and indeed "bricked" your chip to the extent that you'll need a HV Parallel programmer to un-brick it. (However, you're not supposed to be able to disable SPI *using* SPI, so this shouldn't be the case.) Most likely, you've just programmed the crystal oscillator to a mode that doesn't work with the actual crystal you have installed, and you can fix it by injecting a clock "manually."
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=106325
Thanks, new chip it is. I've tried to burn the bootloader multiple times with no luck.
I should have a 555 timer laying around that I can try and use as a clock input, what is not clear to me is if I can simply use 1Mhz or if it needs to be some other multiple of what I might have set the chip to look for.
I managed a 7kHz wave with the parts I had laying around, does the frequency need to be higher? I have this signal going into pin 9 on my arduino but I still can't re-program it through PROGISP.
You have to feed in ISP commands clocked (SCLK signal) at a fraction of the rate that the cpu is running at (1/16?)
I don't know offhand which programmers allow you to set the clock to arbitrary rates, or which programming tool SW permit you to set it...
Adafruit has a version of ArduinoISP that provides a relatively fast clock on one of the extra pins, which can be fed into the target CPU...
Thanks for the replies. For ~$5 I can get a new Arduino pro mini, or for $4 I can get a new 328P chip, I'll just do one of those, its much easier : )
Get one with a bootloader on it, can use that one to bootload cheaper blank parts in the future.
If I just get a standard 328P replacement can't I just burn the bootloader on using the Arduino IDE?
No, you need a programmer - the programmer connects to the SPI pins for programmer the bootloader in. The IDE can do that, but you need a programmer.
An Arduino can be used as a programmer:
http://www.gammon.com.au/forum/?id=11635
Will this programmer do? https://www.sparkfun.com/products/9825
If not I have a $5 Arduino pro mini coming early next week.
Yes, that one will do.
In the IDE, select Tools:Programmer:USBasp
I have one but never set things up to use it, might be some driver setup needed as well.
I have my Arduino Pro Mini and I thought it would be easy to program it, but I haven't had any luck yet :(. Using my Sparkfun AVR pocket programmer ( https://www.sparkfun.com/products/9825 (https://www.sparkfun.com/products/9825) ) I'm trying to load the blink program. I have tried all the programmer types, none have worked. Most return;
avrdude: stk500_getsync(): not in sync: resp=0x00
The Pro Mini is powered and it looks like it came pre-programmed with blink. I'm trying to make it blink faster (really I'm just trying to verify my board & programmer all work) before I try and fix my other Arduino, or before I turn this Pro Mini into a quadcopter controller (the real reason I bought it).
I forgot to post images so here they are. I'm trying to program the Pro Mini using ICSP.
I am able to burn the bootloader to the device, but none of the programs I've tried. I'm confused :S. I'm using Arduino IDE (forgot to mention this).
Got it. I need to use "upload using programmer" instead of the usual verify/upload buttons.
Ok so I am thinking about fixing the fuse bits on my Arduino by using another of my Arduinos - I now have 2 Arduino Pro Minis. I've seen some links for using the Arduino as an AVR ISP but I dont think this is what I need, or at least its not totally complete as is; am I right? In this thread people have mentioned I need to send in a clock at a fraction of the incorrect clock the Arduino is currently set at, or the data comes in on a clock signal which is again a fraction of the incorrect clock, or something like this... I could use some help. I'm thinking this is the method I need to modify?
void start_pmode() {
spi_init();
// following delays may not work on all targets...
pinMode(RESET, OUTPUT);
digitalWrite(RESET, HIGH);
pinMode(SCK, OUTPUT);
digitalWrite(SCK, LOW);
delay(50);
digitalWrite(RESET, LOW);
delay(50);
pinMode(MISO, INPUT);
pinMode(MOSI, OUTPUT);
spi_transaction(0xAC, 0x53, 0x00, 0x00);
pmode = 1;
}
I believe the Fuse that I wrote to my Atmega328P is 0xD9E1
I'm thinking this is the method I need to modify?
Why bother? Just fetch Lady Ada's version of ArduinoISP that already has the necessary modifications.
Or, I believe Nick Gammon has a version.
Or, use this one...
https://code.google.com/p/arduino-tiny/downloads/list?can=2&q=tinyisp
Is that the same/similar thing to ArduinoISP sketch?
I mentioned three things. Which "that" are you referring to?
What I need is some help doing "high voltage parallel programming mode" (http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/ (http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/)) on an Arduino that has bad fuse bits set. The Arduino does function, its running the blink code, only really slowly. Its not the delay in the code, its the frequency the chip is running at from bad fuse bits. Also I can't reprogram the chip through SPI again because of the fuse bits.
Several people in this thread said I could fix it with another Arduino, I just dont know how.
I think that the closest you can get to HV parallel programming with an Arduino is this 5V "rescue" shield: http://mightyohm.com/blog/products/hv-rescue-shield-2-x/
The clock injection you can get with the adafruit-modified Arduino ISP is NOT parallel programming, and will not fix some "bricked" AVRs (although the clock injection with serial programming DOES fix the most common bricking scenarios.) (And ArduinoISP does not support HV parallel programming at all.)
Thanks. I was going to try and fix the Arduino for the experience, but at that price tag I'll probably just get a replacement like I had originally planned. I was hoping all I needed was a 2nd Arduino and nothing more.
What I need is some help doing "high voltage parallel programming mode" ... The Arduino does function, its running the blink code, only really slowly
Asserting RESET stops the blinking?
Hitting reset seems to lock it up. Blink code is loaded and if I hit reset the LED either stays off or stays on.
Try this...
http://forum.arduino.cc/index.php?topic=182138.msg1349664#msg1349664
Cool thanks I'll try it out.
Ok so I have a few questions about that thread you linked. How many Arduinos are involved in this method? Just the bad one right?
I've downloaded tiny-isp-2-0100-0001.zip and extracted it to it's own folder. _TinyISP_BuildOptions.h already had #define PROGRAMMER_SPI_CLOCK SLOW
in it so I left the file alone. The sketch compiles (no missing dependencies and such).
Using my USBTiny/USBTinyISP programmer ( https://www.sparkfun.com/products/9825 (https://www.sparkfun.com/products/9825) ) I tried to upload the sketch, no dice;
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
I'm able to upload this sketch on a good Arduino using the same programmer so I'm fairly confident I'm doing the steps right. Maybe the bit rate isn't slow enough? Let me know if you have any other ideas, thanks for your help.
How many Arduinos are involved in this method? Just the bad one right?
No. Two. One serves as a programmer. You upload the TinyISP sketch to that one then disable auto-reset.
Ok so after I've uploaded TinyISP to the good arduino, I connect the 2 arduino's together like whats shown here? http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)
Once the 2 Arduinos are wired up, my connections go programmer -> TinyISP -> bad Arduino ?
My good Arduinos are Pro Minis, so no usb. I have a USB programmer to go along with them, but I'm not sure if that will work or not. Here is how they're currently connected (http://www.ebay.com/itm/NEW-Arduino-Pro-Mini-USB-Programmer-Newest-Design-USA-Seller-FAST-Shipping/231303057344?_trksid=p2047675.c100012.m1985&_trkparms=aid%3D444000%26algo%3DSOI.DEFAULT%26ao%3D1%26asc%3D24895%26meid%3Dc6181dd0811c4615a13198a0819fc114%26pid%3D100012%26prg%3D10500%26rk%3D3%26rkt%3D10%26sd%3D231296779901 (http://www.ebay.com/itm/NEW-Arduino-Pro-Mini-USB-Programmer-Newest-Design-USA-Seller-FAST-Shipping/231303057344?_trksid=p2047675.c100012.m1985&_trkparms=aid%3D444000%26algo%3DSOI.DEFAULT%26ao%3D1%26asc%3D24895%26meid%3Dc6181dd0811c4615a13198a0819fc114%26pid%3D100012%26prg%3D10500%26rk%3D3%26rkt%3D10%26sd%3D231296779901));
USB programmer -> UsbTiny -> Bad Arduino via ISP
If this is correct, what code do I try to push onto the bad arduino? Just do a bootloader fix?
I tried it out and now both arduino's are running blink at the same wrong clock speed :~
They both blink in sync, 16 seconds on, 16 off
Ok so after I've uploaded TinyISP to the good arduino, I connect the 2 arduino's together like whats shown here? http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)
Yes.
Once the 2 Arduinos are wired up, my connections go programmer -> TinyISP -> bad Arduino ?
No. As I stated earlier, the "good" Arduino acts as the programmer. Your dedicated programmer is not involved.
I have a USB programmer to go along with them, but I'm not sure if that will work or not.
Does not matter. It is not involved.
If this is correct, what code do I try to push onto the bad arduino? Just do a bootloader fix?
Select the correct board under the Tools / Board menu. Execute Tools / Burn Bootloader.
No. As I stated earlier, the "good" Arduino acts as the programmer. Your dedicated programmer is not involved.
Right but my Arduino Pro Mini which doesn't have onboard USB has no way to connect to my computer. Usually I connect it through ICSP but those pins are now going to be used to program the bad Arduino, right?
I tried it out and now both arduino's are running blink at the same wrong clock speed
Even after you disconnect them from one another? It turns out that the LED pin IS one of the signals used to connect the two arduinos, so both LEDs will flash when the non-broken one does the flashing...
My good Arduinos are Pro Minis, so no usb. I have a USB programmer to go along with them, but I'm not sure if that will work or not. Here is how they're currently connected (http://www.ebay.com/itm/NEW-Arduino-Pro-Mini-USB-Programmer-Newest-Design-USA-Seller-FAST-Shipping/231303057344?_trksid=p2047675.c100012.m1985&_trkparms=aid%3D444000%26algo%3DSOI.DEFAULT%26ao%3D1%26asc%3D24895%26meid%3Dc6181dd0811c4615a13198a0819fc114%26pid%3D100012%26prg%3D10500%26rk%3D3%26rkt%3D10%26sd%3D231296779901)
That is
not a "programmer". It is a
USB-to-TTL-serial-converter.
Do you have that?
Or the Sparkfun programmer (which is actually a "programmer")? (https://www.sparkfun.com/products/9825)
I have both.
Even after you disconnect them from one another? It turns out that the LED pin IS one of the signals used to connect the two arduinos, so both LEDs will flash when the non-broken one does the flashing...
Ok they only blink in sequence if SCK is connected between them.
I have both.
You
will be using the
USB-to-TTL-serial-converter.
You will
not be using the
Sparkfun programmer.
Is there a specific sketch I now try and put on the bad Arduino? Do I just try and burn a new bootloader?
I get the following message if I try to burn a new bootloader or if I try and upload blink using the programmer;
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
Is there a specific sketch I now try and put on the bad Arduino? Do I just try and burn a new bootloader?
Tools / Burn Bootloader. After selecting the correct board (the "bad" board).
I get the following message if I try to burn a new bootloader or if I try and upload blink using the programmer;
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
Under the Tools menu, click Programmer then Arduino as ISP.
Ok tried to burn a new bootloader to an Arduino Uno, Arduino ISP programmer, still no luck;
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
Post the verbose output.
Here is verbose output for from the upload;
Using Port : \\.\COM9
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 : ATMEGA328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
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 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
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 4500 4500 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 4500 4500 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 4500 4500 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 4500 4500 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 1 0 0 0 0 0x00 0x00
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
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
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: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Hardware Version: 0
Firmware Version: 1.0
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: . [00]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [04] . [04] . [d7] . [c2] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions
Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
################################## | 100% 0.02s
avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude: Send: Q [51] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude done. Thank you.
avrdude: AVR device initialized and ready to accept instructions
...indicates that your "good" Arduino is acting like a programmer. Excellent.
avrdude: Device signature = 0xffffff
...indicates that the target (the processor on your "bad" Arduino) is not responding.
The first step is to very carefully check the wiring. Ensure there are no loose connections and that all connections are correct. Then try again.
If that does not work, try reducing the clock rate. This is the section of interest (the spi_send function near line #148 in TinyISP_SPI.cpp)...
https://code.google.com/p/arduino-tiny/source/browse/TinyISP_SPI.cpp?repo=isp#148
Double the value for both of the calls to delayMicroseconds (new value is 48 microseconds). Re-upload TinyISP to the programmer (your good Arduino). Then try again.
If that does not work, continue doubling the delay until the delay exceeds 12000 (6/(128000/256)*1000000).
If none of that works (or the avrdude output changes) then there is something else wrong.
My reset pin is a bit flaky cause I have a 10uF cap between reset and ground (per the instructions here http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)). I re-ran the code with and without the cap, but with the reset pin securely held in place, and I got a different device signature;
avrdude: Device signature = 0x000000
I found a post about a signature of 0x000000 here: http://forum.arduino.cc/index.php/topic,25385.0.html (http://forum.arduino.cc/index.php/topic,25385.0.html) but I haven't tried the suggestion(s) yet.
avrdude: Device signature = 0x000000
...also indicates that the target (the processor on your "bad" Arduino) is not responding.
..indicates that the target (the processor on your "bad" Arduino) is not responding.
Or a wiring error (ie the response it not getting to the "programmer") The SPI communications protocol just shifts data bits from the input pin into the peripheral; if you have something wrong with THAT pin connection, you end up shifting in randomness.
Winding back a bit...
Why are the Arduino Uno default extended fuses 0x05? That's what it is in the Boards.txt file. According to the fuse calculators I've looked at, this is an invalid / undefined setting.
The valid BOD settings for the extended fuses (according to the calculator) are:
0xFF (BOD disabled)
0xFC (BOD = 4.3V)
0xFD (BOD = 2.7V)
0xFE (BOD = 1.8V)
It also defaults the lock bits in the Boards.txt file to 0x0F which the calculator also says is invalid / undefined.
The valid Lock Bits settings (according to the calculator) are 0xFF for no lock downs on reprogramming.
http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega328p&LOW=FF&HIGH=DE&EXTENDED=FD&LOCKBIT=FF
According to the fuse calculators I've looked at, this is an invalid / undefined setting.
Just because bits are undefined does not make zero values invalid.
I cannot speak about the m328p processor but two of the ATtiny processors always return zero for undefined fuse bits. If values like 0xFE are used verification fails when trying to change the fuses.