Hello all, 

Adam Baron wrote " I'm just a user, but I believe the core locking has to be 
done on the port level.  I did put it there in my case. Then assertion of is 
core locked will tell you exactly what MQTT client functions need core to be 
locked."
Do you have examples of what you are doing. 
I had the following code in my mqtt_task 

void mqtt_task(__unused void *params) {    //bool on = false;
    //printf("mqtt_task starts\n");
    cyw43_arch_lwip_begin();
mqtt_subscribe(mqtt_client,"pico/cmds", 2,pub_mqtt_request_cb_t,PUB_EXTRA_ARG);
cyw43_arch_lwip_end();
    while (true) {
#if 0 && configNUM_CORES > 1
        static int last_core_id;
        if (portGET_CORE_ID() != last_core_id) {
            last_core_id = portGET_CORE_ID();
            //printf("mqtt now from core %d\n", last_core_id);
        }
#endif
        //cyw43_arch_gpio_put(0, on);
        //on = !on;
        //printf("in mqtt\n");
  strcpy(PUB_PAYLOAD_SCR,PUB_PAYLOAD);
  strcat( PUB_PAYLOAD_SCR,CYW43_HOST_NAME);
  payload_size = sizeof(PUB_PAYLOAD_SCR) + 7;
  //printf("%s  %d \n",PUB_PAYLOAD_SCR,sizeof(PUB_PAYLOAD_SCR));
  //sprintf(tmp,"mqtt_connect 0x%x ",check_mqtt_connected);
  //head = head_tail_helper(head, tail, endofbuf, topofbuf, tmp);
  cyw43_arch_lwip_begin();
  check_mqtt_connected = mqtt_client_is_connected(mqtt_client);
  cyw43_arch_lwip_end();
  //sprintf(tmp,"mq_con 0x%x ",check_mqtt_connected);
  //head = head_tail_helper(head, tail, endofbuf, topofbuf, tmp);
  if (check_mqtt_connected == 0) {
    //printf("in re-connect\n");
    mqtt_connected = 1;
    sprintf(tmp,"in re-connect forceing watcdof rebiit %d\n",mqtt_connected);
    head = head_tail_helper(head, tail, endofbuf, topofbuf, tmp);
    cyw43_arch_lwip_begin();
    mqtt_disconnect(mqtt_client);
    cyw43_arch_lwip_end();
   // mqtt_client_free(mqtt_client);
   watchdog_enable(100, 1);
  
    mqtt_example_init();
    sleep_ms(1000);
  }
      
  /*
  mqtt_client_is_connected 1 if connected to server, 0 otherwise 
  */
  cyw43_arch_lwip_begin();    
  
mqtt_publish(mqtt_client,"pico/status",PUB_PAYLOAD_SCR,payload_size,2,0,pub_mqtt_request_cb_t,PUB_EXTRA_ARG);
  cyw43_arch_lwip_end();    
        vTaskDelay(1000);
    }
}

These lines were used to reboot the pico_w when not broker was on line.
if (check_mqtt_connected == 0) {
    //printf("in re-connect\n");
    mqtt_connected = 1;
    sprintf(tmp,"in re-connect forceing watcdof rebiit %d\n",mqtt_connected);
    head = head_tail_helper(head, tail, endofbuf, topofbuf, tmp);
    cyw43_arch_lwip_begin();
    mqtt_disconnect(mqtt_client);
    cyw43_arch_lwip_end();
   // mqtt_client_free(mqtt_client);
   watchdog_enable(100, 1);
  
    mqtt_example_init();
    sleep_ms(1000);
  }

This no longer is working but the panic is not occurring. I need to determine 
what is the causing this new problem.

maybe I just need to move cyw43_arch_lwip_end();.
Also working on sending cmds in pico/cmds see initial results at the following 
site.  I am hoping to set the alarm and control the gpio. Also need to provide 
a the status of cmds. 
https://gist.github.com/956f93c24375c2a952ccb5e13cd8a003.gitThanks! 

Edward Vidal Jr. e-mail devel...@sbcglobal.net 915-595-1613
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to