This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

mqtt simple + timer collision

Dear Sir.

We are using software based on mqtt simple project .

We added a 1 hz timer, Every 1 hz we toggle a led on and off.

Sometime the led is stuck on " on " or " off  which means to me that the timer is not 

working fine or the mqtt routine in the background stops it.

Any idea how to debug this problem.

Please Advise.

Parents
  • Hi Ephraim,

    My guess is that this is due to scheduling.

    Could you post the code and configuration you use for the timer?

    Regards,
    Sigurd Hellesvik

  • Hi.

    Another input.

    I have found the following is responsible for the timer's mismatch

    if((get_mqtt_conn_flag() == 1)) { // && (gtimer > 50)) {
    printk("Try to connect - 1, %d \n",gtimer);
    lte_lc_offline();
    set_mqtt_conn_flag(3);
    } else if (get_mqtt_conn_flag() == 2) {
    printk("Try to connect - 2, %d \n",gtimer);
    lte_lc_normal();
    battery_value = get_battery_value();
    set_latest_valid_battery_value(battery_value);
    set_mqtt_conn_flag(3);
    }

    It is either the lte_lc_offline(); or the lte_lc_normal(); 

    Please Advise

Reply
  • Hi.

    Another input.

    I have found the following is responsible for the timer's mismatch

    if((get_mqtt_conn_flag() == 1)) { // && (gtimer > 50)) {
    printk("Try to connect - 1, %d \n",gtimer);
    lte_lc_offline();
    set_mqtt_conn_flag(3);
    } else if (get_mqtt_conn_flag() == 2) {
    printk("Try to connect - 2, %d \n",gtimer);
    lte_lc_normal();
    battery_value = get_battery_value();
    set_latest_valid_battery_value(battery_value);
    set_mqtt_conn_flag(3);
    }

    It is either the lte_lc_offline(); or the lte_lc_normal(); 

    Please Advise

Children
Related