Digital Pin 6 pullup resistor?

Something (the bootloader I think) is setting the pullup resistor on digital pin 6. If I use a reasonably efficient LED, I can observe a faint glow, which unless it's taken care of in the setup function, will persist.

I tried downloading from 0007 and it's the same.

Is (was) this a bootloader problem, and do I need to update the bootloader file I'm using. I remember reading about some changes in the bootloader?/pullups? on 008.

Does the bootloader have an official home at Arduino? One would assume http://www.arduino.cc/en/Hacking/Bootloader but

I don't see the links to anything but the source code. We should perhaps have some more docs up there, such as a revision file.

The Atmega168 used to require a different bootloader didn't it? I had to look around a bit for it when I burned my first 168's.

What's the nature of the bootloader in the 0008 distribution? Does it work with the old Atmega8's still?

I'll try burning from the bootloader in the 008 folder and see what happens.

Paul Badger

Hmm. Does your board have an ATmega8 or an ATmega168? Is the bootloader on the chip one that came with an Arduino board, or something you burned yourself?

I don't think any versions of the bootloader do anything special with pin 6, but I could be wrong; do you see the same behavior on other pins?

The bootloader in the 0008 is the same bootloader as we used to burn onto the ATmega8's. Including the ATmega168 bootloader is an important priority for the next version of the Arduino distribution.

The Hacking > Bootloader page is intended as the official home for the Arduino bootloader. It would be good to include more some more documentation (i.e. the differences between the ATmega8 and the ATmega168 bootloader). There haven't really been many revisions of the bootloader. I don't think the ATmega168 one has changed since we started using it. The ATmega8 one did go from 9600 to 19200 baud at some point, and from 2 KB to 1 KB, but both of those changes happened a long time and I don't thing there are many people using anything but the latest version.

I don't think any versions of the bootloader do anything special with pin 6, but I could be wrong; do you see the same behavior on other pins?

It's definitely the pullup being set, the other pins behave the same way when I set the pullups. Also when I reset it with code, the pin goes high at reset then returns low or high Z when the program runs.

These are 168 chips I burned myself. I had to follow some forum links to find the 168 file I think. This was probably ~ 11/06.

At the time my NG came with an Atmega8 so the only 168's I have are the ones I burned. If you wouldn't mind try this out on one of your boards and see if the pullup is set with just a blank sketch.

Is there anything else in the core that might be causing this?

My fuse settings are also slightly variant as recommended in the datasheet for ceramic resonators, I'll burn standard fuse setttings and see if that makes any difference.

I see that there is a 168 bootloader in the playground under uploads, but no link I found (although there probably is one off one of the pages).

Anyway I would think we should get a link up on the bootloader page with the "official" version of the bootloader. It might also be a good idea to include the 168 bootloader in Arduino distributions. I guess the bootloader that comes with the distribution is still Atmega8 because the IDE still won't burn 168's, right?

I'll try the version on the playground to see if it makes any difference.

I'm having the pin 6 problem as well. It really annoys me as it interferes in some projects. For example, in the 'Knight rider' tutorial, the led behaves very strangely, turning off when the lights are 'bouncing' back.

oh, and I just forgot - I've got a new NG i received from italy on monday. Incidentally, PLEASE get a distributor in the UK (try Maplin or rapid electronics)

Anyone else tried this - I'm looking for a little more data to confirm that this problem is in the official bootloader/hardware distribution.

Try this:
Send Arduino a blank sketch. The sketch can do anything else, but shouldn't do anything to pins 0 to 7.

Put a voltmeter between pin 6 and ground to cofirm whether it's at 5 volts.

Post a reply on this thread.

Thanks,

Paul Badger

Hi,
Pin 6 is at 5,09V = HIGH with
arduino 0007, MEGA168 on Board NG rev.c

Eberhard

I made a sketch with just a delay in loop(). setup() is empty.

5.11 VDC with nothing connected. 1.74v with an LED and resistor.
The other digital pins read 0

Is there anyway to read what those resistors are set to? I've just gotten mine and have not fully learned the language or capabilities yet.

Ok, I learned how to reprogram the pin and it reads 0. It would be a bit annoying as I don't see a way to set the pin back to an output after having to set it to an input to set that resistor off.

Anyone else tried this - I'm looking for a little more data to confirm that this problem is in the official bootloader/hardware distribution.

