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

Error : opcode status field: 6 when bind appkey for Health server in MESH v2.1

Hi all , when I combine light switch server and remote server in 1 Node and use Provisioner Node for provisioning and config for it . I have error

Log in provisioner : 

<t:          0>, main.c,  799, ----- BLE Mesh Light Switch Provisioner Demo -----
<t:          0>, mesh_softdevice_init.c,  112, Initializing SoftDevice...
<t:          0>, mesh_softdevice_init.c,   77, Enabling BLE...
<t:          1>, mesh_softdevice_init.c,   88, Ram base: 0x200032C8
<t:        588>, main.c,  728, Initializing and adding models
<t:        603>, main.c,  781, Setup defaults: Adding keys, addresses, and bindings 
<t:        751>, provisioner_helper.c,  333, netkey_handle: 0
<t:        764>, main.c,  830, <start> 
<t:        766>, main.c,  837, Device UUID : 9A533F70C6C4C2C8913CA3844E7ADF05
<t:      27386>, main.c,  140, Flash write complete
<t:      27389>, main.c,  814, Starting application ...
<t:      27391>, main.c,  816, Provisoned Nodes: 0, Configured Nodes: 0 Next Address: 0x0100
<t:      27395>, main.c,  817, Dev key : D05076E02025338264CE79A4EDEB0444
<t:      27398>, main.c,  818, Net key : 5EE6580480F65DFD78F6E495A47960D6
<t:      27401>, main.c,  819, App key : 9893A869A333E9032D8D746668D7F213
<t:      27403>, main.c,  822, Node Address: 0x0001 
<t:      27405>, main.c,  823, Press Button 1 to start provisioning and configuration process. 
<t:     188640>, main.c,  611, Button 1 pressed
<t:     188642>, main.c,  528, Waiting for Server node to be provisioned ...
<t:     193406>, provisioner_helper.c,  286, Scanning For Unprovisioned Devices
<t:     216201>, provisioner_helper.c,  144, UUID seen: 0059FFFF00000000A567C89D6A4AE18A
<t:     216204>, provisioner_helper.c,   95, UUID filter matched
<t:     217691>, provisioner_helper.c,  263, Provisioning link established
<t:     365539>, provisioner_helper.c,  258, Static authentication data provided
<t:     377291>, provisioner_helper.c,  196, Provisioning completed received
<t:     377294>, provisioner_helper.c,  201, Adding device address, and device keys
<t:     377300>, provisioner_helper.c,  218, Addr: 0x0100 addr_handle: 0 netkey_handle: 0 devkey_handle: 2
<t:     380730>, provisioner_helper.c,  155, Local provisioning link closed: prov_state: 2  remaining retries: 2
<t:     380734>, main.c,  429, Provisioning successful
<t:     380737>, main.c,  439, idx = 1
<t:     380738>, provisioner_helper.c,  185, Provisioning complete. Node addr: 0x0100 elements: 3
<t:     380742>, node_setup.c,  726, Configuring Node: 0x0100
<t:     380746>, node_setup.c,  640, Config client setup: devkey_handle:2 addr_handle:0
<t:     380749>, node_setup.c,  384, Getting composition data
<t:     380812>, main.c,  140, Flash write complete
<t:     432961>, main.c,  488, Config client event
<t:     432964>, node_setup.c,  394, Adding appkey
<t:     436881>, main.c,  488, Config client event
<t:     436884>, node_setup.c,  279, opcode status field: 6 
<t:     436886>, node_setup.c,  405, App key bind: Health server
<t:     437553>, main.c,  488, Config client event
<t:     437555>, node_setup.c,  279, opcode status field: 0 
<t:     437558>, node_setup.c,  420, App key bind: Simple On/Off server
<t:     438525>, main.c,  488, Config client event
<t:     438527>, node_setup.c,  279, opcode status field: 0 
<t:     438530>, node_setup.c,  473, Setting publication address for the health server to 0x0001
<t:     440883>, main.c,  488, Config client event
<t:     440886>, node_setup.c,  279, opcode status field: 0 
<t:     440888>, node_setup.c,  500, Set: on/off server pub addr: 0x0003
<t:     472388>, main.c,  488, Config client event
<t:     472390>, node_setup.c,  279, opcode status field: 0 
<t:     472392>, node_setup.c,  511, Adding subscription
<t:     474252>, main.c,  488, Config client event
<t:     474255>, node_setup.c,  279, opcode status field: 0 
<t:     474257>, main.c,  353, Configuration of device 0 successful
<t:     474261>, provisioner_helper.c,  286, Scanning For Unprovisioned Devices
<t:     474317>, main.c,  140, Flash write complete

