How to read GPIO pins


#1

I have subscribed to the GPIO and i used adl_ioWrite API to write 1

Wr_Val = adl_ioWrite ( Gpio_Handle, ADL_IO_Q25X1_GPIO_1, 0xFFFFFFFF);

the Wr_Val returns 0, means successful. :slight_smile:

But,
when i read that io using

Rd_Val = adl_ioRead(Gpio_Handle);  

then it returns the value -8 means nothing to read. :frowning:

Can any one help me, how to read the GPIO

#2

If you have subscribed to the GPIO and set it as an output, then you can’t read from that GPIO, only write to it.

If you want to read from a GPIO, subscribe to it as an input.


#3

Thanks for the reply

But i have made it as input only…


#4

If you need help, provide more information such as what version of OpenAT you are using and what module you’re developing for, and sample code for what you say is wrong.


#5

Hi tobias !!!

I am using Q2406B , firmware is 657, i m using OpenAT SDK 3.12

The code i require is :

If the GPIO is high, (might be 1) it has to go to particular function
and if it is low (0 ), then other
So to get the value of GPIO, i want to read the pin.

SUNIL RAO.M


#6

And what does your (not working?) sample application look like?
Only relevant code needed.

Do you subscribe correctly to the GPIO as an input? Check return value for the subscription?