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

No communication after Port from Mesh-SDK 2.0.0 to Mesh-SDK 2.2.0

Dear Nordic-Support,

I have implemented some functionality with user defined models on the Mesh2.0.0-SDK. I had implemented both sides (server-client) and i,plemented the provisioning. All the implemnetation seems to work fine (some data loss in the communication occured occasionaly). Now I wanted to switch to the new SDK(2.2.0) I wanted to check if the reliability would be better on the newest SDK, but I have no communication on the 2.2.0-SDK. I have just taken my application and coiped it over, so there is no change in the models. Also the node_setup.c in the provisioner is taken from the old 2.0.0 SDK. After provisoning with the SDK 2.2.0 there is no error during the provisioning itself. I made some debugging, there are no errors on the 'sending' side, on the receiving side the data could be seen, here my debug add in the function access_incoming_handle:

/* ********** Private API ********** */
void access_incoming_handle(const access_message_rx_t * p_message)
{
    const nrf_mesh_address_t * p_dst = &p_message->meta_data.dst;

    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "RxED opcode: 0x%04x\n", p_message->opcode);

    if (dsm_address_is_rx(p_dst))
    {
        uint16_t element_index;
        dsm_handle_t address_handle = DSM_HANDLE_INVALID;
        bool is_element_message = is_element_rx_address(p_dst, &element_index);

        if (!is_element_message)
        {
            /* If it's not one of the element addresses, it has to be a subscription address. */
            NRF_MESH_ERROR_CHECK(dsm_address_handle_get(p_dst, &address_handle));
        }

        for (int i = 0; i < ACCESS_MODEL_COUNT; ++i)
        {
            access_common_t * p_model = &m_model_pool[i];
            uint32_t opcode_index;

            bool address_match =
              (is_element_message ? (p_model->model_info.element_index == element_index)
                                  : (model_subscribes_to_addr(p_model, address_handle)));

            if (ACCESS_INTERNAL_STATE_IS_ALLOCATED(p_model->internal_state) &&
                address_match &&
                bitfield_get(p_model->model_info.application_keys_bitfield, p_message->meta_data.appkey_handle) &&
                is_opcode_of_model(p_model, p_message->opcode, &opcode_index))
            {
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Rx found\n");
                if (p_dst->type == NRF_MESH_ADDRESS_TYPE_UNICAST)
                {
                   access_reliable_message_rx_cb(i, p_message, p_model->p_args);
                }
                 p_model->p_opcode_handlers[opcode_index].handler(i, p_message, p_model->p_args);
            }
            else
            {
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "No Acc, match %u model opcode %u bitfield get %u is element msg %u manuf: 0x%04x, modelid 0x%04x\n", 
                      address_match, 
                      is_opcode_of_model(p_model, p_message->opcode, &opcode_index),
                      bitfield_get(p_model->model_info.application_keys_bitfield, p_message->meta_data.appkey_handle),
                      is_element_message,
                      p_model->model_info.model_id.company_id,
                      p_model->model_info.model_id.model_id);
              }
         }
    }
}

Here my output corresponding to the printf in the code above:

<t: 973811>, access.c,  940, RxED opcode: 0xFFFF0052
<t: 973814>, access.c,  983, No Acc, match 0 model opcode 0 bitfield get 0 is element msg 0 manuf: 0xFFFF, modelid 0x0000
<t: 973819>, access.c,  983, No Acc, match 0 model opcode 0 bitfield get 0 is element msg 0 manuf: 0xFFFF, modelid 0x0002
<t: 973824>, access.c,  983, No Acc, match 0 model opcode 0 bitfield get 0 is element msg 0 manuf: 0xFFFF, modelid 0x1000
<t: 973829>, access.c,  983, No Acc, match 0 model opcode 0 bitfield get 0 is element msg 0 manuf: 0xFFFF, modelid 0x1002
<t: 973834>, access.c,  983, No Acc, match 1 model opcode 0 bitfield get 0 is element msg 0 manuf: 0xFFFF, modelid 0x1100
<t: 973838>, access.c,  983, No Acc, match 0 model opcode 1 bitfield get 1 is element msg 0 manuf: 0xFFFF, modelid 0x1102
<t: 973843>, access.c,  983, No Acc, match 0 model opcode 0 bitfield get 0 is element msg 0 manuf: 0xFFFF, modelid 0x1013

