How to disable Pull Up on on ATTiny10 PB3

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

Hi All,

I'm trying to use the ATtiny10's PB3 as ADC3. I notice that PB3 is at VCC level when not connected. I reset PUEB3 but it still is at Vcc. A little research (Table 10.4) shows PUOV is always set, so it overrides PUEB3. Since I have RESET DISABLED in the fuse bits, this pull up override enable (PUOE) should be 0 and PUOV should be a non-issue.

I'm trying to measure a voltage using an emitter follower, but the emitter gets pulled high by PB3. PB3 is my only choice for another ADC.

Any idea where my thinking is off?

Thanks

Bob

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

Quote:

when not connected

A floating pin can have any value.

If you suspect the pin is being driven in some manner--e.g., via pullup--then connect a say 100k ohm pulldown to the pin and check the voltage at the pin.

Note that you'd get the symptoms until you use the RSTDISBL fuse as the Rrst pullup value is about the same as a regular pin pullup value.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Right theusch. I put a 10K to ground and it went to 2.4 V and a 100K went to 4V showing there is a 15K-20K pullup somewhere. I did set the RSTDISBL fuse.

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

Quote:

I did set the RSTDISBL fuse.

I'm not that familiar with the new-fangled Tiny10. Do you then do programming with 12V applied to /RESET?

For a "real" AVR, it sounds like a) RSTDISBL isn't really programmed; or b) the /RESET pullup is not disabled when RSTDISBL is programmed.

a) can be tested by running a blinky-LED on a pin other than /RESET. Then pull /RESET hard low and see if the blinking continues.

I don't know what to say about b). A datasheet glance isn't definitive. Ask Atmel?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

No - the Tiny10 uses a "TP1" programming interface. That works fine with or without the reset disabled on the STK600.

I had to disable RESET because I use PB3 for a pushbutton input. The pushbutton has worked fine since, so I know the RSTDISBL fuse is programmed. Without that, the chip would reset every time I hit the PB.
Recently, I decided I wanted to use ADC3, so I first changed the readbutton code and looked for ADC3 to be below .2V and it worked just fine to show the button was pressed. The PB pulls down the phantom pullup correctly. When I put a pot on it to vary the voltage, it was inconsistent. I'm trying to measure battery voltage, so I figured I would just try an emitter follower. I noticed that the ADC3 would get a Vcc or near-Vcc reading all the time (Battery is always less than Vcc, especially when charging). The emitter follower should offset the battery from Vcc but the emitter is higher than the base. So I dosconnected the pins and found only PB3 was pulled up.

I agree that it sounds like RSTDISBL isn't programmed correctly, but it fixed the original pushbutton problem. I assume that means it is correct.

The data sheet doesn't help - you're right. Atmel support hasn't been great for the Tiny10, but this one may require their input to understand what is really going on. Could be a chip bug...?

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

bb56 wrote:
No - the Tiny10 uses a "TP1" programming interface. That works fine with or without the reset disabled on the STK600.

This has nothing to do with TPI. It's because the STK600 applies +12V to the reset pin of the tiny10. So in this case it does not matter if reset is disabled or not. Had the STK600 used the low voltage TPI programming mode, then programming would not be available if reset had been disabled.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

Anyone have any ideas on how to tri-state this pin? I've heard nothing from Atmel support.

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

how about providing us with a schematic of how you have things connected, as well as some sample source that exhibits the problem.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

Glitch, I do the same setup using ADC2 and ADC3:

; Initialize ADC (Page 94)

	ldi   R16,0b00000000
	out   ADCSRB,R16       ; Single Convert mode
	ldi   R16,0b00001100   ; Disable Digital Input on PB2,3
	out   DIDR0,R16
   ldi   R16,0b11000011
	out   ADCSRA,R16       ; Turn On the ADC, with prescaler 8
;
;init other variables and start main loop...
.
.
GetAmbient:
	ldi   R16,0b00000010
	out   ADMUX,R16        ;  PB2 (ADC2)
    ldi	R16,0xC3      
	out	ADCSRA,R16	; Start ADC conversion
WaitAD:  
	sbic  ADCSRA,ADSC      ; 
	rjmp  WaitAD		   ; wait until done
	in    ADValue,ADCL     ; Read the result
.
[process code...]
.
;read ADC3
GetBatVolt:
	ldi   R16,0b00000011
	out   ADMUX,R16        ;  PB3 (ADC3)
	ldi	R16,0xC3      
	out	ADCSRA,R16	; Start ADC conversion
WaitADB:  
	sbic  ADCSRA,ADSC      ; 
	rjmp  WaitADB		   ; wait until done
	in    ADValue,ADCL     ; Read the result
.
.
loop..

The issue is that the pin is always pulled up as explained above. The hardware simply has a pushbutton and a 100K ohm to ground at PB3 and an emitter-follower feeding PB3 with the voltage ranging from 2.7V to Vcc-0.6V.

PB3 has a pullup voltage that makes it impossible to measure accurately. ADC2 has no such problem.
[img]I tried to paste an image here...[/img]

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

but where are you clearing the necessary bits in PUEB? You are disabling the digital inputs via DIDR, but this does not disable the pull-ups.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

I miss the part where you set the pin explicitely to input and you clear the port bit.... I do not know if in the new tiny10 this also has to be done to disable the pull-up.

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

Sorry guys, I did leave out the IO init:

; Initialize I/O  (Page 52)

    ldi   	R16,0b00000001   ; PB3=Input,PB2=Input,PB1=Input,PB0=Output
    out   	DDRB,R16         ; DDRB=0x01 PB0 is only output
	ldi		r16,0   ;disable PUEB pull up all
	out		PUEB,R16

I even tried putting a "cbi PORTB,PB3" to clear the port bit. -no change.
No response from Atmel support yet, so it's still a mystery.

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

Update: Resolved

Atmel support pointed to the reset jumper on the STK-600. The stk-600 has it's own pullup for RESET. To sum it up:

1. Reset Disable eliminates one source of pull-up.
2. resetting PUEB removes another source of pull-up.
3. STK-600 RESET jumper removes another pull-up.

Never too old to learn something new.

Cheers.

Bob