GPIO read pin issue

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

GPIO read pin issue

跳至解决方案
1,986 次查看
ketulpatel
Contributor II

Hello,

I'm using LPC1833. And set pin PB_0 ( GPIO5[20] ) as an output pin.
But when I read it using the PIN register, It showing 0 state even I set it to 1.

Thanks,
Ketul

0 项奖励
回复
1 解答
889 次查看
Kushal_Panchal
Contributor II

Hi,

Kushal_Panchal_0-1731492575085.png

 

Make sure Input buffer enable[bit 6]. The input buffer is disabled by default at reset and must be enabled for receiving.

Thanks,

Kushal

在原帖中查看解决方案

4 回复数
890 次查看
Kushal_Panchal
Contributor II

Hi,

Kushal_Panchal_0-1731492575085.png

 

Make sure Input buffer enable[bit 6]. The input buffer is disabled by default at reset and must be enabled for receiving.

Thanks,

Kushal

1,940 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

You set the GPIO as output but you want to read it. Why do you operate IO in this way?

If you need to read pin state, please switch the IO setting as input then read it.

0 项奖励
回复
1,932 次查看
ketulpatel
Contributor II

Hello @ZhangJennie, thanks for the response,

Still getting 0 value, following steps are followed:

1. Pin Mux:
         Pin name - PB_0 with GPIO5[20]
         Mode - (0x2 << 3) //Enable Pull-up resistor
2. Set direction (DIR register) = Output
3. Set value (SET register)
4. Set direction (DIR register) = Input
5. Read Pin state (PIN register) = getting 0 value
6. Set direction (DIR register) = Output

Thanks,
Ketul

0 项奖励
回复
1,911 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Can you please measure PB_0 with multimeter, what's the voltage ?

0 项奖励
回复