This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

gpio problem

Hi,

I have very trivial question. I open the template program which is attached in SDK 11.0. In application timers start function I wrote the following code. The result is value 1 on the terminal. I will be really grateful if someone can help. I tested the program on two nrf51822 chips but I got the same result. Is it possible that I have some settings which block gpio functions.

static void application_timers_start(void)
{
   
	
	  uint32_t pin = 9;
          nrf_gpio_cfg_output(pin);
          nrf_gpio_pin_clear(pin);
	  NRF_LOG_PRINTF("%d\r\n", nrf_gpio_pin_read(pin));
   
}

Thanks for help in advance.

Parents
  • Did you read the documentation on the function you are calling? It says quite clearly ..

    __STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number);
    @note  Sense capability on the pin is disabled, and input is disconnected from the buffer as the pins are configured as output.
    

    If you want to read the pin then you need to connect the input buffer so using that macro to set up the pin won't help you. Use the full version of pin setup and connect the input buffer.

  • so basically the problem isn't the thing you reported and the code isn't the code you used to do the testing. How about asking a proper question about the proper issue with the proper code because otherwise you're rather wasting everyone's time.

Reply Children
No Data
Related