Can't add scheduler server model to mesh light sample.

Hi,

I want to add scheduler server to the mesh/light sample with nrf52DK, I change the element define like below:

static struct bt_mesh_elem elements[] = {
    BT_MESH_ELEM(
        1, BT_MESH_MODEL_LIST(
            BT_MESH_MODEL_CFG_SRV,
            BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub),
            BT_MESH_MODEL_ONOFF_SRV(&led_ctx[0].srv),
           
            BT_MESH_MODEL_DTT_SRV(&dtt_srv),
            BT_MESH_MODEL_TIME_SRV(&time_srv),
            BT_MESH_MODEL_SCHEDULER_SRV(&scheduler_srv)
            ),

        BT_MESH_MODEL_NONE),
};
After build and flash, the program can't run and the error log "Initializing mesh failed (err -140)" occur.
I tried to use another nrf52840 board to do the same testing, but the fault still occurred.
After deleting BT_MESH_MODEL_SCHEDULER_SRV(&scheduler_srv) , the program runs normally.
What is the correct approach to handle this?
Parents Reply Children
  • Hi,

    Thanks for your reply, I added  the Scene Server model with Scheduler Server model as below:

    static struct bt_mesh_elem elements[] = {

        BT_MESH_ELEM(
            1, BT_MESH_MODEL_LIST(
                BT_MESH_MODEL_CFG_SRV,
                BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub),
                BT_MESH_MODEL_ONOFF_SRV(&led_ctx[0].srv),
                BT_MESH_MODEL_DTT_SRV(&dtt_srv),
                BT_MESH_MODEL_TIME_SRV(&time_srv),
                BT_MESH_MODEL_SCHEDULER_SRV(&scheduler_srv),
                BT_MESH_MODEL_SCENE_SRV(&scene_srv)),
            BT_MESH_MODEL_NONE),
    };

    The error log will still appear , the complete log is as below:

    *** Booting Mesh Light v2.9.1-60d0d6c8d42d ***
    *** Using nRF Connect SDK v2.9.1-60d0d6c8d42d ***
    *** Using Zephyr OS v3.7.99-ca954a6216c9 ***
    Initializing...
    [00:00:00.024,475] <inf> fs_nvs: 8 Sectors of 4096 bytes
    [00:00:00.030,395] <inf> fs_nvs: alloc wra: 2, ea0
    [00:00:00.035,797] <inf> fs_nvs: data wra: 2, cc
    [00:00:00.041,107] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
    79 a3 10 be e6 80 b7 e9 a3 ba cc a9 fc 08 66 12 |y....... ......f.
    90 cf 45 a9 |..E.
    [00:00:00.074,157] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.082,244] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:00.088,989] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 121.4259 Build 3078678206
    [00:00:00.100,830] <inf> bt_hci_core: No ID address. App must call settings_load()
    Bluetooth initialized
    [00:00:00.111,541] <wrn> bt_mesh_access: Unused space in relation list: 5
    Initializing mesh failed (err -140)

  • Hi,

    Right, so after digging some more, I found that the Scene Server is actually automatically added by the Scheduler Server, so it should not be added manually. (I.e., you do not need the "BT_MESH_MODEL_SCENE_SRV(&scene_srv)".)

    In addition to adding the models to the element list, they should also be added in configs (typically in the file prj.conf):

    CONFIG_BT_MESH_TIME_SRV=y
    CONFIG_BT_MESH_SCHEDULER_SRV=y
    CONFIG_BT_MESH_SCENE_SRV=y
    CONFIG_BT_MESH_DTT_SRV=y

    Also, how are you creating the scheduler server instance itself, you should have something like e.g.:

    static struct bt_mesh_scheduler_srv scheduler_srv = BT_MESH_SCHEDULER_SRV_INIT(NULL, &time_srv);

    You also need similar initialization for the other models.

    If those are all in place, then please share the prj.conf file, as well as the model_handler.c, so we can have a look at what could be the issue. If you don't want to share your files here in a public ticket, then please create a private one and share the files there, and refer to this case from the new one.

    Regards,
    Terje

Related