Skip to content

Mesh_demo with a nRF52840 not working #30207

@4ayo

Description

@4ayo

log1.txt
log2.txt

Describe the bug
I'm trying to run the /zephyrproject/zephyr/samples/bluetooth/mesh_demo with two nRF52840dk without success. One would be flashed with NODE_ADDR 0x0b0c (in board.h file), and the other with NODE_ADDR 0x000f.

At first we could believe everything was fine but in fact the devices aren't approvisioned. To see it, I first changed the configure() method in main.c to print whenever an error occurred :

static int configure(void)
{
	int err = 0;
	printk("Configuring...\n");

	/* Add Application Key */
	err = bt_mesh_cfg_app_key_add(net_idx, addr, net_idx, app_idx, app_key, NULL);
	if (err < 0) {
		printk("Failed to add app-key (err %d)\n", err);
		return err;
	}	

	/* Bind to Health model */
	err = bt_mesh_cfg_mod_app_bind(net_idx, addr, addr, app_idx,
				 BT_MESH_MODEL_ID_HEALTH_SRV, NULL);
	if (err < 0) {
		printk("Failed to bind app-key for health (err %d)\n", err);
		return err;
	}

	/* Bind to vendor model */
	err = bt_mesh_cfg_mod_app_bind_vnd(net_idx, addr, addr, app_idx,
				     MOD_LF, BT_COMP_ID_LF, NULL);
	if (err < 0) {
		printk("Failed to bind app-key for vendor (err %d)\n", err);
		return err;
	}		

	/* Add model subscription */
	err = bt_mesh_cfg_mod_sub_add_vnd(net_idx, addr, addr, GROUP_ADDR,
				    MOD_LF, BT_COMP_ID_LF, NULL);
	if (err < 0) {
		printk("Failed to add vendor model subscription (err %d)\n", err);
		return err;
	}

	// [...]

	printk("Configuration complete\n");
	return 0;
}

This permitted to discover that the method bt_mesh_cfg_mod_app_bind_vnd() returns -12. The error stack trace is in the file log1.txt

Apparently there isn't enough memory to allocate loopback in net.c. I tried to add CONFIG_BT_MESH_LOOPBACK_BUFS=10 in the prj.conf file. But the I would get another error which is -11 (always with the method bt_mesh_cfg_mod_app_bind_vnd()). The error stack trace is in the file log2.txt.

It seems there is a problem with the length printed by mod_app_status() as I get strange things in the logs but I don't know the origin of the problem.

To Reproduce
Steps to reproduce the behavior:

  1. cd zephyrproject/zephyr/samples/bluetooth/mesh_demo
  2. west build -p auto -b nrf52840dk_nrf52840 .
  3. west flash --erase

Expected behavior
Two self approvisioned devices.

Environment (please complete the following information):

  • Linux Ubuntu 20.04.1 LTS
  • Toolchain : Zephyr SDK
  • I'm up to date with master branch (the command git rev-parse HEAD gives me : 52ad9a468c1a3ae9a00d1e5aac389c5bfcf087ec52ad9a468c1a3ae9a00d1e5aac389c5bfcf087ec)

Best regards !

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions