Azure IOT hub large Cloud 2 Device message

Hello,

At the moment I have a correctly working Azure IOT hub connection. 

DPS works, device twin configurations works and transmitting data to the hub is also no problem.

We can also receive cloud 2 device (C2D) messages from the IOT hub.

Now we want to transmit the assistance data for A-GNSS with C2D messages. 

(nrf9160 transmit cell data to the iot hub, the iot hub calls the nrf REST API and then the assistance data is transmits the data with c2d to the nrf9160)

This roundtrip works, but it fails on large messages (2200 bytes is the maximum, 2250 bytes will give an error).

How can we receive larger data message (4 kb) in our device?

With the normal configuration we received first an error with 2000 bytes messages:

[00:00:38.440,856] <err> mqtt_helper: Incoming MQTT message too large for payload buffer
[00:00:38.440,856] <err> mqtt_helper: publish_get_payload, error: -122
[00:00:38.440,887] <err> IoT: Unknown Azure IoT Hub event type: 19
[00:00:38.440,979] <err> mqtt_helper: Cloud MQTT input error: -16

We expanded the buffer sizes:

CONFIG_MQTT_HELPER_RX_TX_BUFFER_SIZE=4096
CONFIG_MQTT_HELPER_PAYLOAD_BUFFER_LEN=4096

Now we can receive message upto 2200 bytes.

When we transmit 2250 byte we get the following error:

[00:00:59.875,396] <err> mqtt_helper: Socket error: POLLERR poll res: 1
[00:00:59.875,396] <err> mqtt_helper: Connection was unexpectedly closed

This errors keeps going.

We have tried a lot configurations, but none of them are working:

The MTU size is 1280 bytes

The follow configurations have been enabled, but the error did not change:

# CONFIG_SIZE_OPTIMIZATIONS=y
# CONFIG_MQTT_HELPER_RX_TX_BUFFER_SIZE=4096  #also tried with 8092
# CONFIG_MQTT_HELPER_PAYLOAD_BUFFER_LEN=4096 #also tried with 8092
# CONFIG_NET_BUF_DATA_SIZE=4096 #also tried with 8092
# CONFIG_NET_BUF_RX_COUNT=4
# CONFIG_NET_BUF_TX_COUNT=4


# CONFIG_NET_IPV4_FRAGMENT=y
# CONFIG_NET_IPV4_FRAGMENT_TIMEOUT=20
# CONFIG_NET_IPV4_FRAGMENT_MAX_COUNT=4
# CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=4

# CONFIG_NET_IPV6_FRAGMENT=y
# CONFIG_NET_IPV6_FRAGMENT_TIMEOUT=20
# CONFIG_NET_IPV6_FRAGMENT_MAX_COUNT=4
# CONFIG_NET_IPV6_FRAGMENT_MAX_PKT=4

What configuration do we have to set so we can safely receive 4kb of data through a c2d message
The MQTT helper crashes in the function: 
mqtt_helper_poll_loop() //(line 681)
Calling the 
poll() function which results 1 and sets at fds[0].revents the POLLERR flag.

To be clear, we are now able to receive C2D upto 2200 bytes, but we need to receive upto 4000 bytes of data through the C2D message. 
This should be supported according to the Azure IOT Hub documentation.

Thank you in advance!

Parents Reply Children
Related