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

Some troubles in creating groups

I'm trying to create more groups in mesh.We know that all the nodes(servers) are  divided into two groups called ODD and EVEN,so I want to create more groups.

I have changed some codes in the provisioner and client.

In the provisioner node_step.c,the changes as follows,

add the     NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT3,  in config_steps_t,

in the function of config_step_execute(),


}

static void config_step_execute(void)
{
   ......

    switch (*mp_config_step)
    {
      ......

    

        
        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_SERVER:
        {
            config_publication_state_t pubstate = {0};
            pubstate.element_address = m_current_node_addr;
            pubstate.publish_address.type = NRF_MESH_ADDRESS_TYPE_UNICAST;
            if ((m_current_node_addr % 3) == 1)
            {
                pubstate.publish_address.value = UNPROV_START_ADDRESS + ELEMENT_IDX_ONOFF_CLIENT1;
            }
            else if ((m_current_node_addr % 3) == 2)
            {
                pubstate.publish_address.value = UNPROV_START_ADDRESS + ELEMENT_IDX_ONOFF_CLIENT2;
            }
            else
            {
                pubstate.publish_address.value = UNPROV_START_ADDRESS + ELEMENT_IDX_ONOFF_CLIENT3;            
            }
            ......
        }

        /* Configure subscription address for the On/Off server */
        case NODE_SETUP_CONFIG_SUBSCRIPTION_ONOFF_SERVER:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Adding subscription\n");
            uint16_t element_address = m_current_node_addr;
            nrf_mesh_address_t address = {NRF_MESH_ADDRESS_TYPE_INVALID, 0, NULL};
            address.type = NRF_MESH_ADDRESS_TYPE_GROUP;
            if (m_current_node_addr % 0x03 ==1)//
            {
                address.value  = GROUP_ADDRESS_111;
            }
            else if (m_current_node_addr % 0x03 ==2)
            {
                address.value  = GROUP_ADDRESS_222;
            }
            else
            {
                address.value  = GROUP_ADDRESS_333;
            }
           ......
            
            break;
        }

        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT1:
        {
            config_publication_state_t pubstate = {0};
            client_pub_state_set(&pubstate,
                                 m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT1,
                                 GROUP_ADDRESS_111);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const access_status_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, ARRAY_SIZE(exp_status), exp_status);
            break;
        }

        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT2:
        {
            config_publication_state_t pubstate = {0};
            client_pub_state_set(&pubstate,
                                 m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT2,
                                 GROUP_ADDRESS_222);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const access_status_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, ARRAY_SIZE(exp_status), exp_status);
            break;
        }
//add
        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT3:
        {
            config_publication_state_t pubstate = {0};
            client_pub_state_set(&pubstate,
                                 m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT3,
                                 GROUP_ADDRESS_333);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const access_status_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, ARRAY_SIZE(exp_status), exp_status);
            break;
        }

        default:
            ERROR_CHECK(NRF_ERROR_NOT_FOUND);
            break;
    }
}

I added #define GROUP_ADDRESS_333  (0xC004); and #define ELEMENT_IDX_ONOFF_CLIENT3       (3)    in example_network_config.h.

Also in the cient , I set 0,1 to control the 1st group;2,3 to control 2nd group;4,5 to control 3rd group,

static void button_event_handler(uint32_t button_number)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);

    ......

    switch(button_number)
    {
        case 0:
        case 2:
        case 4:
            set_params.on_off = APP_STATE_ON;
            break;

        case 1:
        case 3:
        case 5:
            set_params.on_off = APP_STATE_OFF;
            break;
    }

......
    switch (button_number)
    {
        case 0:
        case 1:
            /* Demonstrate acknowledged transaction, using 1st client model instance */
            /* In this examples, users will not be blocked if the model is busy */
            (void)access_model_reliable_cancel(m_clients[0].model_handle);
            status = generic_onoff_client_set(&m_clients[0], &set_params, &transition_params);
            hal_led_pin_set(BSP_LED_0, set_params.on_off);
            break;

        case 2:
        case 3:
            /* Demonstrate un-acknowledged transaction, using 2nd client model instance */
            status = generic_onoff_client_set_unack(&m_clients[1], &set_params,
                                                    &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
            hal_led_pin_set(BSP_LED_1, set_params.on_off);
            break;

        case 4:
        case 5:
            /* Demonstrate un-acknowledged transaction, using 3nd client model instance */
            status = generic_onoff_client_set_unack(&m_clients[2], &set_params,
                                                    &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
            hal_led_pin_set(BSP_LED_2, set_params.on_off);
            break;
    }

  ......
    }
}

