Remote provisioning of Dimming Server Example

Hi there.

Setup:

NRF SDK 17.1.0, MESH SDK 5.0.0, Segger Studio

DK1 PCA10056 pb_remote_client (for starting the remote provisioning)

DK2 PCA10056 Dimming Server example running, added parts from pb_remote_server for remote provisioning.

Issue:

DK 1 works as expected, wait for beacon, start provisioning

Log:

<t:   11576009>, main.c,  175, Local provisioning link established
<t:   11577812>, main.c,  219, Using static authentication
<t:   11591144>, main.c,  229, Static authentication data provided
<t:   11737090>, main.c,  184, Provisioned device addr: 0x1347 net_key_handle: 0
<t:   11737093>, main.c,  186, Dev Key: 9B749E470FDA945657016CD32BD0D229
<t:   11737103>, main.c,  194, Provisioning complete! Added 0x1347 as handle 1
<t:   11743125>, main.c,  179, Local provisioning link closed

but on DK2

Log:

<t:      18835>, app_level.c,  295, SET: Level: 0  delay: 0  tt: 0  req-delta: 0  trans-type: 0
<t:      18840>, main.c,  773, Transition time: 0, Target level: 0, Transition type: 0
<t:      18844>, app_level.c,  239, Transition completed: Present-L: 0  Target-L: 0
<t:      88095>, main.c, 1405, Mesh device identification started.
<t:     184843>, app_error_weak.c,  115, Mesh error 7 at 0x00000000 (:0)

To pin down the Mesh error 7 seems to come from the SD140 while changing the state from "device identification started cb" to "Provisioning completed"

Question:

pb_remote server model should be running byside of app level and scene server.

According to the Communication handshaking provisioning should be confimed by the server.

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v5.0.0%2Fmd_doc_user_guide_modules_provisioning_pb_remote.html

How has the PB Remote Server to be integrated in the service model(s) on the Mesh side?

