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.

[SOLVED] Cortex M3(LPC1768) Logic levels - HIGH 3.3v and LOW 0

Status
Not open for further replies.

samueldotj

Newbie level 2
Joined
May 6, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
Hi,

I am a newbie to microcontrollers and starting with a breakout board(Blueboard). I am facing a logic level problem.

I have a simple program which sets GPIO pins to HIGH and then LOW. I measured the voltage during HIGH setting and it is 3.3 V and when LOW is set it is 0. :???: I am expecting a value of 2.7-2.9V when HIGH and 0.2-0.4V when LOW.

Another interesting point is the high logic level voltage measures 3.3V only if the GPIO direction is output. Otherwise (if direction is input) it measures as 2.2V.

There is nothing connected to the GPIO pins.

Code:
#define PINSEL2		(*((volatile unsigned long *) 0x4002C008))
#define PINSEL3		(*((volatile unsigned long *) 0x4002C00C))

#define PINMODE2        (*((volatile unsigned long *) 0x4002C048))
#define PINMODE3        (*((volatile unsigned long *) 0x4002C04C))

#define FIO1DIR         (*((volatile unsigned long *) 0x2009C020))
#define FIO1MASK        (*((volatile unsigned long *) 0x2009C030))
#define FIO1PIN         (*((volatile unsigned long *) 0x2009C034))
#define FIO1SET         (*((volatile unsigned long *) 0x2009C038))
#define FIO1CLR         (*((volatile unsigned long *) 0x2009C03c))

int main (void)
{
	PINSEL2 = 0;
	PINSEL3 = 0;

	PINMODE2 = 0xAAAAAAAA; /*neither pull-up nor pull-down.*/
	PINMODE3 = 0xAAAAAAAA; /*neither pull-up nor pull-down.*/
	PINMODE_OD1 = 0;
	
	FIO1DIR = ~0; //all are output
	FIO1MASK = 0;
	FIO1PIN = ~0;  //high

	while(1) {
		FIO1PIN = ~FIO1PIN;
		delay(10000);
	}
}
Could it be hardware problem? Or am I missing something?

Thanks
Samuel
 

When the pin is set as an input there is an internal pull up resistor (can be also set to pull down) that is actually very weak, if you want to get a higher voltage you have to use an external pull up resistor.
When the pin is set as an output the voltage is quite normal. 0 and 3v3.
Note that as you sink /source more current from the pin the voltage will be lower from 3v3 (high state) and higher from 0 (low state)

Alex
 
Check these two graphs that show how the output voltage is changed with the output current, they show low and high state
LPC17xx_voltage_vs_current_low.jpeg LPC17xx_voltage_vs_current_high.jpeg

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top