LPC1114 302 R_PIO1_1 problem

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

LPC1114 302 R_PIO1_1 problem

1,266 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by giamby3000 on Sat Nov 09 07:19:21 MST 2013
Hi.

I'm trying to drive R_ PIO1_1in my board as GPIO (output)  but I can't: I tried many configuration but this pin remain pulluped to 3,3V .even if I disable internal pullup/down
Here is my code: what am I forgetting?


LPC_IOCON->R_PIO1_1  &= ~0x8F;
    LPC_IOCON->R_PIO1_1 |= 0x01;
     LPC_IOCON->R_PIO1_1           &= ~(0x10);

GpioSetDir(PORT1,1,1):


Thank you

标签 (1)
0 项奖励
回复
6 回复数

1,248 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by giamby3000 on Mon Nov 11 21:20:21 MST 2013
Thanks for reply.
I summarize what I'm doing.
I connect PIO1_1 to an NPN transistor with integrated base resistor (2233) but I can't drive it because I have 0,9V on base transistor.
So I remove the transistor an I notice that this pin is always at 3,3V even if I set it as low.
I have tried many configuration pin sets but this pin is always on. I do exactly what LabRat suggest but behaviour is the same. I set many other pins in my project without problems but not this pin
Now I'll try to substitute LPC1114.

Thanks
0 项奖励
回复

1,248 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Mon Nov 11 02:21:48 MST 2013

Quote: giamby3000

LPC_IOCON->R_PIO1_1 &= ~(2<<3);  isn't the same of LPC_IOCON->R_PIO1_1 &= ~(0x10);   ???


Result is the same, but it's more readable code...

Quote: giamby3000

I can't understand this behaviour..


I'm not sure which code we are talking about and what you are expecting...
If you disable PD and PU you are generating an antenna (if this pin isn't connected to something...)
So sooner or later it will do it's job as a good antenna and jump to high if it's an input. Regardless if you switched it low before...
If you want a low pin, switch it low after changing it to output...

LPC_IOCON->R_PIO1_1 |= 0x01;         //set to GPIO
LPC_IOCON->R_PIO1_1 &= ~(3<<3);      //delete PU/PD
//LPC_IOCON->R_PIO1_1 |=  (1<<3);    //set PD
LPC_GPIO1->DIR  |= (1<<1);           //set output
LPC_GPIO1->DATA &=~(1<<1);           //set low
0 项奖励
回复

1,248 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by giamby3000 on Sun Nov 10 22:02:50 MST 2013
Hi.
Excuse me but
LPC_IOCON->R_PIO1_1 &= ~(2<<3);  isn't the same of LPC_IOCON->R_PIO1_1 &= ~(0x10);   ???

Howeverm I substitute my code with yours but I have PIO1_1 to 3,3V even if I set the pin to low.

I can't understand this behaviour..


0 项奖励
回复

1,248 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Nov 10 01:21:29 MST 2013

Quote: giamby3000
but never is  changed



I'm not sure what you are trying to do and what never changed...

Trying to disable the pullup?

 LPC_IOCON->R_PIO1_1 |= 0x01;
 LPC_IOCON->R_PIO1_1 &= ~(2<<3);


is doing that as debugger can show you....
0 项奖励
回复

1,248 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by giamby3000 on Sat Nov 09 23:03:42 MST 2013
Thank you for the answer
AHB is ok because I can drive correctly other GPIO pins

I substitute lines above with this:

LPC_IOCON->R_PIO1_1 |= 0x01;
LPC_IOCON->R_PIO1_1           &= ~(0x10);

(default of bit 7 IOCON is Digital ffunc mode (is 1)
but never is  changed

other ideas?

Thanks
0 项奖励
回复

1,248 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sat Nov 09 09:09:11 MST 2013

Quote: giamby3000
... what am I forgetting?




Bit16 of SYSAHBCLKCTRL?

And of course with deleting bit7 of IOCON you are in '[color=#f00]Analog Input Mode[/color]' :)
0 项奖励
回复