It looks like the adress match occour on the wrong model. As I said it was working on the SDK 2.0.0. What has changed between them?

Tell me please if I should send more details.

Best regards:

Roland

Parents
  • Hi Roland,

    Did you take a look at the migration document located in the mesh sdk v2.2.0 folder or here?

    Kind Regards,

    Bjørn

  • Hello Bjorn,

    yes I've read the migration guide, and after a a while of debugging I got the error, which cause not to receive the data, this is independent of the version, I've forgotten that I had commecnted one part out on the old SDK. Maybe You could tell me why my multicast communication is 'thrown' away in the access.c. In the SDK 2.0.0:

    static void handle_incoming(const access_message_rx_t * p_message)
    {
        const nrf_mesh_address_t * p_dst = &p_message->meta_data.dst;
    
         __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "RxED opcode: 0x%04x\n", p_message->opcode);
    
        if (p_dst->type == NRF_MESH_ADDRESS_TYPE_UNICAST)
        {
            dsm_local_unicast_address_t local_addresses;
            dsm_local_unicast_addresses_get(&local_addresses);
    
            if (p_dst->value >= local_addresses.address_start &&
                p_dst->value <  (local_addresses.address_start + local_addresses.count))
            {
                uint16_t element_index = p_dst->value - local_addresses.address_start;
                for (int i = 0; i < ACCESS_MODEL_COUNT; ++i)
                {
                    access_common_t * p_model = &m_model_pool[i];
                    uint32_t opcode_index;
                    if (ACCESS_INTERNAL_STATE_IS_ALLOCATED(p_model->internal_state) &&
                        p_model->model_info.element_index == element_index &&
                        bitfield_get(p_model->model_info.application_keys_bitfield, p_message->meta_data.appkey_handle) &&
                        is_opcode_of_model(p_model, p_message->opcode, &opcode_index))
                    {
                        access_reliable_message_rx_cb(i, p_message, p_model->p_args);
                        p_model->p_opcode_handlers[opcode_index].handler(i, p_message, p_model->p_args);
                    }
                }
            }
        }
        else
        {
            dsm_handle_t address_handle = DSM_HANDLE_INVALID;
            /* If it's not one of the element addresses, it has to be a subscription address. */
            NRF_MESH_ERROR_CHECK(dsm_address_handle_get(p_dst, &address_handle));
            NRF_MESH_ASSERT(dsm_address_subscription_get(address_handle));
            for (int i = 0; i < ACCESS_MODEL_COUNT; ++i)
            {
                access_common_t * p_model = &m_model_pool[i];
                uint32_t opcode_index;
    
                if (ACCESS_INTERNAL_STATE_IS_ALLOCATED(p_model->internal_state) &&
                    ACCESS_SUBSCRIPTION_LIST_COUNT > p_model->model_info.subscription_pool_index  &&
                    bitfield_get(p_model->model_info.application_keys_bitfield, p_message->meta_data.appkey_handle) &&
    #warning "error in smthing smwhere"
                    //bitfield_get(m_subscription_list_pool[p_model->model_info.subscription_pool_index].bitfield, address_handle) &&
                    is_opcode_of_model(p_model, p_message->opcode, &opcode_index))
                {
                    p_model->p_opcode_handlers[opcode_index].handler(i, p_message, p_model->p_args);
                }
            }
        }
    }

    the check:

    bitfield_get(m_subscription_list_pool[p_model->model_info.subscription_pool_index].bitfield, address_handle)

    throws all my communication away. In the SDK 2.2.0

    /* ********** Private API ********** */
    void access_incoming_handle(const access_message_rx_t * p_message)
    {
        const nrf_mesh_address_t * p_dst = &p_message->meta_data.dst;
    
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "RxED opcode: 0x%04x Mesh Addr: 0x%04x\n", p_message->opcode, p_dst->value);
    
        if (dsm_address_is_rx(p_dst))
        {
            uint16_t element_index;
            dsm_handle_t address_handle = DSM_HANDLE_INVALID;
            bool is_element_message = is_element_rx_address(p_dst, &element_index);
    
            if (!is_element_message)
            {
                /* If it's not one of the element addresses, it has to be a subscription address. */
                NRF_MESH_ERROR_CHECK(dsm_address_handle_get(p_dst, &address_handle));
            }
    
            for (int i = 0; i < ACCESS_MODEL_COUNT; ++i)
            {
                access_common_t * p_model = &m_model_pool[i];
                uint32_t opcode_index;
    
                bool address_match =
                    (is_element_message ? (p_model->model_info.element_index == element_index)
                                        : (model_subscribes_to_addr(p_model, address_handle)));
    
                if (ACCESS_INTERNAL_STATE_IS_ALLOCATED(p_model->internal_state) &&
                    address_match &&
                    bitfield_get(p_model->model_info.application_keys_bitfield, p_message->meta_data.appkey_handle) &&
                    is_opcode_of_model(p_model, p_message->opcode, &opcode_index))
                {
                    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Rx found\n");
                    if (p_dst->type == NRF_MESH_ADDRESS_TYPE_UNICAST)
                    {
                        access_reliable_message_rx_cb(i, p_message, p_model->p_args);
                    }
                    p_model->p_opcode_handlers[opcode_index].handler(i, p_message, p_model->p_args);
                }
                else
                {
                    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "No Acc, match %u model opcode %u bitfield get %u is element msg %u manuf: 0x%04x, modelid 0x%04x\n", 
                          address_match, 
                          is_opcode_of_model(p_model, p_message->opcode, &opcode_index),
                          bitfield_get(p_model->model_info.application_keys_bitfield, p_message->meta_data.appkey_handle),
                          is_element_message,
                          p_model->model_info.model_id.company_id,
                          p_model->model_info.model_id.model_id);
                }
            }
        }
    }

    it is inside the call to:

    static bool model_subscribes_to_addr(const access_common_t * p_model, dsm_handle_t address_handle)
    {
        return (p_model->model_info.subscription_pool_index < ACCESS_SUBSCRIPTION_LIST_COUNT);
    #warning "error in smthing smwhere"
         //RG && bitfield_get(m_subscription_list_pool[p_model->model_info.subscription_pool_index].bitfield, address_handle));
    }

    this is very simmilar to SDK 2.0.0.

    Would You like to tell me please what will be chekced on this place, do I something wrong on the subscription to my group address?

    Best regards:

    Roland

  • Hi Roland,

    Are you still using the simple on off model instead of the generic on off model? The mesh sdk v2.2.0 uses the generic on off model instead of the simple on off model. This may lead to some issues. You could naturally still use the simple on off model if you want to do that.

    This case may also be helpful. It seems like there is an issue with the appkey binding process during the configuration phase

    In general, I would recommend taking a look at the release notes of the newest SDK & seeing what the new features & bug fixes are between that one & the SDK version you are running.

    Kind Regards,

    Bjørn

  • Hi Bjørn,

    thank You for the hint withhin the another case, but I don't have problems with the appkey binding, it's just the check for one bit in the m_subscription_list_pool. Could You tell me please what would be stored in ths m_subscription_list_pool, and for what the bitfield and state are used, at which point they will be set? I have looked at the sources, but it's very difficult to me to figure out for what they are implemented. I have about 6 models in this product, could that be too much, is there a maximum, or did I forget to set a define high enough, which makes some trouble?

    Thanks in advance, best regards

    roland

  • Hi Bjørn,

    now I found why it won't work. This was because I have made a subscription to a server, whre I have to do on a client. I had implemented both client and server on every node, so the provisioning set the subscription to the another server, but I don't have set the appkey for this one, so the communication is not routed to my application.

    Sorry for bothering You, it was just my bug.

    Thanks for Your patience, and have a nice weekend.

    roland

  • Hi Roland,

    Great to hear that you figured it out! Have a nice week!

Reply Children
No Data
Related