7002dk with 01_IOT and 05_Golioth

Hi,

i’ve problem connecting nrf7002dk with 01_IOT

/home/hubert/golioth-ncs-workspace/zephyr-training/01_IOT/prj.conf:51: warning: attempt to assign the value 'y' to the undefined symbol NETWORK_INFO
Parsing /home/hubert/golioth-ncs-workspace/zephyr-training/01_IOT/Kconfig
Loaded configuration '/home/hubert/golioth-ncs-workspace/nrf/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpuapp_defconfig'
Merged configuration '/home/hubert/golioth-ncs-workspace/zephyr-training/01_IOT/prj.conf'
Merged configuration '/home/hubert/golioth-ncs-workspace/zephyr-training/01_IOT/boards/nrf7002dk_nrf5340_cpuapp.conf'

error: Aborting due to Kconfig warnings

indeed there is no thing like NETWORK_INFO inside Kconfig. I only did change IP address inside nrf7002dk .conf to match gateway etc.

im not using python VE, i’ve followed steps from
Set up Nordic nRF Connect SDK (NCS) | Golioth

to install it globally.

my /zephyr-training is inside my golioth-ncs-workspace.

so that’s one problem.

But there is also a problem with connecting to 05_golioth LightDB_Stream form zephyr-training. I’ve added things from guide to my code, created pipeline with same configuration-Btw where is now LightDB stream sample? - and i dont receive anything in my webconsole. I guess golioth is connected because I see LED 0 changing its state in LightDB_state

05_golioth
prj.conf


CONFIG_GOLIOTH_FIRMWARE_SDK=y
CONFIG_GOLIOTH_SAMPLE_COMMON=y

# Configure Golioth SDK dependencies
CONFIG_EVENTFD_MAX=14
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1536
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=10240
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=2048
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048
CONFIG_NETWORKING=y
CONFIG_NET_IPV4=y
CONFIG_POSIX_MAX_FDS=23

# Application
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_NET_LOG=y
CONFIG_NET_SHELL=y

CONFIG_GOLIOTH_SETTINGS=y
CONFIG_GOLIOTH_STREAM=y
# Runtime credentials
CONFIG_GOLIOTH_SAMPLE_PSK_ID_MAX_LEN=128
CONFIG_SETTINGS=y
CONFIG_SETTINGS_RUNTIME=y
CONFIG_GOLIOTH_SAMPLE_HARDCODED_CREDENTIALS=n
CONFIG_GOLIOTH_SAMPLE_PSK_SETTINGS=y
CONFIG_GOLIOTH_SAMPLE_SETTINGS_AUTOLOAD=y
CONFIG_GOLIOTH_SAMPLE_SETTINGS_SHELL=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y

CONFIG_SHELL=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_BUFFER_SIZE=2048

