Reading GPIO output pin on LPC1777 returns 0

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Reading GPIO output pin on LPC1777 returns 0

436件の閲覧回数
neuromp
Contributor II

Hello,

The LPC1777 user manual claims the pin state of a GPIO pin configured as an input or output can be read from the PINVAL register.  However, if I set the GPIO output as 1 or 0 using the GPIO PINSET and PINCLR registers, I when I read the state from PINVAL, the pin value is always returned as 0.  The pin direction is configured as a GPIO output, when measured with a volt meter I see 3.3V and 0V on the pin.  I'm using Port 0 pins 12 and 13.  IOCON for Port 0 pins 12 and 13 is set to 0 (GPIO).

I am able to set the gpio output to 0 or 1 on Port 0, pin 0, and read the correct value from the PINVAL register, so there must be something with regards to Port 0 pins 12 and 13, but I can't find it in the manual.

Thank you.

3 返答(返信)

377件の閲覧回数
neuromp
Contributor II

Hi Habib,

 

My apologies for my late reply :-).

GPIO port direction register 0:0xc61d73f3 (bits 12 & 13 are both 1)

IOCON register: for P0_12 and P0_13 are both 0x0

GPIO Mask0 register: 0x0

 

Thank you

 

0 件の賞賛
返信

352件の閲覧回数
Habib_MS
NXP Employee
NXP Employee

Hello @neuromp,

The ADMODE bit of the IOCON register must be set to 1 to manage the pin in digital mode.

Habib_MS_0-1755116354865.png
All other register configurations appear to be correct.
BR
Habib

 

0 件の賞賛
返信

410件の閲覧回数
Habib_MS
NXP Employee
NXP Employee

Hello @neuromp,
Sorry for the late reply.
Please make sure that the Pins 12 and 13 have the next configurations:
Pin Configured as Output in GPIO port Direction register
Pin configured as GPIO. Bits in FUNC for the IOCON Register
Pin configured as Digital. Bit in ADMODE for the IOCON Register
Pin enabled in the Fast GPIO port Mask register.

BR
Habib

0 件の賞賛
返信