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
You are right, the element for now is hardcoded. You choose the number of element on your serial device by modifying ACCESS_ELEMENT_COUNT in nrf_mesh_config_app.h .
Note that this value is also read by the interactive python. So the source code and the hex file running on the serial board have to be in sync.
Thanks for your replay.
Can you check if I got right how the models work over serialAPI:
1. In the code on nRF52 I have to define and initialize the models and set them up during startup
2. add models to the serial list using serial_handler_models_register
3. Start Serial API
4. Call models init over serial to get the Handles
5. Then use the model serial API using the handle
Is this the right approach?
Thanks in advance
Yes, I think it's the right approach when you want to locate the model on the serial device and want to have control from the serial interface.
Another option is to have the model be initialized on the host (PC) and the serial interface act as purely connectivity chip. This approach you can find an example here, in "Blinking LEDs" section
Depends on your application you can choose more relevant approach.
I have tried the approach from the link but it I have run into a problem. When I run the serial example I can do the provisioning properly as described in the link. However when I try to get the Composition data from the porvisioner I get the following error on the node
Is this an issue because there is no ConfigurationDevice Model implemented for pythonACI or is there something else a problem here?
Thank you so much for all your help
Could you let me know about your setup ? Which device is provisioner which device running serial ?
I don't think the PyACI has configuration server on it to response with composition data.You would need to implement one .
The error I see in the screenshot I think it's when you receive a packet which has the element number outside of the number of elements on the node. This could be a bug that we don't have the correct number of elements as defined by ACCESS_ELEMENT_COUNT. COuld you check what was the self.elements value ?