I changed #define CLIENT_MODEL_INSTANCE_COUNT  (3); and #define GROUP_ADDR_COUNT       (3)    in light_switch_example_common.h.

After I finished these work,I found that the servers can react to two groups and the 3rd group without any reaction,the log of debug in client:

0> <t:          0>, main.c,  309, ----- BLE Mesh Light Switch Client Demo -----
 0> <t:          0>, mesh_softdevice_init.c,  117, Initializing SoftDevice...
 0> <t:          0>, mesh_softdevice_init.c,   75, Enabling BLE...
 0> <t:         16>, mesh_softdevice_init.c,  109, sd_ble_enable: app_ram_base should be adjusted to 0x20002DA0
 0> <t:        531>, main.c,  276, Initializing and adding models
 0> <t:        566>, main.c,  341, Device UUID : 0059CCAA000000000D10EC4F9C0BA8D1
  < 0
 0> <t:      59538>, main.c,  177, Button 0 pressed
 0> <t:      59540>, main.c,  206, Sending msg: ONOFF SET 1
 0> <t:      60437>, main.c,  124, Acknowledged transfer success.
 0> <t:      60440>, main.c,  150, OnOff server: 0x0106, Present OnOff: 0, Target OnOff: 1, Remaining Time: 100 ms
 0> <t:      62174>, main.c,  150, OnOff server: 0x0106, Present OnOff: 1, Target OnOff: 1, Remaining Time: 100 ms
 0> <t:      65625>, main.c,  155, OnOff server: 0x0106, Present OnOff: 1
  < 1
 0> <t:      95574>, main.c,  177, Button 1 pressed
 0> <t:      95576>, main.c,  206, Sending msg: ONOFF SET 0
 0> <t:      96149>, main.c,  124, Acknowledged transfer success.
 0> <t:      96151>, main.c,  150, OnOff server: 0x0106, Present OnOff: 1, Target OnOff: 0, Remaining Time: 100 ms
 0> <t:     101202>, main.c,  155, OnOff server: 0x0106, Present OnOff: 0
  < 2
 0> <t:     125058>, main.c,  177, Button 2 pressed
 0> <t:     125060>, main.c,  206, Sending msg: ONOFF SET 1
 0> <t:     127633>, main.c,  150, OnOff server: 0x0104, Present OnOff: 1, Target OnOff: 1, Remaining Time: 100 ms
 0> <t:     131199>, main.c,  155, OnOff server: 0x0104, Present OnOff: 1
  < 3
 0> <t:     151266>, main.c,  177, Button 3 pressed
 0> <t:     151268>, main.c,  206, Sending msg: ONOFF SET 0

any help i'll appreciate very much.

