I am tring to read a I/O P0.4. But it reads always high no matter it is connected to high or low.
Any ideas about this?
Here are two quick experiments to understand what causes this behavior:
- Configure P0.4 as GPIO (mode 0) and as output, periodically driving low then high and check with an oscilloscope that the pin is toggling as expected.
- Configure P0.4 as GPIO (mode 0) and as output driving low, and check that the DioRd() function reads a low level on that pin.
Have you by any chance configured it as an output and set it to high?
If you did that and then try to bring it to low the voltage might not be 0v on the pin. Have you tried actually measuring the volatage on the pin?
I did not configure this pin, by default it should be input, is it correct?
I measured the voltage in this pin and it is really low. But when I use DioRd(pADI_GP0) read it, that pin is high.
Retrieving data ...