Issue using MQTT and CoAP simultaneously on nrf9151

Dear support team,

I'm using:

  • nrf9151
  • nRF Connect SDK v3.2.3

I'm currently working on a project where I need to use MQTT and CoAP simultaneously, it works for around 2-3 minutes and then the MQTT disconnects it's session giving this error:

<err> mqtt_helper: Socket error: POLLERR

<err> mqtt_helper: Connection was unexpectedly closed

<wrn> mqtt_module: MQTT disconnected: -113 

<wrn> mqtt_module: MQTT reconnect triggered 

<err> mqtt_helper: getaddrinfo() failed, error -10

I'm using the mqtt_helper lib provided by nordic that sits on top of the zephyr MQTT API. I tried a couple of methods like:

  1. Giving time intervals between sending the MQTT message and CoAP message( around 10 seconds delay between them).
  2. Also, tried to make the MQTT wait and not send unless RRC is connected.
  3. Then I tried to send 1 MQTT message then 20 CoAP messages then another 1 MQTT message. The first MQTT is sent and then the 20 CoAP messages but before sending the last MQTT message the broker disconnects again.
  4. Tried with disabling PSM and EDRX and tried with them enabled as well.

Is it a problem with the configurations or how can I use MQTT and CoAP together? and are there limitations to using them similtaniously?

Note: the MQTT and CoAP works just fine when I use only one of them on alone as soon as I use them together MQTT disconnects.

Best regards,

Mohamed Selim

Related