Enable Pull-Down resistor on LPCXpresso-LPC1347

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Enable Pull-Down resistor on LPCXpresso-LPC1347

427 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hanygirgis on Fri Feb 14 01:31:07 MST 2014
I'm a newbie and trying to enable the pull-down resistor on LPCXpresso-LPC1347, but it looks like I'm not doing it right.

I want it enabled on port 0 pin 6, so I did the following :

// Set MODE bits to 0x1
LPC_IOCON->PIO0_6 |= (1 << 3);
LPC_IOCON->PIO0_6 &= ~(1 << 4);

// Enable clock for IOCON block - Not sure if this is needed
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);

I'm still reading value 1 from this pin when disconnected, and my voltmeter reads ~ 2.4 volts.

I expected that I would get value 0 by default, and that I would read ~ 0 volts on this pin after the pull-down is activated.

What am I doing wrong?
0 项奖励
回复
3 回复数

360 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 19 03:14:30 MST 2014

Quote: hanygirgis
I expected that I would get value 0 by default, and that I would read ~ 0 volts on this pin after the pull-down is activated.

What am I doing wrong?



Depends on your toolchain...

Pull-down is working if your pin function is GPIO, input and IOCON clock is enabled (of course before using IOCON).

Not sure which toolchain we are talking about  :quest:

LPCOpen is enabling IOCON clock, so it's not necessary to do that.
But LPCOpen is using PIO0_6 pin as USB_CONNECT function, so you would have to switch pin function back to GPIO...
0 项奖励
回复

360 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Mon May 19 03:00:05 MST 2014
You need to enable the clock before accessing IOCON registers.
0 项奖励
回复

360 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MaKron on Mon May 19 02:43:19 MST 2014
Hi hanygirgis,
I've had the same problem.

It was very curious: The Pull Down worked when I was debugging, but it doesn't without the connection over SWD .

The problem was: You must provide the clock not only to GPIO, but also to IOCON ! 

LPC_SYSCON->SYSAHBCLKCTRL  |=(1UL <<  6)     // enable clock for GPIO
                                                          |(1UL <<  16);  // enable clock for IOCON    


Unfortunately this fact is not mentioned it in Chapter 7:  LPC13xx I/O configuration
of the manual (UM10375).

MaKron
0 项奖励
回复