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

nrf52832 custom board: nrf_gpio_pin_write() does not work (nor nrf_gpio_pin_clear())

Hello,

We have a custom board based on nRF52832.

there is 1 LED on P0.29:

#define LED_1          29 

First I initialize the GPIO:

nrf_gpio_cfg_output(LED_1);   // this lights on the LED which is normal because "set" is the default in this macro

nrf_delay_ms(1000);  // let's put a delay for test

But after that impossible to turn off the LED!  

none of these instructions work:

nrf_gpio_pin_write(LED_1,0);   //fails 

nrf_gpio_pin_clear(LED_1);    //fails

Only the nrf_gpio_pin_toggle(LED_1) turns off the LED but I don't want to use that.

Any ideas?

Thanks.

John.

 

Parents Reply
  • Is the GPIO connected to the anode or cathode of the LED on your board? The reason I ask is that you write that the LED is on after the call to nrf_gpio_cfg_output(). However, this does not set the GPIO to '1', and the reset value of the OUT register is all zero. So essentially, it seems that your LED is connected with the anode to VDD and the cathode to VSS via the GPIO which causes it to be on when the GPIO is '0' and off when the GPIO is '1'. If this is the case, then calling nrf_gpio_pin_write(LED_1,1); or nrf_gpio_pin_set(LED_1); will turn off the LED.

Children
Related