Dear DevZone community,
I'm developing a Mesh application using nRF52840, I'm developing with both the Nordic development kit (BOARD_PCA10056) and USB dongle (BOARD_PCA10059) and using Segger Embedded Studio (SES) in Linux. I'm using version 15.2.0 of the SDK and version 3.1.0 of the Mesh SDK.
I've been trying to solve this error for over a day now. I've read every forum entry on "Mesh Error 4" and similar, that I could find, and tried all the suggested solutions to no avail.
The situation is this: I've written a simple sensor Bluetooth mesh model, a vendor model which I have thoroughly tested and it works for both the server and client versions. I took the Light Switch example and rewrote the app side of things and all the necessary source and header files to integrate the new model, which substituted the Generic OnOff model in the original Nordic example.
Now I've taken the Light Switch example and integrated the simple sensor model with the Generic OnOff. I had no issues doing this with the Client version, I could exchange messages and data between this client and generic onoff servers, and simple sensor servers. No issues with that.
The issue is only happening in the Server side in main.c file. When I instantiate an initialize both models like so:
static void app_model_init(void) { /* Instantiate Simple Sensors server on element index APP_SSENSORS_ELEMENT_INDEX */ ERROR_CHECK(app_simple_sensors_init(&m_ssensors_server_0, APP_SSENSORS_ELEMENT_INDEX)); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App SIMPLE SENSORS Model Handle: %d\n", m_ssensors_server_0.server.model_handle); /* Instantiate onoff server on element index APP_ONOFF_ELEMENT_INDEX */ ERROR_CHECK( app_onoff_init(&m_onoff_server_0, APP_ONOFF_ELEMENT_INDEX) ); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App OnOff Model Handle: %d\n", m_onoff_server_0.server.model_handle); }
I always get the following error:
<t: 13042>, app_error_weak.c, 119, Mesh error 4 at 0x00026855 (/.../sensor_server/src/main.c:134)
which occurs in ERROR_CHECK( app_onoff_init(&m_onoff_server_0, APP_ONOFF_ELEMENT_INDEX) );
I've tried instantiating the GenericOnOff first, and in that case, the error always occurs when I instantiate the second model.
If I only instantiate one of the models, I have no issues and it works fine.
I've also noted that if I omit the ERROR_CHECK like so:
static void app_model_init(void) { /* Instantiate Simple Sensors server on element index APP_SSENSORS_ELEMENT_INDEX */ ERROR_CHECK(app_simple_sensors_init(&m_ssensors_server_0, APP_SSENSORS_ELEMENT_INDEX)); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App SIMPLE SENSORS Model Handle: %d\n", m_ssensors_server_0.server.model_handle); /* Instantiate onoff server on element index APP_ONOFF_ELEMENT_INDEX */ //ERROR_CHECK( app_onoff_init(&m_onoff_server_0, APP_ONOFF_ELEMENT_INDEX);// ); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App OnOff Model Handle: %d\n", m_onoff_server_0.server.model_handle); }
I can circumvent the error message and the application works just fine! I can operate both models in the device and all works as it should!
I've also gotten Mesh Error 5 in some other cases, but the main focus now is solving Mesh error 4 which is the one bugging me. I could simply move on without the Error_Check, as omiting it apparently isn't braking functionality, however I would prefer to do this cleanly.
What can I do?
Thanks in advance!
Regards
//E