Solved: mega8a pull-ups not 20K to 50K as in datasheet?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

greets,

 

in the mega8a datasheet on page 226 there is a table with the pull-up values and PSU current. The values for I/O pins is given as 20K to 50K but the PSU current at Active 8MHz, VCC = 5V is given as 6 to 15mA. I did measure with a DMM the current between a pin and ground when the pin is set as input with the pull-up enabled, got 14mA. The thing that I don't understand is how the current could be so high with pull-up resistors with 20K as the lowest value?

 

At 14mA the resistor value equals to 5V/0.014 = 357 Ohms.

 

Am I missing something?

 

Attachment(s): 

Last Edited: Wed. Dec 14, 2016 - 11:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

when the pin is set as input with the pull-up enabled, got 14mA.

You have made a mistake, full stop. Show us the code.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd suggest the pin was set as an output. You checked everything else apart from the obvious.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

make sure that the pin aren't used as something else than IO (UART SPI debug etc), then that take over the control.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have made a mistake, full stop. Show us the code.

 

#define F_CPU 16000000L

#define led_pin 0  // e.g. 2 for PC2, 0 for PC0
#define DDR_led DDRC  //Data Direction Register
#define PORT_led PORTC

 

#define setbit(address, bit) (address |= (1<<bit))
#define clearbit(address, bit) (address &= ~ (1<<bit))
#define flipbit(address, bit) (address ^= (1<<bit))
#define readbit(address, bit) (address & (1<<bit))

 

int main(void) {

clearbit(DDR_led, led_pin);  // set pin as input
setbit(PORT_led, led_pin);  // enable the pull ups

  while (1) {
  }
}

 

I've tried the code on pins PC0, PB3 and PB4, same result.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well PB3 and PB4 are used for in-circuit programming. What else is connected to them? And do you have all power and ground pins connected? A schematic would be useful.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I've found the problem. Tried another multi-meter and it showed 140uA, so that's approximately a 36K pull up resistor. The DMM I used yesterday turns out to have the decimal dot malfunctioning, so I thought it was showing 014 so I assumed it was 14mA. Also I did not think that a 0 in front of a value probably means that a decimal dot should be in there, even if it's not visible.