Try this:
Send Arduino a blank sketch. The sketch can do anything else, but shouldn't do anything to pins 0 to 7.

Put a voltmeter between pin 6 and ground to cofirm whether it's at 5 volts.

Post a reply on this thread.

Thanks,

Paul Badger

void setup()
{

}

void loop() // run over and over again
{

delay(1000); // waits for a second

}

OK I think I have confirmed it really is in the bootloader. I'll take a look at the bootloader code when I get a chance to see if I can find where pin 6 is getting set.

mrmeval:

The pullup resistor is supposed to be 20k - this is controllable by software - inside the chip. When you hook up an LED you are are reading the forward voltage of the LED. Even though the pin in configured as an INPUT, the pullup resistor is plenty to power an LED with a faint glow. Or show up on a voltmeter.

This is a little confusing:

When you do this:
pinMode(6, INPUT);
digitalWrite(6, HIGH);

It's not making the pin an OUTPUT - still an input but turning on pullup resistors

pinMode(6, INPUT);
digitalWrite(6, LOW);

turns off the resistors but still keeps the pin as input - the pin is then high impedance input ~ 100 M ohms

pinMode(6, OUPUT);

makes it an output - I think it defaults LOW
to make it HIGH just do

digitalWrite(6, HIGH);

paulb: OK I think I have confirmed it really is in the bootloader.

So have you looked the code over? While you're looking at it, is there any way to have the bootloader know the download is done and skip looking for another download? Would be nice if after a download it would skip the download code and just start the program. Makes for a very long wait from download initiation to action.

Thanks for working on the pin 6 glow. Have been expimenting with my barebones board. Now that I have the TTL usb/serial cable it finally works.
Arvin

This is from the 168 bootloader code:

Here's the definition of PIND6 (digital pin 6) in the bootloader.

/* other ATmegas have only one UART, so only one pin is defined to enter bootloader */
#define BL_DDR DDRD
#define BL_PORT PORTD
#define BL_PIN PIND
#define BL PIND6
#endif

According to the comment, this appears to be the smoking gun where the pin6 pullup gets set

/* set pin direction for bootloader pin and enable pullup /
/
for ATmega128, two pins need to be initialized */
#ifdef AVR_ATmega128
BL_DDR &= ~_BV(BL0);
BL_DDR &= ~_BV(BL1);
BL_PORT |= _BV(BL0);
BL_PORT |= _BV(BL1);
#else

BL_DDR &= ~_BV(BL);
BL_PORT |= _BV(BL);
#endif

I'm guessing that pin 6 is being setup as some kind of switch for changing the bootloader's behavior?
I can't seem to find anywhere where the pin is being checked though.

I was to going to try commenting out, compiling a new hex file and burning to a chip to test.
I think I need to do this with a gcc command from the terminal window for this.

Can someone please point me to the correct procedure for this?

I think you spotted it

I forgot about this,

The original bootloader we used to make the arduino bootloader would start only if pin D6 was low... we removed that requirement
but not the initialisation code

get rid of that stuff

massimo

Thanks for spotting that Paul. I'll be sure to correct it for the Diecimila.

BTW, that bootloader is intended for the Diecimila, which will have an automatic software reset and thus shorter timeouts. If you want to test it, you should first change the MAX_TIME_COUNT to something like (F_CPU >> 1). You could also change flash_led(1); to flash_led(3); if you want the LED to flash three times instead of one when the bootloader starts.

To compile the bootloader, you can just run "make" - the makefile should do the right thing, assuming you have avr-gcc, etc. in your path. To upload it with an AVRISPmkII you can run "make isp". For other programmers, you'll need to call avrdude manually or edit the makefile.

sorry this is a bit n00bish, but what do I remove from the bootloader? Is it this:
/* set pin direction for bootloader pin and enable pullup /
/
for ATmega128, two pins need to be initialized */
#ifdef AVR_ATmega128
BL_DDR &= ~_BV(BL0);
BL_DDR &= ~_BV(BL1);
BL_PORT |= _BV(BL0);
BL_PORT |= _BV(BL1);
#else

BL_DDR &= ~_BV(BL);
BL_PORT |= _BV(BL);
#endif

Thanks,
Macmaniac

Just comment these two lines, like so

#else

// BL_DDR &= ~_BV(BL);
// BL_PORT |= _BV(BL);
#endif