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

A simple message from server to client in mesh 2.0.1.

Hi,

I am trying to send a simple message from server to client in mesh 2.0.1. I am following this post for the same. I successfully sent a message from client to server and received it in the server side. Now I want to send a message from server to client. I have added all codes provided in the above post and made the specified changes for the server too. But message is not getting sent. 

void address_set(uint16_t addr)                 //function for setting address
{
  uint32_t err_code;
  err_code = dsm_address_publish_add(addr, &m_central_handle); //NRF_ERROR_NO_MEM
  ERROR_CHECK(err_code);
  ERROR_CHECK(access_model_publish_address_set(m_clients[0].model_handle, m_central_handle));
}

I am getting error:   <t:     663640>, app_error_weak.c,  105, Mesh error 4 at 0x000267E9 at examples\simple_message\server\src\main.c:269 ie. at

err_code = dsm_address_publish_add(addr, &m_central_handle); //NRF_ERROR_NO_MEM
ERROR_CHECK(err_code);

The error code is NRF_ERROR_NO_MEM . Can you help me to resolve this? I want to sent a unicast message to the client from server.

  • Hello,

    Do you have logging enabled in your project?

    Can you see if there are any messages about RAM start and RAM size in the start of the log when you run the project?

     

    BR,

    Edvin

  • Hi Edvin,

    This is the log of the server before provisioning. I am setting the address as 0xCAFE.

    <t: 0>, main.c, 276, ----- BLE Mesh Light Switch Client Demo -----
    <t: 0>, mesh_softdevice_init.c, 112, Initializing SoftDevice...
    <t: 0>, mesh_softdevice_init.c, 77, Enabling BLE...
    <t: 2>, mesh_softdevice_init.c, 88, Ram base: 0x200032C8
    <t: 538>, main.c, 249, Initializing and adding models
    <t: 5445>, main.c, 304, Device UUID : 0059ABCDEFABCDEFACCDEFABCDEFABCD

  • Sorry for the late reply,

     

    It looks like the function add_address() doesn't find a handle for the new address. 

    Can you check the nrf_mesh_address_type_t * p_type of the address? I assume it is NRF_MESH_ADDRESS_TYPE_GROUP. Just step through the code from:

    dsm_address_publish_add() (the time that it fails) -> 

    add_address() -> 

    address_exists() (I assume this one returns &handle = DSM_HANDLE_INVALID) ->

    And see whether it steps int p_type == NRF_MESH_ADDRESS_TYPE_VIRTUAL or p_type == NRF_MESH_ADDRESS_TYPE_GROUP

     

    As mentioned, I assume it is NRF_MESH_ADDRESS_TYPE_GROUP. In that case, can you try to increase DSM_NONVIRTUAL_ADDR_MAX (in nrf_mesh_config_app.h) ?

     

    Best regards,

    Edvin

  • Hi Edvin,

    Thank you for replying. As per the instructions I increased DSM_NONVIRTUAL_ADDR_MAX. 

    #define DSM_NONVIRTUAL_ADDR_MAX                         (4)

    I was able to send a message to client like the below given code

    void address_set(uint16_t addr)                   //setting address for sending message
    {
      ERROR_CHECK(dsm_address_publish_add(addr, &m_central_handle));
      ERROR_CHECK(access_model_publish_address_set(m_clients[0].model_handle, m_central_handle));
      }

    In this case I set the address as 0xCAFE, the group address.

    Then tried unicast to client by setting address as 0x100 (client's address). It worked, I got message in client from server. But then I tried to broad cast from server.

    void address_set(uint16_t addr)                   //setting address for sending message
    {
      ERROR_CHECK(dsm_address_publish_add(addr, &m_central_handle));
      ERROR_CHECK(access_model_publish_address_set(m_server.model_handle, m_central_handle));
    }
    
    Here the address was 0xCAFE. But servers did not receive the message. Why is that? There is no error. Message is being sent.

  • Hello,

    The provisioner project is quite hard coded to provision exactly 2 servers with a unicast address, and two groups. 

     

    So you can send a message from the client to the server, and the light changes, right? But the client doesn't receive a message back from the server, is that correct? Does this mean that you don't receive confirmation that the light is changed when it is the client that sent the message, or is it only when the server turns off by itself that the server do not get the message? 

    The changes that you are doing, are they in node_setup.c? Or are you doing the changes outside this file? If the changes are in this file, can you upload that file here?

     

    Best regards,

    Edvin

Related