Reading the output pin value

Hi!

We use the following approach:

  • If the pin is configured using nrf_gpio_cfg_input we read the pin value via nrf_gpio_pin_read;
  • If the pin is configured using nrf_gpio_cfg_output we read the pin value via nrf_gpio_pin_out_read;

We use nrf_gpio_pin_write to write the pin value (as I see it uses nrf_gpio_pin_set to write the value).

But after writing via nrf_gpio_pin_write we see the different value when reading via nrf_gpio_pin_out_read. As I see nrf_gpio_pin_set sets the value of OUTSET using nrf_gpio_port_out_set. And nrf_gpio_pin_out_read reads the value of OUT. 

My question is what is the difference between nrf_gpio_port_out_set and nrf_gpio_port_out_write? When can we use nrf_gpio_pin_out_read to read the last written value?

Parents Reply
  • Yes. I want to read the value of OUTPUT GPIO pin that I have written. But I have found that nrf_gpio_pin_out_read gives me back incorrect value. I am trying to figure out whether my flow is correct, because we use nrf_gpio_pin_write -> nrf_gpio_pin_set -> nrf_gpio_port_out_set to set the value of the pin and nrf_gpio_pin_out_read to read the state of the output pin. Is it correct? Can we use nrf_gpio_pin_out_read in this case?

Children
Related