Parents
  • Hi Joakim

    /* Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without modification,
     * are permitted provided that the following conditions are met:
     *
     * 1. Redistributions of source code must retain the above copyright notice, this
     * list of conditions and the following disclaimer.
     *
     * 2. Redistributions in binary form, except as embedded into a Nordic
     *    Semiconductor ASA integrated circuit in a product or a software update for
     *    such product, must reproduce the above copyright notice, this list of
     *    conditions and the following disclaimer in the documentation and/or other
     *    materials provided with the distribution.
     *
     * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
     *    contributors may be used to endorse or promote products derived from this
     *    software without specific prior written permission.
     *
     * 4. This software, with or without modification, must only be used with a
     *    Nordic Semiconductor ASA integrated circuit.
     *
     * 5. Any software provided in binary form under this license must not be reverse
     *    engineered, decompiled, modified and/or disassembled.
     *
     * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
     * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    #ifndef NRF_MESH_CONFIG_APP_H__
    #define NRF_MESH_CONFIG_APP_H__
    
    /**
     * @defgroup NRF_MESH_CONFIG_APP nRF Mesh app config
     *
     * Application side configuration file. Should be copied into every
     * application, and customized to fit its requirements.
     * @{
     */
    
    /**
     * @defgroup DEVICE_CONFIG Device configuration
     *
     * @{
     */
    /** Define for acknowledging message transaction timeout.
     * @note @tagMeshSp recommends this to be minimum 60s. However, using
     * recommendation can result in client getting blocked for a significant amount of time (60s), if
     * acknowledged transaction does not receive a response.
     */
    #define MODEL_ACKNOWLEDGED_TRANSACTION_TIMEOUT  (SEC_TO_US(10))
    
    /** Number of Level client models on the dimming client. */
    #define CLIENT_MODEL_INSTANCE_COUNT  (2)
    
    /** Maximum available number of servers to choose correct TTL for the network. */
    #define MAX_AVAILABLE_SERVER_NODE_NUMBER  (40)
    
    /** @} end of MODEL_CONFIG */
    
    /**
     * @defgroup DEVICE_CONFIG Device configuration
     *
     * @{
     *
    
    
    /** Device company identifier. */
    #define DEVICE_COMPANY_ID (ACCESS_COMPANY_ID_NORDIC)
    
    /** Device product identifier. */
    #define DEVICE_PRODUCT_ID (0x0000)
    
    /** Device version identifier. */
    #define DEVICE_VERSION_ID (0x0000)
    
    /** @} end of DEVICE_CONFIG */
    
    /**
     * @defgroup ACCESS_CONFIG Access layer configuration
     * @{
     */
    
    /**
     * The default TTL value for the node.
     */
    #define ACCESS_DEFAULT_TTL (4)
    
    /**
     * The number of models in the application.
     *
     * @note To fit the configuration and health models, this value must equal at least
     * the number of models needed by the application plus two.
     */
    #define ACCESS_MODEL_COUNT (/* Element 0:                                       */ \
                                1 + /* Config Server                                */ \
                                1 + /* Health Server                                */ \
                                1 + /* Generic Level Server                         */ \
                                1 + /* Default Transition Time Server               */ \
                                1 + /* Scene Server                                 */ \
                                1 + /* Scene Setup Server (extends Scene Server)    */ \
                                1 + /* Backup (extends Scene Server)    */             \
                                1   /* Generic level client (extends Scene Server)  */ )
    /**
     * The number of elements in the application.
     *
     * @warning If the application is to support _multiple instances_ of the _same_ model, these instances
     * cannot be in the same element and a separate element is needed for each new instance of the same model.
     */
    #define ACCESS_ELEMENT_COUNT (1)
    
    /**
     * The number of (root only) default transition time instances used by the application.
     */
    #define GENERIC_DTT_SERVER_INSTANCES_MAX (1)
    
    /**
     * The number of generic level instances used by the application. *
     */
    #define GENERIC_LEVEL_SERVER_INSTANCES_MAX (1)
    
    /**
     * The number of scene setup server instances used by the application.
     */
    #ifndef SCENE_SETUP_SERVER_INSTANCES_MAX
    #define SCENE_SETUP_SERVER_INSTANCES_MAX (1)
    #endif
    
    /**
     * The number of allocated subscription lists for the application.
     *
     * @note This value must equal @ref ACCESS_MODEL_COUNT minus the number of
     * models operating on shared states.
     */
    #define ACCESS_SUBSCRIPTION_LIST_COUNT (ACCESS_MODEL_COUNT)
    
    /**
     * @defgroup ACCESS_RELIABLE_CONFIG Configuration of access layer reliable transfer
     * @{
     */
    
    /** Number of the allowed parallel transfers (size of the internal context pool). */
    #define ACCESS_RELIABLE_TRANSFER_COUNT (ACCESS_MODEL_COUNT)
    
    /** @} end of ACCESS_RELIABLE_CONFIG */
    
    
    /** @} end of ACCESS_CONFIG */
    
    
    /**
     * @ingroup HEALTH_MODEL
     * @{
     */
    
    /** The number of instances of the health server model. */
    #define HEALTH_SERVER_ELEMENT_COUNT (1)
    
    /** @} end of HEALTH_MODEL */
    
    
    /**
     * @defgroup DSM_CONFIG Device State Manager configuration
     * Sizes for the internal storage of the Device State Manager.
     * @{
     */
    /** Maximum number of subnetworks. */
    #define DSM_SUBNET_MAX                                  (4)
    /** Maximum number of applications. */
    #define DSM_APP_MAX                                     (8)
    /** Maximum number of device keys. */
    #define DSM_DEVICE_MAX                                  (1)
    /** Maximum number of virtual addresses. */
    #define DSM_VIRTUAL_ADDR_MAX                            (2)
    /** Maximum number of non-virtual addresses.
     * - Generic Level publication
     * - Health publication
     * - Subscription address
     */
    #define DSM_NONVIRTUAL_ADDR_MAX                         (3)
    /** @} end of DSM_CONFIG */
    
    /** @} */
    
    /**
     * @defgroup NRF_MESH_CONFIG_CORE Compile time configuration
     * Configuration of the compilation of the core mesh modules.
     * @ingroup CORE_CONFIG
     * @{
     */
    
    /**
     * @defgroup MESH_CONFIG_GATT GATT configuration defines
     * @{
     */
    /** PB-GATT feature. To be enabled only in combination with linking GATT files. */
    #define MESH_FEATURE_PB_GATT_ENABLED                    (1)
    /** GATT proxy feature. To be enabled only in combination with linking GATT proxy files. */
    #define MESH_FEATURE_GATT_PROXY_ENABLED                 (1) 
    /** @} end of MESH_CONFIG_GATT */
    
    /**
     * @defgroup BLE_SOFTDEVICE_SUPPORT_CONFIG BLE SoftDevice support module configuration.
     * @ingroup MESH_API_GROUP_APP_SUPPORT
     * Configuration for compile time. Part of BLE SoftDevice support module.
     *
     * @{
     */
    #define GAP_DEVICE_NAME                 "My Node"
    /** @} end of BLE_SOFTDEVICE_SUPPORT_CONFIG */
    
    /** @} end of NRF_MESH_CONFIG_CORE */
    
    #endif /* NRF_MESH_CONFIG_APP_H__ */
    

    Hope that helps

    Regards

    Simon

  • Thank you!

    Got some feedback from our developers that it might be related to "dsm_appkey_add". Maybe you could try to increase DSM_APP_MAX and see if there is any improvement?

    Br,
    Joakim

