This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Self provisioning

Hi;

i am using sdk 17.0.2 and mesh 5.0.0. 

i am using light switch instance.In addition, the system works properly when provisioning is made with a smartphone.

I want self provisioning in this example. In other words, I want it to know both its own addressing and the address of the node to which it will send.

I took the code from the  https://devzone.nordicsemi.com/f/nordic-q-a/44515/mesh-node-self-provisioninglink and made the node get its own address. but I couldn't find any information on how to determine the address to send to.

#define APPKEY_INDEX (0)
#define NETKEY_INDEX (0)
#define GROUP_ADDRESS (0xCAFE)
    uint8_t netkey[16] = {0x79, 0xF5, 0xF1, 0x6A, 0x43, 0x22, 0x17, 0xDF, 0x1D, 0xC1, 0x59, 0x10, 0x13, 0x0A, 0x31, 0x6F};
    uint8_t appkey[16] = {0x5B, 0xD8, 0xDE, 0xB4, 0x49, 0xAB, 0x15, 0x1B, 0x72, 0x7F, 0xD4, 0x56, 0xF5, 0x49, 0x81, 0x9B};

    nrf_mesh_network_secmat_t KEY;
    //static const uint8_t KEY[NRF_MESH_KEY_SIZE] = NETKEY;
    dsm_local_unicast_address_t local_address = {0x0060, ACCESS_ELEMENT_COUNT};
    dsm_handle_t net_handle, dev_handle, app_handle, vendor_handle, handle;
    handle = DSM_HANDLE_INVALID;
    dev_handle = DSM_HANDLE_INVALID;
    ERROR_CHECK(dsm_local_unicast_addresses_set(&local_address));
    ERROR_CHECK(dsm_subnet_add(0, KEY.privacy_key, &net_handle));
    ERROR_CHECK(dsm_devkey_add(local_address.address_start, net_handle, KEY.privacy_key, &dev_handle));
    KEY.privacy_key[15] = 0xA0;
    ERROR_CHECK(dsm_appkey_add(0, net_handle, KEY.privacy_key, &app_handle));
    //PERSISTENT_STORAGE
    ERROR_CHECK(config_server_bind(dev_handle));
    //bool IsValid = vendor_handle_get(&vendor_handle);
    //if (IsValid == 0)
    //  while (1)
    //; //stay locked
    ERROR_CHECK(access_model_application_bind(m_clients_simple.model_handle, app_handle));

    // Add the address to the DSM as a subscription address:
    int i = dsm_address_subscription_add(GROUP_ADDRESS, &handle);
    // Add the subscription to the model:
    i = access_model_subscription_add(m_clients_simple.model_handle, handle);
    //dsm_address_publish_add(0x0051,
    custom_change_publish_address(0x0051);
    mesh_stack_device_reset(); //power cycle after self provisioning

The above code allowed the node to get its own address, but when I send it, I get a Publication not configured for client warning. What is the missing code for the provisioning process?

Parents Reply Children
No Data
Related