CONFIG_GOLIOTH_SAMPLE_PSK_ID="nasdadadssdad"
CONFIG_GOLIOTH_SAMPLE_PSK="sdadsadasdadads"
CONFIG_GOLIOTH_SAMPLE_WIFI_SSID="asdasddsa"
CONFIG_GOLIOTH_SAMPLE_WIFI_PSK="adsasdads"
`

Main.c

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

#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(add_golioth, LOG_LEVEL_DBG);

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

/* Includes for connectivity */
#include <zephyr/net/coap.h>

/* Helper functions for passing credentials to Golioth client */
#include <samples/common/sample_credentials.h>

#ifdef CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP
#include <wifi_util.h>
#else
#include <samples/common/net_connect.h>
#endif
#include <golioth/client.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   1000
#include <golioth/stream.h>
/* The devicetree node identifiers for the "led0" and "training_led" */
#define LED0_NODE DT_ALIAS(led0)
#define LED1_NODE DT_ALIAS(training_led)

/*
 * 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 led1 = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
static const struct gpio_dt_spec led2 = GPIO_DT_SPEC_GET(LED1_NODE, gpios);

/* Blink LED1 using a Zephyr Timer */
extern void my_timer_handler(struct k_timer *dummy) {
	gpio_pin_toggle_dt(&led1);
}

K_TIMER_DEFINE(my_timer, my_timer_handler, NULL);

/* Blink LED2 using a Zephyr Thread */
static void my_thread_handler(void *dummy1, void *dummy2, void *dummy3) {
	if (!device_is_ready(led2.port)) {
		return;
	}

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

	while (1) {
		gpio_pin_toggle_dt(&led2);
		k_sleep(K_SECONDS(1));
	}
}
static struct golioth_client *client;
static K_SEM_DEFINE(connected, 0, 1);

static void on_client_event(struct golioth_client *client,
			    enum golioth_client_event event,
			    void *arg)
{
	bool is_connected = (event == GOLIOTH_CLIENT_EVENT_CONNECTED);

	if (is_connected) {
		k_sem_give(&connected);
	}
	LOG_INF("Golioth client %s", is_connected ? "connected" : "disconnected");
}

K_THREAD_DEFINE(my_thread, 1024,
                my_thread_handler, NULL, NULL, NULL,
                K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0);

/* Main function */
int main(void)
{
	int ret;

	if (!device_is_ready(led1.port)) {
		return -EIO;
	}

	ret = gpio_pin_configure_dt(&led1, GPIO_OUTPUT_ACTIVE);
	if (ret < 0) {
		return -EIO;
	}

	/* Start timer-based LED blinker */
	k_timer_start(&my_timer, K_MSEC(200), K_MSEC(200));

	/* Start network connection (if necessary) */
#ifdef CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP
	wifi_connect();
#else
	if (IS_ENABLED(CONFIG_GOLIOTH_SAMPLE_COMMON)) {
		net_connect();
	}
#endif
/* Get golioth_client_config filled with PSK-ID/PSK credentials
 * using Golioth common Library */
const struct golioth_client_config *client_config = golioth_sample_credentials_get();

/* Use golioth_client_config to create the Golioth client */
client = golioth_client_create(client_config);

/* Register a callback to run when we connect to Golioth */
golioth_client_register_event_callback(client, on_client_event, NULL);

/* Block program flow until connection is ready */
k_sem_take(&connected, K_FOREVER);
	int counter = 0;

	while (1) {
		printk("This is the main loop: %d\n", counter);
		char sbuf[32];
		snprintk(sbuf, strlen(sbuf), "{\"upcount\":%d}", counter);

		golioth_stream_set_async(client,
					 "sensor",
					 GOLIOTH_CONTENT_TYPE_JSON,
					 sbuf,
					 sizeof(sbuf),
					 NULL,
					 NULL);
		++counter;
		k_msleep(SLEEP_TIME_MS);
	}
}

From serial port


[00:00:01.444,335] <inf> add_golioth: Static IP address (overridable): 1OK
xx.xxx.0.xx/255.255.255.0 -> 192.168.0.1
[00:00:03.070,922] <inf> add_golioth: Connection requested
[00:00:14.801,910] <inf> add_golioth: Connected
[00:00:14.802,215] <inf> golioth_mbox: Mbox created, bufsize: 1232, num_items: 10, item_size: 112
[00:00:14.802,490] <err> golioth_coap_client_zephyr: Fail to get address (coap.golioth.io 5684) -11
[00:00:14.802,490] <err> golioth_coap_client_zephyr: Failed to connect: -11
[00:00:14.802,520] <wrn> golioth_coap_client_zephyr: Failed to connect: -11
[00:00:14.836,029] <inf> net_dhcpv4: Received: 192.168.18.97
[00:00:14.836,151] <inf> net_config: IPv4 address: 192.168.18.97
[00:00:14.836,151] <inf> net_config: Lease time: 86400 seconds
[00:00:14.836,212] <inf> net_config: Subnet: 255.255.255.0
[00:00:14.836,242] <inf> net_config: Router: 192.168.18.1

Forgot to change my IP (0 to 18 )above, but device found it(probably)
`
Pipeline is enabled and shows 0 recent usage.

Hi Dzolo,

Zephyr uses manifest files (usually named west.yml) to manage dependencies and versions of those dependencies. In the case of the network info library, you’ll find it in the west manifest for the zephyr-training repository you are trying to build:

It should be possible to add this to the the west-ncs.yml manifest file in the NCS tree you have installed. However, you’ll need to make sure the Golioth SDK and its dependencies match what the zephyr-training manifest needs.

If you are following along to get up to speed on Zephyr, I highly recommend the “happy path” of installing the repo as a standalone project. Those instructions are in the readme: zephyr-training/README.rst at main · golioth/zephyr-training · GitHub

Wow, thats actually weird. I’ve thought i downloaded latest release. I’ll try it, do you maybe know answer to second question?

Ok, i’ve just reinstalled it, and now it works. There was network info inside my west manifest, dunno why it wasnt working, but more importantly it does now so thank you :slight_smile:

1 Like