bt_mesh_model_send doesn't go back to sleep

Hello, 

I have a custom board running as a low power node, consuming around 17uA during sleep. When I have messages back and forth, the node goes back to sleep as usual. However, After I send my first unsolicited message, the device goes to 200uA and never goes back to 17uA.

int32_t bmns_init_sendVndMsg(bmns_opcode_def opcode, uint8_t *bufferIn, uint32_t len)
{
    struct bt_mesh_model *mod = vnd_mod_pub_ctx.mod;

    struct bt_mesh_msg_ctx ctx = {
            .addr = 0x0001,
            .app_idx = mod->keys[0],
            .send_ttl = BT_MESH_TTL_DEFAULT,
    };

    BT_MESH_MODEL_BUF_DEFINE(buf, opcode, len);
    bt_mesh_model_msg_init(&buf, opcode);

    net_buf_simple_add_mem(&buf, bufferIn, len);
    net_buf_simple_add(&buf, '\0');

    return bt_mesh_model_send(mod, &ctx, &buf, &bmns_vnd_model_cb, NULL);
}

Thank you, 

Shahin.

Parents
  • Hi,

    From what I can tell, it looks like the simple buffer cannot be safely extended past the originally configured length, which you seem to do by adding the null terminator (the '\0' byte) at the end. Does adjusting the length correspondingly (or adding one less byte with net_buf_simple_add_mem) solve the issue?

    Regards,
    Terje

Reply
  • Hi,

    From what I can tell, it looks like the simple buffer cannot be safely extended past the originally configured length, which you seem to do by adding the null terminator (the '\0' byte) at the end. Does adjusting the length correspondingly (or adding one less byte with net_buf_simple_add_mem) solve the issue?

    Regards,
    Terje

Children
Related