nRF5340 Audio DK: GPIO P0.07 Not Outputting High?

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. 

Parents Reply
  • Oh sorry, I referred to the red LED in the blank plastic window in the middle. I didn't actually measure the voltage on the pin header, where you have connected the external LED. 

    But have you tried measuring the pin with a multimeter/voltmeter? And what voltage does your LED require? And are you sure you put the LED in the right orientation? Have you tried connecting it the other way?

    Best regards,

    Edvin

Children
No Data
Related