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

MQTT Publisher with TLS-PSK not working

Environment:

  • SDK v15.2.0
  • Raspberry Pi 3 (as a border router - Jessie).
  • MQTT broker in Linux PC (Mosquitto)
  • nRF52840 as a MQTT Publisher. 

Without TLS-PSK, MQTT publisher works fine. While using TLS-PSK, the broker disconnects from the MQTT publisher after sending CONNACK messages. I am facing this same issue.

Note: When seeing the prints from nRF in the serial port, I have seen CONNACK message with return value 0 after the broker sends disconnect message due to the timeout. I think the issue will be in tls_read functionality as it was not able to read the data in time. Can someone help to solve this issue?

  • Hi,

    Sorry for the delayed response. I have tried to replicate the problem here but I keep getting the MQTT_CONNECTION_FAILED error both with and without tls so I must have overlooked something. Have you had any progress on this in the meantime? 

  • Hi Vidar,

    Thanks for the response. Yes I have seen progress on the item and now I am able to see secure MQTT communication between my broker and publisher.

    Actually to made it work, I have increased the size of p_mqtt_data (Used to read the data from TLS interface) in mqtt_client_tls_read() function like below. (file: mqtt_transport_tls.c)

    uint8_t  * p_mqtt_data = nrf_malloc(1500);

    After this change, MQTT with TLS-PSK starts working.

  • Very glad to hear that you found the solution to this. Thanks for updating the thread. I will make sure to report this internally, so the documentation or code gets updated.

  • Great to hear that, Vidar.Slight smile