Hello Support,
I just started to play with the self provisioning "Mesh-Demo" sample to get a hang of the BLE Mesh. Since I am working on the nRF52480 DK and don't have a Microbit board, I have decided to adapt the Light_Switch sample for my client node and Light sample for my Server node.
After removing the Heartbeat functionality and replacing it with Generic On Off service, I am successfully able to initialize the mesh and bind App_Key to the Gen_OnOff_Cli model. However, when I try to set the publish address to a specific Unicast address, I keep getting a 'Mount device busy'(-16 code) error.
Here are my publish parameters
struct bt_mesh_cfg_mod_pub pub = {
.addr = 0x000e,
.app_idx = 0,
.ttl = 1,
.period = BT_MESH_PUB_PERIOD_SEC(1),
}; I have chosen 0x000e as my client node's address.
Here is my Mesh element structure with just one element
static struct bt_mesh_cfg_cli cfg_cli = {
};
static struct bt_mesh_elem elements[] = {
#if DT_NODE_EXISTS(DT_ALIAS(sw0))
BT_MESH_ELEM(1,
BT_MESH_MODEL_LIST(
BT_MESH_MODEL_CFG_SRV,
BT_MESH_MODEL_CFG_CLI(&cfg_cli),
BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub),
BT_MESH_MODEL_ONOFF_CLI(&buttons[0].client)),
BT_MESH_MODEL_NONE),
#endif
function call sequence shown below
dk_leds_init(); dk_buttons_init(NULL); bt_mesh_init(&prov, model_handler_init()); . . bt_mesh_provision(net_key, net_idx, flags, iv_index, addr, dev_key); . . bt_mesh_cfg_app_key_add(net_idx, 0x000e, net_idx, app_idx, app_key, NULL); bt_mesh_cfg_mod_app_bind(net_idx, 0x000e, 0x000e, app_idx, BT_MESH_MODEL_ID_HEALTH_SRV, NULL); bt_mesh_cfg_mod_app_bind(net_idx, 0x000e, 0x000e, app_idx, BT_MESH_MODEL_ID_GEN_ONOFF_CLI, NULL); bt_mesh_cfg_mod_pub_set(net_idx, 0x000e, 0x000e, BT_MESH_MODEL_ID_GEN_ONOFF_CLI, &pub, NULL);
Finally here is my Proj.conf
CONFIG_MAIN_STACK_SIZE=4096 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y CONFIG_BT=y CONFIG_BT_ECC=y CONFIG_BT_TINYCRYPT_ECC=y CONFIG_BT_OBSERVER=y CONFIG_BT_BROADCASTER=y CONFIG_BT_SETTINGS=y CONFIG_BT_MESH=y CONFIG_BT_MESH_RELAY=y CONFIG_BT_MESH_SUBNET_COUNT=1 CONFIG_BT_MESH_APP_KEY_COUNT=1 CONFIG_BT_MESH_MODEL_GROUP_COUNT=2 CONFIG_BT_MESH_ADV_BUF_COUNT=10 CONFIG_BT_MESH_LABEL_COUNT=0 CONFIG_BT_MESH_PB_ADV=n CONFIG_BT_MESH_CFG_CLI=y CONFIG_BT_MESH_LOOPBACK_BUFS=8 CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 CONFIG_DK_LIBRARY=y #CONFIG_BT_MESH_DK_PROV=y CONFIG_BT_MESH_ONOFF_CLI=y CONFIG_BT_MESH_ONOFF_SRV=n
Few other threads suggest that there could be an issue in the publish timing. I have tried three timing parameters in the Pub_param struct. 1, 3 and 10 seconds. None fixed the issue. Could you please point out what could be wrong? Thanks
Edited the Mode ID used in the function call sequence..