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

Setup Mesh Server Over Serial API

Hi all,

I am working on an application where I have an application MCU and my idea was to use nRF52 as a 'modem' over serial API. The device I am making is supposed to be a server in a mesh network. So far I have managed to provision the device over serial API by responding to the requests from the provisioner, but I have a problem loading the models and elements through serial API.

I can see that the serial API has functions for initializing models. But what about adding elements? There are set functions for setting properties of existing elements but I can't seem to be able to figure out how to add more and fill them with models.

I am still new to nRF Mesh development so I might be missing something obvious here

Any help would be appreciated 

Thank you

Duv_FT

  • Hi Hung,

    The setup is as follows:

    Device 1 - provisioner - nRF52-DK running serial example connected to PC running pyACI

    Device 2 - node - nRF52-DK running serial example connected to PC running pyACI. The code is altered in a way that the following block is commented out in main.c

    // if (!m_device_provisioned)
    // {
    // static const uint8_t static_auth_data[NRF_MESH_KEY_SIZE] = STATIC_AUTH_DATA;
    // mesh_provisionee_start_params_t prov_start_params =
    // {
    // .p_static_data = static_auth_data,
    // .prov_complete_cb = NULL,
    // .p_device_uri = NULL
    // };
    // ERROR_CHECK(mesh_provisionee_prov_start(&prov_start_params));
    // }

    with this code in place it wouldn't provision. it would hang half way through. I think it is as there were two things attempting to provision the device, the serialAPI and the onboard handler. By commenting the code out the code would continue and finish provisioning. 

    I would setup the node device to be a provisionee and start listening. Then I would follow the example on how to provision the device using pyACI as described in the tutorial and the provisioning works fine. After that when I try to retrieve the composition data I get the error from pic on the node.

    In the example code #define ACCESS_ELEMENT_COUNT (1)  in the C code.

    In the python code in access.py 

    def __event_handler(self, event):
         if event._opcode == Event.MESH_MESSAGE_RECEIVED_UNICAST:
         message = AccessMessage(event)
         element_index = event._data["dst"] - self.elements[0].address

    the event._data["dst"] is 16 which is ok as the node was provisioned to 16

    self.elements[0].address = 1; shouldnt the address of the first element be the unicastAddress?

    it seems that the self.elements[0].address didnt't get updated after provisioning in the Event.PROV_COMPLETE

    DUV

  • Hei Duv, 

     

    Could you post the full log of what you do with pyAci on the provisioner and the provisionee ? Strange that self.elements[0].address was not updated. 

  • Hi Duv, 

    It's just an update. We found a bug in the python code that we didn't update the element addresses database. 

    You can just add this code: 

          for i, e in enumerate(self.iaci.access.elements):

                    e.address = event._data["address"] + i

    At the end of Provisionee() in provisioning.py right before "else:"
    This will update the iaci database of the address.

    Please let us know if this workaround works. 

  • Hi,

    This has solved the problem of the address and the element index is now being calculated correctly.

    Thanks!

    Duv

Related