CC2340R5: Zephyr lpn node publish nodel issue

Part Number: CC2340R5

I designed lpn node using CC2340r5MODA. During provisioning I publish battery model to be transmitted periodically. After provisioning everything works correctly. Battery information is correctly periodically transmitted, but after cycling power model publish information is lost, probably never storded to flash or never extract back, but address to publish is rememberd.  Everything else is working correctly.

What do I need to do to to make it work correctly. Publish address for battery model is correct and rememberd duriong cycling power (it used to send other command messages from lpn node), but battery information never gets published after cycling power.

 

Thanks,

Michael Ostrovsky

  • Hi Michael,

    Could you provide some code snippets for how you setup the message to be periodically published?

    If this is only setup during the provisioning process, then it would make sense that the periodic publishing only happens right after provisioning the device because the device is not re-provisioned on power-cycle due to network data that is restored from flash. Maybe we can instead setup the periodic publishing within the bt_ready() function like the following so that the timer always starts?:

    static struct k_work_delayable battery_pub_work;
    
    static void battery_pub_handler(struct k_work *work) {
        ...
        k_work_reschedule(&battery_pub_work, BATTERY_PUB_INTERVAL);
    }
    
    static void start_battery_publication(void)
    {
    	k_work_reschedule(&battery_pub_work, K_SECONDS(2));
    }
    
    static void bt_ready(int err) {
        ...
        if (bt_mesh_is_provisioned()) {
            start_battery_publication();
        }
        ...
    }
    
    int main(void) {
        ...
        k_work_init_delayable(&battery_pub_work, battery_pub_handler);
        
        bt_enable(bt_ready);
        ...
    }

    Regards,

    Ging

  • Thanks, Ging. I had found the issue. I was defining  

    battery_pub.update = battery_status_update; in main during initialization. When I defined it in the model: 
    BT_MESH_MODEL(BT_MESH_MODEL_ID_GEN_BATTERY_SRV, battery_srv_op, &battery_pub, NULL) it was stored in the flash and worked. Unfortunatly it is very inconsistent information on the web, and very little for cc2340.