This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF9160 mqtt_publish stucked

Hello all, I have a little problem.

I`m trying to do an gateway communication using my NRF9160. The routine I`m trying to accomplish  is next :
  -- Send message over serial to nrf

  -- Recieved message send to mqtt broker ( and here is the problem ) 

After I call mqtt_publish nrf get`s stucked. As I managed to discover the problem is in : mqtt_transport_write().

To mention :

  • If I send an message from mqtt broker to nrf it responds and mqtt_publish works perfectly
  • I searched on forum and found this link that seems to be my problem as well : https://devzone.nordicsemi.com/f/nordic-q-a/49511/call-to-mqtt_publish-blocking
    • I tried nrf  v1.0.0 with nrfxlib  v1.0.0 and v1.0.0.rc4 with nrfxlib  v1.0.0.rc4 and it did not help  
  • My mqtt_send_message looks like this (don`t forget that it works if first I recieve an message from broker and nrf has to respond, it is not working if I call function by myself):
    •  
      void mqtt_send_message(char *send_data)
      {
          struct mqtt_publish_param param;
          param.message.topic.qos = MQTT_QOS_1_AT_LEAST_ONCE;
          param.message.topic.topic.utf8 = CONFIG_MQTT_PUB_TOPIC;
          param.message.topic.topic.size = strlen(CONFIG_MQTT_PUB_TOPIC);
          param.message.payload.data = send_data;
          param.message.payload.len = send_data[PAYLOAD_LENGTH_OFFSET] + PAYLOAD_OFFSET;
          param.message_id = sys_rand32_get();
          param.dup_flag = 0;
          param.retain_flag = 0;
      
          mqtt_publish(&client, &param);
      }
      

Thank you very much for your help.

Parents Reply Children
No Data
Related