Opcode = 6 is error . But number 6 indicate for what ?

In Node : If i insert code : 

 /* TODO: This should be handled by the configuration server model. */
    mesh_key_index_t net_key_index;

    uint32_t count = 1;
    ERROR_CHECK(dsm_subnet_get_all(&net_key_index, &count));
    m_netkey_handle = dsm_net_key_index_to_subnet_handle(net_key_index);

    uint8_t appkey[NRF_MESH_KEY_SIZE] = {0};
    ERROR_CHECK(dsm_appkey_add(0, m_netkey_handle, appkey, &m_appkey_handle));
    ERROR_CHECK(dsm_address_publish_add(PROVISIONER_ADDRESS, &m_provisioner_address_handle));/* Bind the keys to the Simple OnOff clients. */
    ERROR_CHECK(access_model_application_bind(m_remote_server.model_handle, m_appkey_handle));
    ERROR_CHECK(access_model_publish_address_set(m_remote_server.model_handle, m_provisioner_address_handle));
   // ERROR_CHECK(access_model_publish_address_set(m_server.model_handle, m_provisioner_address_handle));
    ERROR_CHECK(access_model_publish_application_set(m_remote_server.model_handle, m_appkey_handle));
    ERROR_CHECK(access_model_publish_ttl_set(m_remote_server.model_handle, 6));
    ERROR_CHECK(pb_remote_server_enable(&m_remote_server));
    ERROR_CHECK(pb_remote_server_prov_bearer_set(&m_remote_server, nrf_mesh_prov_bearer_adv_interface_get(&m_prov_bearer_adv)));

I will have above error . But this code need for remote function in server Node . If I dont insert above code into server Node so light switch function work fine , opcode = 0 . 

I want remote function and light switch function all work . Pls show me solution ! Thank very much !!! 

Parents
  • Hi,

    I see that nobody has answered this one yet so I thought I should look into it. I am very sorry that you have not gotten any response previously.

    I found that the status code is an error code, and it is the enumeration access_status_t as defined in access_status.h.

    Access status 6 is ACCESS_STATUS_KEY_INDEX_ALREADY_STORED, and the explanatory documentation string is "The key with given index is already stored in the node with a different value."

    The keys (devkey and appkeys) are stored in a table, and if you try to add multiple keys at the same location in that table it will fail. For instance, dsm_appkey_add() adds an application key to that table, and the first argument (app_key_id) is the index to use in the key table.

    Regards,
    Terje

Reply
  • Hi,

    I see that nobody has answered this one yet so I thought I should look into it. I am very sorry that you have not gotten any response previously.

    I found that the status code is an error code, and it is the enumeration access_status_t as defined in access_status.h.

    Access status 6 is ACCESS_STATUS_KEY_INDEX_ALREADY_STORED, and the explanatory documentation string is "The key with given index is already stored in the node with a different value."

    The keys (devkey and appkeys) are stored in a table, and if you try to add multiple keys at the same location in that table it will fail. For instance, dsm_appkey_add() adds an application key to that table, and the first argument (app_key_id) is the index to use in the key table.

    Regards,
    Terje

Children
No Data
Related