Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PB7 on ATmega48-168 doesn't work

Status
Not open for further replies.

kripacharya

Banned
Joined
Dec 28, 2012
Messages
1,204
Helped
182
Reputation
360
Reaction score
175
Trophy points
1,343
Location
New Delhi
Activity points
0
For ever now I have been trying to use PB7 as a normal digital I/O on the Atmega48/ 168. It just does not work.... but why ?

The manual claims that if the pin is NOT used as a clock pin (i.e. as a Crystal pin or an Osc input for the Async clock to the T1mer/ counter2), then it can be used as a regular digital I/O.

My setup has an External Clock (on PB6), and fuse bits are set for this External Clock.
As2 and EXCLK all combinations have been tried.

The PB7 stays firmly stuck to 0v. Bit-wise instructions don't budge it, full port writes don't budge it. All other bits on PORT B are working fine.

Shall i give up and never assign PB7 to any useful purpose ?? How to make it work ?? What am I missing... ??
 

Can you try to switch it to internal oscillator?
 

I have tried that too, but no use. maybe I'll re-check it out one last time with internal oscillator settings just to make sure.
it should work with fuses set for External clock though, which only uses pB6.
I use STK500 btw.

No other ideas about any other settings which may be causing trouble ?
 

nope... still nothing.

Clearly PB7 cannot be used as a general I/O, no matter what. Atmel is lying.
 

PORTB bit 7 Cannot be used as I/O in atmega48-88-168 (PB7)

Nope... PORTB bit 7 cannot be used as a digital I/O

The atmega48-88-168 clearly has a bug or some other issue.

It should be marketed as 22 I/O lines at best. Maybe less, since no sane person would use Reset pin as an I/O.
 

That doesn't make sense , you may have damaged the pin somehow.

While using the internal RC as clock source can you use PB6 and not PB7 or you can't use any of them?

- - - Updated - - -

By the way , are you using a chip on a breadboard of have some kind of dev. board?
 

I know, it doesn't make sense. Which is why i committed the design to pcb before checking it. So the answer is No, not a breadboard or dev board. And Yes - i checked PB6. That was working fine when i switched to Internal RC Osc and used the exact same test code. I've tried with sbi/cbi portb, 7; sbi pinb, 7; out portb, r16 etc etc as well. Nada.

Out of the 32 pins (TQFP) - of which I am using ALL - everything else is working perfectly. In fact PB7 is the cleanest looking pin & trace. Tested for shorts & opens - it all checks out..... :-(

Btw I'm using Atmega48A which seems to be a 'variant' of the '48.
So also looking through all the errata notes, looking through migration notes. Not found anything helpful as yet.
 
Last edited:

From datas
TOSC2: Timer Oscillator pin 2. Used only if internal calibrated RC Oscillator is selected as chip
clock source, and the asynchronous timer is enabled by the correct setting in ASSR. When the
AS2 bit in ASSR is set (one) and the EXCLK bit is cleared (zero) to enable asynchronous clock-
ing of Timer/Counter2 using the Crystal Oscillator, pin PB7 is disconnected from the port, and
becomes the inverting output of the Oscillator amplifier. In this mode, a crystal Oscillator is con-
nected to this pin, and the pin cannot be used as an I/O pin.

Check the ASSR setting..
 

From datas

Check the ASSR setting..

read my post#1. tried all combo's, particularly with EXTCLK=1 and AS2=0. Each of these with Internal RC Osc set, and with External Clock set.

doesn't work.

Have also tried config as an input. In this case I am not even able to make the pin go High with +5v applied (thru a resistor of course)

I suppose I will have to assume either --

(1) just that one pin of my uC is toasted
(2) some setting is still missing/ incorrect someplace.
(3) atmel chip has a bug

So please someone post who actually HAS been able to use PortB-7 as a digital I/O ?
 

You probably damaged the microcontroller. If, with a pull-up resistor, you can't make the pin go high, it's very possible the pin has been shorted to ground internally.

It's best you try with another ATMEGA48 and then see if the problem persists. I've been able to use the ATMEGA48 PORTB7. I had used the internal RC oscillator.

Hope this helps.
Tahmid.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top