Error while publishing from one node to another node in Bluetooth Mesh


Vikrant More <vikrant8051@...>
 

void foo(int a,int b)
{

    static volatile int tmp = 0;

    struct net_buf_simple *msg1 = NET_BUF_SIMPLE(10);

    struct bt_mesh_msg_ctx ctx1 = {
        .net_idx = b,
        .app_idx = a,
        .addr = 0xFFFE,            // <------------------------------------------------------------------Group Address of all Relay
        .send_ttl = BT_MESH_TTL_DEFAULT,
    };

    
    bt_mesh_model_msg_init(msg1, BT_MESH_MODEL_OP_2(0x82, 0x03));

    net_buf_simple_add_u8(msg1,tmp);
    net_buf_simple_add_u8(msg1,0x00);
    net_buf_simple_add_u8(msg1,0x00);
    net_buf_simple_add_u8(msg1,0x00);

    if (bt_mesh_model_send(&root_models[2], &ctx1, msg1, NULL, NULL))
    {
        printk("Unable to send Vendor Button message\n");
    }

    printk("Button message sent with OpCode 0x%08x\n", BT_MESH_MODEL_OP_2(0x82, 0x03));

    tmp++;

}

I am trying to execute above function foo() from Button interrupt on nRF52840_PCA10056.

And getting error As attached in image.

My intention is to send value of tmp variable to all nodes in the Group. Could you please help me to solve
this error ?



Johan Hedberg
 

Hi Vikrant,

On Thu, Nov 30, 2017, Vikrant More wrote:
I am trying to execute above function foo() from Button interrupt on
nRF52840_PCA10056.

And getting error As attached in image.

My intention is to send value of *tmp* variable to all nodes in the Group.
Could you please help me to solve
this error ?
It looks like the sender has been reset without restoring its earlier
state, whereas the receiver has continued running all the time. This
will cause the sender to send using an "old" sequence number, which the
receiver then correctly discards as it's considered to be a message
replay attempt.

Johan