This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GPIO Pins 0.11 0.4 0.5

Hi,

I'm trying to do a very simple thing - setting those pins as high or low,

but I see that it simply does not work for those pins, I see no change in led state that I connected to those GPIOs.

I see that with other GPIOs the same code works without any issue.

I thought that those Pins might have been already in use for other purposes, so I tried to remap them in an overlay file, but it still doesn't work.

I guess I'm missing something very simple.

I assume that Pins 0.11, 0.4, and 0.5 can be reassign, and are not special in any way, is this correct?

Am I missing something else? Would appreciate your help understanding :)

I'm using nRF connect SDK 1.7.1, nrf52833 dk, here's my code:

#include <zephyr.h>
#include <zephyr/types.h>
#include <sys/printk.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>
#include <nrfx_gpiote.h>


void init_gpio() {
int result;

gpio_device = device_get_binding(GPIO_DEVICE_NAME);
if (gpio_device == NULL) {
printk("Cannot find GPIO_0 device!\r\n");
return;
}

//configure led pin according to device tree configuration
result = gpio_pin_configure(gpio_device, 11, GPIO_OUTPUT);
if (result < 0) {
printk("Cannot configure reboot pin of GPIO device\n");
return;
}

//configure led pin according to device tree configuration
result = gpio_pin_configure(gpio_device, 4, GPIO_OUTPUT);
if (result < 0) {
printk("Cannot configure reboot pin of GPIO device\n");
return;
}

//configure led pin according to device tree configuration
result = gpio_pin_configure(gpio_device, 5, GPIO_OUTPUT);
if (result < 0) {
printk("Cannot configure reboot pin of GPIO device\n");
return;
}
//configure led pin according to device tree configuration
result = gpio_pin_configure(gpio_device, 8, GPIO_OUTPUT);
if (result < 0) {
printk("Cannot configure reboot pin of GPIO device\n");
return;
}

}
void validation_test_gpio() {
int result11, result5, result4, result8;
while (true) {
printk("setting pins 11, 4, 5, 8 to on\r\n");
gpio_pin_set(gpio_device, 11, 1);
gpio_pin_set(gpio_device, 4, 1);
gpio_pin_set(gpio_device, 5, 1);
gpio_pin_set(gpio_device, 8, 1);
result11 = gpio_pin_get(gpio_device, 11);
result4 = gpio_pin_get(gpio_device, 4);
result5 = gpio_pin_get(gpio_device, 5);
result8 = gpio_pin_get(gpio_device, 8);
printk("value of pin11: %d, pin4: %d, of pin5: %d, of pin8: %d\r\n", result11, result4, result5, result8);
k_sleep(K_SECONDS(5));
printk("setting pins 11, 4, 5, 8 to off\r\n");
gpio_pin_set(gpio_device, 11, 0);
gpio_pin_set(gpio_device, 4, 0);
gpio_pin_set(gpio_device, 5, 0);
gpio_pin_set(gpio_device, 8, 0);
result11 = gpio_pin_get(gpio_device, 11);
result4 = gpio_pin_get(gpio_device, 4);
result5 = gpio_pin_get(gpio_device, 5);
result8 = gpio_pin_get(gpio_device, 8);
printk("value of pin11: %d, pin4: %d, of pin5: %d, of pin8: %d\r\n", result11, result4, result5, result8);
k_sleep(K_SECONDS(5));
}
}
My Current overlay file:

&uart0 {
tx-pin = <29>;
rx-pin = <28>;
//current-speed = <1000000>;
};

/ {
zephyr,user {
/* adjust channel number according to pinmux in board.dts */
io-channels = <&adc 3>;
};
};
Thanks in advance!
Vitaliy
Parents Reply Children
No Data
Related