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

Blinky non-secure sample not running

Hi

When programming /NordicSDK/v1.3.1/zephyr/samples/basic/blinky in the cpu_app_ns version, it will not start. It is starting when I compile it as a secure application. The sample is modified to monitor a gpio on my custom board:

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

#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>

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

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

#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
#define LED0	DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN	DT_GPIO_PIN(LED0_NODE, gpios)
#if DT_PHA_HAS_CELL(LED0_NODE, gpios, flags)
#define FLAGS	DT_GPIO_FLAGS(LED0_NODE, gpios)
#endif
#else
/* A build error here means your board isn't set up to blink an LED. */
#error "Unsupported board: led0 devicetree alias is not defined"
#define LED0	""
#define PIN	0
#endif

#ifndef FLAGS
#define FLAGS	0
#endif

void main(void)
{
	struct device *dev;
    struct device *led_dev;
    bool led_is_on = true;
	int ret;

	dev = device_get_binding(LED0);
	if (dev == NULL) {
		return;
	}

	ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
	if (ret < 0) {
		return;
	}

    led_dev = device_get_binding("GPIO_0");
    gpio_pin_configure(led_dev, 24, GPIO_OUTPUT);
    gpio_pin_set(led_dev, 24, 0);

	while (1) {
		gpio_pin_set(dev, PIN, (int)led_is_on);
        gpio_pin_set(led_dev, 24, (int)led_is_on);
		led_is_on = !led_is_on;
		k_msleep(SLEEP_TIME_MS);
	}
}

I'm using nRF Connect SDK v1.3.1, and build the code with Segger IDE rel.4.52

Any idea why the ns version is not working?

Parents Reply
  • Hi,

    Not sure if you still have issues, but fyi the nRF5340 is now in mass production, and I recommend to get a new nRF5340-DK with the production silicon. You should also update to Connect SDK v1.4.x for latest fixes and features (this is required if you want to use the nRF5340 moving forward, the nRF5340 preview DK is not recommended for development).

    Kenneth

Children
Related