nrf52832, nrf5 SDK for Mesh v2.2.0, nrf5 SDK 15.0.

  • 0> <t:          0>, main.c,  309, ----- BLE Mesh Light Switch Client Demo -----
     0> <t:          0>, mesh_softdevice_init.c,  117, Initializing SoftDevice...
     0> <t:          0>, mesh_softdevice_init.c,   75, Enabling BLE...
     0> <t:         16>, mesh_softdevice_init.c,  109, sd_ble_enable: app_ram_base should be adjusted to 0x20002DA0
     0> <t:        531>, main.c,  276, Initializing and adding models
     0> <t:        566>, main.c,  341, Device UUID : 0059CCAA000000000D10EC4F9C0BA8D1
      < 0
     0> <t:      59538>, main.c,  177, Button 0 pressed
     0> <t:      59540>, main.c,  206, Sending msg: ONOFF SET 1
     0> <t:      60437>, main.c,  124, Acknowledged transfer success.
     0> <t:      60440>, main.c,  150, OnOff server: 0x0106, Present OnOff: 0, Target OnOff: 1, Remaining Time: 100 ms
     0> <t:      62174>, main.c,  150, OnOff server: 0x0106, Present OnOff: 1, Target OnOff: 1, Remaining Time: 100 ms
     0> <t:      65625>, main.c,  155, OnOff server: 0x0106, Present OnOff: 1
      < 1
     0> <t:      95574>, main.c,  177, Button 1 pressed
     0> <t:      95576>, main.c,  206, Sending msg: ONOFF SET 0
     0> <t:      96149>, main.c,  124, Acknowledged transfer success.
     0> <t:      96151>, main.c,  150, OnOff server: 0x0106, Present OnOff: 1, Target OnOff: 0, Remaining Time: 100 ms
     0> <t:     101202>, main.c,  155, OnOff server: 0x0106, Present OnOff: 0
      < 2
     0> <t:     125058>, main.c,  177, Button 2 pressed
     0> <t:     125060>, main.c,  206, Sending msg: ONOFF SET 1
     0> <t:     127633>, main.c,  150, OnOff server: 0x0104, Present OnOff: 1, Target OnOff: 1, Remaining Time: 100 ms
     0> <t:     131199>, main.c,  155, OnOff server: 0x0104, Present OnOff: 1
      < 3
     0> <t:     151266>, main.c,  177, Button 3 pressed
     0> <t:     151268>, main.c,  206, Sending msg: ONOFF SET 0
     0> <t:     156528>, main.c,  155, OnOff server: 0x0104, Present OnOff: 0
      < 4
     0> <t:     184026>, main.c,  177, Button 4 pressed
     0> <t:     184028>, main.c,  206, Sending msg: ONOFF SET 1
     0> <t:     184031>, main.c,  256, Publication not configured for client 4
      < 5
     0> <t:     226614>, main.c,  177, Button 5 pressed
     0> <t:     226616>, main.c,  206, Sending msg: ONOFF SET 0
     0> <t:     226618>, main.c,  256, Publication not configured for client 5
    
    

    all of the log of debug.

  • <t:          0>, main.c,  561, ----- BLE Mesh Light Switch Provisioner Demo -----
    <t:          0>, mesh_softdevice_init.c,  117, Initializing SoftDevice...
    <t:          0>, mesh_softdevice_init.c,   75, Enabling BLE...
    <t:         16>, mesh_softdevice_init.c,  109, sd_ble_enable: app_ram_base should be adjusted to 0x20002DA0
    <t:        607>, main.c,  499, Initializing and adding models
    <t:        618>, main.c,  542, Setup defaults: Adding keys, addresses, and bindings 
    <t:        784>, provisioner_helper.c,  335, netkey_handle: 0
    <t:        797>, main.c,  591, <start> 
    <t:       1218>, main.c,  114, Flash write complete
    <t:       1220>, main.c,  404, Mesh evt: FLASH_STABLE 
    <t:       1222>, main.c,  578, Starting application ...
    <t:       1224>, main.c,  580, Provisoned Nodes: 0, Configured Nodes: 0 Next Address: 0x0100
    <t:       1228>, main.c,  581, Dev key : FB7646B013718CA9382C9930541489B7
    <t:       1231>, main.c,  582, Net key : FFDC51E83D68B83AD76CA4F0390AADCC
    <t:       1235>, main.c,  583, App key : 18FA155D5F6D8791AB2ED6DCFDFF7D1C
    <t:       1237>, main.c,  584, Press Button 1 to start provisioning and configuration process. 
    <t:       1241>, main.c,  404, Mesh evt: FLASH_STABLE 
    <t:     625873>, main.c,  459, Button 1 pressed
    <t:     625875>, main.c,  364, Waiting for Client node to be provisioned ...
    <t:     630638>, provisioner_helper.c,  288, Scanning For Unprovisioned Devices
    <t:     673902>, provisioner_helper.c,  143, UUID seen: 0059CCAA000000000D10EC4F9C0BA8D1
    <t:     673906>, provisioner_helper.c,   95, UUID filter matched
    <t:     675111>, provisioner_helper.c,  263, Provisioning link established
    <t:     821573>, provisioner_helper.c,  258, Static authentication data provided
    <t:     964300>, provisioner_helper.c,  196, Provisioning completed received
    <t:     964303>, provisioner_helper.c,  201, Adding device address, and device keys
    <t:     964309>, provisioner_helper.c,  218, Addr: 0x0100 addr_handle: 0 netkey_handle: 0 devkey_handle: 2
    <t:     964417>, main.c,  404, Mesh evt: FLASH_STABLE 
    <t:     967950>, provisioner_helper.c,  159, Local provisioning link closed: prov_state: 2  remaining retries: 2
    <t:     967955>, main.c,  285, Provisioning successful
    <t:     967957>, provisioner_helper.c,  185, Provisioning complete. Node addr: 0x0100 elements: 4
    <t:     967961>, provisioner_helper.c,   95, UUID filter matched
    <t:     967963>, node_setup.c,  683, Configuring Node: 0x0100
    <t:     967967>, node_setup.c,  573, Config client setup: devkey_handle:2 addr_handle:0
    <t:     967970>, node_setup.c,  344, Getting composition data
    <t:     967980>, access.c,  408, TX: [aop: 0x8008] 
    <t:     967982>, access.c,  409, TX: Msg: 00
    <t:     968039>, main.c,  114, Flash write complete
    <t:     968042>, main.c,  404, Mesh evt: FLASH_STABLE 
    <t:     968635>, main.c,  419, Unhandled Mesh Event: 1 
    <t:     987919>, access.c,  241, RX: [aop: 0x0002]
    <t:     987922>, main.c,  335, Config client event
    <t:     987924>, node_setup.c,  354, Adding appkey
    <t:     987941>, access.c,  408, TX: [aop: 0x0000] 
    <t:     987944>, access.c,  409, TX: Msg: 00000018FA155D5F6D8791AB2ED6DCFDFF7D1C
    <t:     987947>, main.c,  419, Unhandled Mesh Event: 0 
    <t:     990148>, main.c,  419, Unhandled Mesh Event: 1 
    <t:     990889>, access.c,  241, RX: [aop: 0x8003]
    <t:     990892>, main.c,  335, Config client event
    <t:     990894>, node_setup.c,  259, opcode status field: 0 
    <t:     990897>, node_setup.c,  365, App key bind: Health server
    <t:     990906>, access.c,  408, TX: [aop: 0x803D] 
    <t:     990908>, access.c,  409, TX: Msg: 000100000200
    <t:     990911>, main.c,  419, Unhandled Mesh Event: 0 
    <t:     991462>, main.c,  419, Unhandled Mesh Event: 1 
    <t:     991748>, access.c,  241, RX: [aop: 0x803E]
    <t:     991752>, main.c,  335, Config client event
    <t:     991754>, node_setup.c,  259, opcode status field: 0 
    <t:     991756>, node_setup.c,  433, Setting publication address for the health server to 0x0001
    <t:     991772>, access.c,  408, TX: [aop: 0x0003] 
    <t:     991775>, access.c,  409, TX: Msg: 0001010000001E81010200
    <t:     991778>, main.c,  419, Unhandled Mesh Event: 0 
    <t:     994975>, access.c,  241, RX: [aop: 0x8019]
    <t:     994978>, main.c,  335, Config client event
    <t:     994980>, node_setup.c,  259, opcode status field: 0 
    <t:     994983>, node_setup.c,  399, App key bind: 0x1001 client on element 0x0101
    <t:     994993>, access.c,  408, TX: [aop: 0x803D] 
    <t:     994996>, access.c,  409, TX: Msg: 010100000110
    <t:     994999>, main.c,  419, Unhandled Mesh Event: 0 
    <t:     996425>, main.c,  419, Unhandled Mesh Event: 1 
    <t:    1021218>, access.c,  408, TX: [aop: 0x803D] 
    <t:    1021220>, access.c,  409, TX: Msg: 010100000110
    <t:    1021794>, main.c,  419, Unhandled Mesh Event: 1 
    <t:    1047430>, access.c,  408, TX: [aop: 0x803D] 
    <t:    1047432>, access.c,  409, TX: Msg: 010100000110
    <t:    1047477>, main.c,  419, Unhandled Mesh Event: 1 
    <t:    1048300>, access.c,  241, RX: [aop: 0x803E]
    <t:    1048304>, main.c,  335, Config client event
    <t:    1048306>, node_setup.c,  259, opcode status field: 0 
    <t:    1048309>, node_setup.c,  399, App key bind: 0x1001 client on element 0x0102
    <t:    1048319>, access.c,  408, TX: [aop: 0x803D] 
    <t:    1048321>, access.c,  409, TX: Msg: 020100000110
    <t:    1048324>, main.c,  419, Unhandled Mesh Event: 0 
    <t:    1048844>, main.c,  419, Unhandled Mesh Event: 1 
    <t:    1049207>, access.c,  241, RX: [aop: 0x803E]
    <t:    1049210>, main.c,  335, Config client event
    <t:    1049213>, node_setup.c,  259, opcode status field: 0 
    <t:    1049215>, node_setup.c,  288, Set: on/off client: 0x0101  pub addr: 0xC003
    <t:    1049231>, access.c,  408, TX: [aop: 0x0003] 
    <t:    1049233>, access.c,  409, TX: Msg: 010103C000001E00010110
    <t:    1049237>, main.c,  419, Unhandled Mesh Event: 0 
    <t:    1051034>, main.c,  419, Unhandled Mesh Event: 1 
    <t:    1058063>, main.c,  419, Unhandled Mesh Event: 1 
    <t:    1071232>, access.c,  241, RX: [aop: 0x8019]
    <t:    1071235>, main.c,  335, Config client event
    <t:    1071237>, node_setup.c,  259, opcode status field: 0 
    <t:    1071240>, node_setup.c,  288, Set: on/off client: 0x0102  pub addr: 0xC002   //there are something lost
    <t:    1071255>, access.c,  408, TX: [aop: 0x0003] 
    <t:    1071258>, access.c,  409, TX: Msg: 020102C000001E00010110
    <t:    1071261>, main.c,  419, Unhandled Mesh Event: 0 
    <t:    1073898>, main.c,  419, Unhandled Mesh Event: 1 
    <t:    1075305>, access.c,  241, RX: [aop: 0x8019]
    <t:    1075308>, main.c,  335, Config client event
    <t:    1075311>, node_setup.c,  259, opcode status field: 0 
    <t:    1075313>, main.c,  250, Configuration of device 0 successful
    <t:    1075316>, provisioner_helper.c,  288, Scanning For Unprovisioned Devices
    <t:    1075319>, main.c,  419, Unhandled Mesh Event: 0 
    <t:    1075380>, main.c,  114, Flash write complete
    <t:    1075382>, main.c,  404, Mesh evt: FLASH_STABLE 
    <t:    1209176>, main.c,  419, Unhandled Mesh Event: 4 
    <t:    1320743>, access.c,  241, RX: [aop: 0x0004]
    <t:    1320746>, main.c,  314, Node 0x0100 alive with 0 active fault(s), RSSI: -40
    <t:    1320749>, main.c,  419, Unhandled Mesh Event: 0 
    <t:    1867180>, main.c,  419, Unhandled Mesh Event: 4
    

    there are some replenish about configuring client ,I found that the GROUP_ADDRESS_333  (0xC004) (I added ) was not bonded to the client ,so I think something lost here.can you me?

  • Hi Bjorn,I don't know if you had tried to do something for this problem ,I think it's the element on client that  I didn't add to and the pub address didn't bind to the element,can you tell me some methods to solve it ?

  • Hi.

    Sorry for the lates response.

    I can see that you asked similar questions before.
    I suggest that you continiue the discussion in one thread until your issue is resolved, instead of creating new ones.

    There is also several other threads on devzone regarding this topic.
    Did you try searching for the solution?

    Best regards,
    Joakim

  • Hi Joakim,

    Thanks for your reply.

    yes , I 've asked in the other case about creating groups,but they're different in vision of Mesh SDK. And the codes and the functions changed a lot  so that I don't think it's the same problem and I have tried to be successful in grouping these servers,I need your help in this problem.

Related