This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

could not gpiogetbit when set output

Hi, all

when I configure a gpio as output, that is set register OE, I could not get the correct value of bit using gpiogetbit() function.

the root is gpiogetbit() operarte on datain register, while gpiosetbit() operate on dataout register.

the problem is how I get the value I just set or clear using gpiosetbit or gpioclrbit.

Must I add interface myself to implement what I need since gpiogetbit() could not?

Is there any good suggestion?

  • Hi Huai,

    I think you could either implement you own function reading the DATAOUT register or enable the IE (input enable bit) of the pin-muxing register for the given balls. In this case I think you should be able to read back the actual state of the pin by reading the DATAIN register by the already existing gpiogetbit() function...

    Best regards - I hope this helps you forward?
      Søren

  •   Søren,

    Thank you for your replly. I got know it. But another confusion is,

    what is the function of IE when I won't use the gpio as input pin but output pin, that is set the OE (output enable) for gpio.

    I find that it works fine whether I set the IE register bit or not when I use the gpio as output.

    If it is so, is there a preferred wat to set the IE register bit  or not?

    thank you!

  • Hi Huai,

    Sorry for not getting back to you prior to not, but the last week have been pretty tough :-)

    For output operation there is no external functional difference of setting IE or not. Only difference is if you are able to read back the state of the DATA_OUT-register by reading the DATA_IN register. In case the IE bit isn't set, you can't read back the current state of the pin by reading the DATA_IN register...

    With respect to a preferred way of enabling the input-buffer (= setting the IE bit), you would normally do it at the place where you configure the pin-muxing for your board setup, but as such you can do it in whatever way and/or place you like...

    I hope this answer your questions?
      Søren