Cannot get blinky working with nRF52805 on custom board

Hello!

I have a custom board with an nRF52805 on it and I am simply trying to run the Zephyr blinky example and verify I can see a GPIO toggling as my first step. I installed the nRF Connect desktop and all associated toolchains on Windows 11 and I'm using the VS Code extension to manage/build/flash etc. I have been able to build the blinky example code with a custom board build configuration + device tree (attached below) and flash it onto the board, but I have yet to be able to get GPIO P0.20 to toggle. This seems so basic, yet I can't even get this working Disappointed

This is my setup:

  1. Operating System: Windows 11
  2. Development Environment: VS Code with the nRF Connect extention, nRF Connect SDK v2.6.1
  3. Programmer: J-Link Edu
  4. MCU: nRF52805

Here is my main.c (unmodified blinky example code)

/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>

/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   1000

/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)

/*
 * A build error on this line means your board is unsupported.
 * See the sample documentation for information on how to fix this.
 */
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);

int main(void)
{
	int ret;

	if (!gpio_is_ready_dt(&led)) {
		return 0;
	}

	ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
	if (ret < 0) {
		return 0;
	}

	while (1) {
		ret = gpio_pin_toggle_dt(&led);
		if (ret < 0) {
			return 0;
		}
		k_msleep(SLEEP_TIME_MS);
	}
	return 0;
}

and here is my custom board device tree :

(created using "create new board" option in VS Code nRF Connect, and then added gpio definitions following the nRF52-dk device tree)

// Copyright (c) 2024 Nordic Semiconductor ASA
// SPDX-License-Identifier: Apache-2.0

/dts-v1/;
#include <nordic/nrf52805_caaa.dtsi>

/ {
	model = "FreeFly-Main-Flex-V1";
	compatible = "aimrl,freefly-main-flex-v1";

	chosen {
		zephyr,sram = &sram0;
		zephyr,flash = &flash0;
		zephyr,code-partition = &slot0_partition;
	};


	leds {
		compatible = "gpio-leds";
		led0: led_0 {
			gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
			label = "Green LED 0";
		};
	
	};

	/* These aliases are provided for compatibility with samples */
	aliases {
		led0 = &led0;
	};

};


&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x0 0xc000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0xc000 0xa000>;
		};
		slot1_partition: partition@16000 {
			label = "image-1";
			reg = <0x16000 0xa000>;
		};
		scratch_partition: partition@20000 {
			label = "image-scratch";
			reg = <0x20000 0xa000>;
		};
		storage_partition: partition@2a000 {
			label = "storage";
			reg = <0x2a000 0x6000>;
		};
	};
};

&gpio0 {
	status = "okay";
};

&gpiote {
	status = "okay";
};

The only device I've added to my device tree so far is simply gpio0 and gpiote, and set gpio0 P0.20 as active high. I'm confused as to why I'm not getting P0,20 to toggle.

Cheers,

Parker

Parents Reply Children
No Data
Related