Hello,
I am trying to make GPIO P0.07 to high, in my nrf5340 Audio DK. Externally I am connecting an LED between P0.07 and GND. But it not showing any voltage between them. below is my code
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/printk.h>
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(newpin), testpin_gpios);
int main(void)
{
int ret;
if (!gpio_is_ready_dt(&led)) {
printk("Error: LED device %s is not ready\n", led.port->name);
return 0;
}
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
if (ret < 0) {
printk("Error %d: Failed to configure LED pin\n", ret);
return 0;
}
printk("Setting GPIO HIGH on P0.07\n");
/* Set GPIO HIGH */
gpio_pin_set_dt(&led, 1);
while (1) {
k_sleep(K_FOREVER); // Keep running
}
return 0;
}
My overlay file is
/ {
testpin: zephyr,user {
testpin-gpios = <&gpio0 7 0>;
};
aliases {
newpin = &testpin;
};
};
&gpio0 {
status = "okay";
};
&gpiote {
status = "okay";
};
my config file
CONFIG_PRINTK=y CONFIG_PWM=y CONFIG_GPIO=y CONFIG_LOG=y CONFIG_PWM_LOG_LEVEL_DBG=y
But the board's inbuilt red led is glowing.
