input pin is 3.3V all time

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

kvartan
Posts: 20
Joined: Tue Nov 13, 2007 6:56 pm

input pin is 3.3V all time

Tue Feb 19, 2008 11:19 pm

Hi,
I am trying to configure some input pins on my AT91SAM7SE512 chip with the 7SE-EK board. I setup some pins as input pins, but they all are by default 3.3V and I have to connect them to ground to get what I need.

What I want is the exact opposite, I want the pins to be logic 0 and they go high when I connect a 3.3V source. Why am I observing this, and is there anything I can do in order to reverse the logic?

Thanks
GSNT
Location: Germany
Posts: 137
Joined: Mon May 02, 2005 12:17 pm

Tue Feb 19, 2008 11:52 pm

Hi,
did you disable the pull-up in PIO_PUDR?
15.4.1 Pull-up Resistor Control
HTH,
Gerd
kvartan
Posts: 20
Joined: Tue Nov 13, 2007 6:56 pm

Thu Feb 21, 2008 9:22 pm

Thanks! I did that and it worked for 1 pin.

I am trying now to configure 12 pins on Port B as input pins, but the same code doesn't work. I am doing the following:

#define PORTB_INPUT 0xFFF00000

AT91F_PIO_CfgInput(AT91C_BASE_PIOB, PORTB_INPUT);

// disable pull up resistors on the 12 pins.
AT91C_BASE_PIOB->PIO_PPUDR = PORTB_INPUT;

AT91C_BASE_PIOB->PIO_PPUER = ~PORTB_INPUT;


When I read the input port, I get the following answer: 0xFFFFFFFF - exact result as pull-up resistors are not disabled. Is there something else I should be doing?
GSNT
Location: Germany
Posts: 137
Joined: Mon May 02, 2005 12:17 pm

Fri Feb 22, 2008 1:53 am

Hi again,

this code is working (AT91SAM7S64):

Code: Select all

#define SW3 (1<<23)
#define SW4 (1<<26)
 
 AT91C_BASE_PMC->PMC_PCER = (1<<AT91C_ID_PIOA);	
 //PIO Enable Register 		
 AT91C_BASE_PIOA->PIO_PER =  SW3|SW4;
 //PIO Output Disable Register			
 AT91C_BASE_PIOA->PIO_ODR =  SW3|SW4;
 //Pull-up Disable Register
 AT91C_BASE_PIOA->PIO_PPUDR= SW3|SW4;
 
So check your Hardware: without pull-up your pin voltage is really about 0 Volt. You should also check the PIO Pull Up Status Register (AT91C_BASE_PIOA->PIO_PPUSR).

HTH,
Gerd
kvartan
Posts: 20
Joined: Tue Nov 13, 2007 6:56 pm

Fri Feb 22, 2008 8:44 pm

Thanks Gerd,
I tried what you suggested and the status register shows that the pull-up resistors on the pins I specify are disabled. However, when I read the input pins, they still show a high voltage. Meaning, if I don't connect anything to the pin, it reads a 3.3V and I can only change the state when I ground it. It is acting like the pull up resistors are still enabled.

I tried different pins on different ports (I thought maybe something is wrong with those pins), but similar outcome.

One thing I noticed, is if I enable the pin as an Output pin first, then I configure it as an input pin, it works. But I am skeptical about resorting to this method.

I am not sure what is causing it not to work.

Any additional help will be greatly appreciated.
GSNT
Location: Germany
Posts: 137
Joined: Mon May 02, 2005 12:17 pm

Fri Feb 22, 2008 10:46 pm

Hi again,

so did you use my sample? Did you reduce your main to this few lines without reading or writing something else? Did you measure or scope the input pins? I can't believe that this shouldn't work. Just checked this sample again and scoped the inputs, so my opinion:
If you haven't overseen something connected to your inputs, there's somewhere something wrong with your code and the only way to find it is to reduce it to the minimum.

HTH,
Gerd
kvartan
Posts: 20
Joined: Tue Nov 13, 2007 6:56 pm

Fri Feb 22, 2008 11:47 pm

Hi,

1. Yes, I did use your sample.
2. Yes, I reduced my main routine to include only the few lines. Nothing else was going on.
3. Yes, I measured/scoped the input pins, they read 3.3V

The status register still says that the pull up resistors are disabled, but the inputs are reading 3.3V

This is getting confusing....
GSNT
Location: Germany
Posts: 137
Joined: Mon May 02, 2005 12:17 pm

Sat Feb 23, 2008 3:57 am

Hi again,

just checked my sample with AT91SAM7X256, same result. Without pull-up about 0 Volt. With pull-up nearly VDDIO and input can source 0.3mA. So if your input can source about 300µA the pull-up is enabled.

HTH,
Gerd

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 2 guests