Reply Children
  • Hi Joakim

    thanks for the advise, i changed DSM_APP_MAX (8) to DSM_APP_MAX(10),  clear MCU, Clean and Rebuild Project. it did not help.

    Still <t:    3345838>, app_error_weak.c,  115, Mesh error 7 at 0x00000000 (:0)

    On the server i set a breakpoint on dsm_appkey_add() and this point will not be passed till the fault.

    According the graphic of the regular Provisioning the Fault comes inbetween Prov Complete and Link closed.

    Viewed from the client side.

    Provisioning Flowchart

    on the Server side i can't find the NRF_MESH_EVT_PROV_COMPLETE, what i found in prov_utils.c is

            /* NRF_MESH_PROV_STATE_WAIT_COMPLETE          */ PROV_PDU_TYPE_COMPLETE       | PDU_VALID_PROVISIONER,
            /* NRF_MESH_PROV_STATE_COMPLETE               */ PROV_PDU_TYPE_INVALID,

    and PROV_PDU_TYPE_COMPLETE is only used in the provisioning.c

    uint32_t prov_tx_complete(prov_bearer_t * p_bearer)
    {
        prov_pdu_complete_t pdu;
        pdu.pdu_type = PROV_PDU_TYPE_COMPLETE;
        return send_data(p_bearer, (const uint8_t *) &pdu, sizeof(prov_pdu_complete_t));
    }

    Still after reboot the device is provisioned and response on the PB Remote client as expected.

    is there a mecanisme for a forced reboot if an error like this occured?

  • Hi Joakim

    I discovered when the Error occurs,

    When calling

    p_ctx->event_handler(&app_event);

    I can work arround this error with a breakpoint at:

    prov_provisinee.c

            case NRF_MESH_PROV_STATE_WAIT_DATA:
                 __LOG(LOG_SRC_PROV, LOG_LEVEL_INFO, "NRF_MESH_PROV_STATE_WAIT_DATA\n");
                complete_provisioning(p_ctx);// Set breakpoint here and release it as soon it stops
                p_ctx->state = NRF_MESH_PROV_STATE_COMPLETE;
                break;

    Is there a runtime condition or what is happening?

    kind regards

    Simon

  • Thanks for the update.

    Had a talk with our developers, who tried the pb_remote example with your configuration and didn't get the same error.

    Suggestion from our Mesh team:
    Put a breakpoint before:
    https://github.com/NordicSemiconductor/nRF5-SDK-for-Mesh/blob/a165eece1b743bc68ef396bf03ba389a0bac6f11/examples/common/src/app_error_weak.c#L115-L119
    and print stack trace. That way we can get a better idea of what is causing the error.

    Br,
    Joakim

  • Hello Joakim

    below the Print from the call Stack(i supose that is what you are looking for)

    Call Stack bevore mesh error 7

    in the meantime i discovered the source of the error.

    while

    #define MESH_FEATURE_GATT_PROXY_ENABLED                 (1)  // this should be turned off when remote provisioning

    was true there could be a conflict.

    With disabling the Gatt Proxy the error dissapears, the value of DSM_APP_MAX(8) should be DSM_APP_MAX(10) for my case, otherwise i get an mesh error 5 at the same point.

  • Thank you for the update. 

    There isn't anything related to remote provisioning that blocks the usage of the proxy feature, so there could be something related to the configuration. 

    Do you need to use the proxy feature?

    Comment from out Mesh team: 
    "For me the MESH_FEATURE_GATT_PROXY_ENABLED option works in pb_remote_server sample, but I had to copy the missing configuration from the light_switch sample as GATT support is not enabled in pb_remote samples by default."

    Br, 
    Joakim

Related