Today I noticed some interesting behavior. If I upload a sketch Pins D8-D15 will be high for some short period of time. This only happens at upload. A reset does not trigger this behaviour. I suspect the bootloader but I found no suspicious code in it. Has anyone an explanation for this behavior?
Which board? How brief?
Standard Arduino Duemilanove (with FTDI chip) with 328P on it and standard bootloader flashed. I can not see the signal on the scope. But the frequency counter detects it. Depending on the trigger level it indicates something between 100ns and 1us. So briefly means "just some CPU cycles, probably less than 10". Sorry for not being more precise right now.
During upload the processor is in a reset state and all IO pins should be Hi-Z and floating.
Do you have anything else connected to these pins?
Rob
Graynomad:
During upload the processor is in a reset state and all IO pins should be Hi-Z and floating.
I was under the impression that this was the case during ICSP programming. During "normal" uploading from the Arduino IDE, the processor is running the bootloader.
I am using a standard setup. That is the bootloader. With ISP this behavior does not happen. The only thing that is connected are LEDs and series resistor. Thus the high state is definitely not caused by external circuits. I am just curious. If nobody knows why this happens it does not matter to much. My circuits do not rely on well defined behavior during reset. Still this is unexpected and I would like to understand it.
I'd offer to attempt to duplicate the behavior you're observing, but I don't have a scope (is that how you initially noticed it?) and I don't have a Duemilanove, although maybe just having the same 328P chip and the same bootloader would be sufficient there.
Nope, I noticed it with the LEDs and then attached the frequency counter.
I might give it a whack. Which bootloader, exactly? What size dropping resistors?
I was under the impression that this was the case during ICSP programming.
Correct, I'll go back to Arduino 101 class
Rob
@Jack: good question. How would I finnd which bootloader I am running right now? I did not upload it so this might be a different one than what I find in the Arduino sources. This is a very good point. Is there an easier way but to export it by ISP and disassemble it?
The resistors are 1k resistors and the LEDs are orange LEDs. The sustained LED current per pin is 3.14mA. Thus the forward voltage should be 1.86V.
@Udo, there's not a real slick way to ID the bootloader. Recent work by Bill W will make this easier in the future. Personally I wouldn't attempt disassembly, but a person could use AVRDUDE to compare against known bootloaders. Of course there is the chance that none of the "known" bootloaders a person has (from the IDE or whatever) will match.
Did you buy the chip with the bootloader already on it? Where did you get it? Might be able to download the same bootloader. Of course I do have all the standard bootloaders that come with the Arduino (0022) IDE. The "Arduino Duemilanove or Nano w/ ATmega328" might be a good guess, I could try that one (file name ATmegaBOOT_168_atmega328.hex).
I'm fresh out of orange LEDs but have lots of red and yellow and 1K resistors, should be close enough. (How many LEDs? Six? Can't find pins D14 and D15 XD)
Now, is it important which sketch I upload? Do you observe the behavior with any sketch?
I have 20 LEDs connected and 20 resistors. One LED per IO pin. All cathodes connected to ground. The sketch is completely irrelevant. It happens even with a completely empty sketch. So either the chip or the bootloader must cause this behaviour. Maybe I should flash a different bootloader to see if the issue persists.
It happens even with a completely empty sketch. So either the chip or the bootloader must cause this behaviour.
There's no such thing as a "completely empty sketch". Check this out: http://www.element14.com/community/docs/DOC-28681/l/analysis-of-an-empty-arduino-sketch
Don
Well I tried and could not detect any brief flashes. I just hooked up six LEDs, to pins 8-13, on a BoArduino, so also FTDI interface. Tried both the ATmegaBOOT_168_atmega328.hex bootloader and also westfw's optiboot beta.
@floresta: sorry but I like to disagree. The link shows that an empty sketch compiles to none trivial code. This is of course true but still there is something like an empty sketch. However the point is that an empty sketch contains no explicitly specified code. Other members seemed to suspect that something of my code was causing this behavior. This was my point.
@Jack: so I will change the bootloader or drop it completely. Seems it is always a source of irritation for me.