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.
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
Hello @neuromp,
The ADMODE bit of the IOCON register must be set to 1 to manage the pin in digital mode.
All other register configurations appear to be correct.
BR
Habib
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