nRF9160, Upload data from AWS shadow subscribe (#XMQTTEVT: 1 -128)

We use nRF9160 on our own board.
The firmware "Serial lte modem" is installed on the chip with a connection to an external MCU (#define MQTT_MESSAGE_BUFFER_LEN 8192)
We need to receive from AWS Broker the JSON messages more significant than 2000 bytes.

We use an AWS Shadow subscription, which in turn requires a response from our side as confirmation of the data download.
The response is JSON.
If the outgoing JSON does not contain array objects with "[ ]" brackets, there is no problem with uploading data.
BUT,
If the outgoing JSON contains an array object/s with "[ ]" brackets, then after the first unload of such JSON, we start to have problems.
Any further attempts to download data from the subscription are unsuccessful, we always get a response:

#XMQTTEVT: 1 -128
Further data loading is not possible. The nRF module completely stops responding to AT commands.

We have a record of data transmission over UART ("Logic" program), for assembling cases of success and failure.

We could reproduce the same problem on the board nRF9160-DK board.

Command sequence:

AT%XSYSTEMMODE=1,0,1,0

AT+CEREG=5

AT+CFUN=1

AT#XMQTTCON=1,"996314","","","a34k7wa09ujucc-ats.iot.us-east-1.amazonaws.com",8883,321

AT#XMQTTSUB="$aws/things/996314/shadow/get/accepted",1

AT#XMQTTPUB="$aws/things/996314/shadow/get","",1
{"a":"a"}\r\n+++

Result:

OK
[00:00:15.194,030] <dbg> slm_at_host: RX
                                      41 54                                            |AT               
[00:00:15.200,592] <dbg> slm_at_host: TX
                                      0d 0a                                            |..               
[00:00:15.200,622] <dbg> slm_at_host: TX
                                      4f 4b 0d 0a                                      |OK..             

OK
[00:00:21.721,252] <dbg> slm_at_host: RX
                                      41 54 25 58 53 59 53 54  45 4d 4d 4f 44 45 3d 31 |AT%XSYST EMMODE=1
                                      2c 30 2c 31 2c 30                                |,0,1,0           
[00:00:21.721,771] <dbg> slm_at_host.uart_callback: RX_DISABLED
[00:00:21.729,400] <dbg> slm_at_host: TX
                                      0d 0a                                            |..               
[00:00:21.729,431] <dbg> slm_at_host: TX
                                      4f 4b 0d 0a                                      |OK..             

OK
[00:00:29.792,724] <dbg> slm_at_host: RX
                                      41 54 2b 43 45 52 45 47  3d 35                   |AT+CEREG =5      
[00:00:29.793,243] <dbg> slm_at_host.uart_callback: RX_DISABLED
[00:00:29.801,727] <dbg> slm_at_host: TX
                                      0d 0a                                            |..               
[00:00:29.801,757] <dbg> slm_at_host: TX
                                      4f 4b 0d 0a                                     |OK..             

OK
[00:00:37.656,066] <dbg> slm_at_host: RX
                                      41 54 2b 43 46 55 4e 3d  31                      |AT+CFUN= 
+CEREG: 2,"1D6B","001B6A02",7
1       
[00:00:37.656,585] <dbg> slm_at_host.uart_callback: RX_DISABLED
[00:00:37.697,631] <dbg> slm_at_host: TX
  st                                  0d 0a                                            |..               
[00:00:37.697,662] <dbg> slm_at_host: TX
                                      4f 4b 0d 0a                                      |OK..             
[00:00:38.669,982] <dbg> slm_at_host: TX
                                      0d 0a                                            |..               
[00:00:38.670,043] <dbg> slm_at_host: TX
                                      2b 43 45 52 45 47 3a 20  32 2c 22 31 44 36 42 22 |+CEREG:  2,"1D6B"
                                      2c 22 30 30 31 42 36 41  30 32 22 2c 37 0d 0a    |,"001B6A 02",7.. 

+CEREG: 5,"1D6B","001B6A02",7,,,"00011110","11100000"
[00:00:39.881,408] <dbg> slm_at_host: TX
                                      0d 0a                                            |..               
[00:00:39.881,469] <dbg> slm_at_host: TX
                                      2b 43 45 52 45 47 3a 20  35 2c 22 31 44 36 42 22 |+CEREG:  5,"1D6B"
                                      2c 22 30 30 31 42 36 41  30 32 22 2c 37 2c 2c 2c |,"001B6A 02",7,,,
                                      22 30 30 30 31 31 31 31  30 22 2c 22 31 31 31 30 |"0001111 0","1110
                                      30 30 30 30 22 0d 0a                             |0000"..          
[00:00:50.040,161] <dbg> slm_at_host: RX
                                      41 54 23 58 4d 51 54 54  43 4f 4e 3d 31 2c 22 39 |AT#XMQTT CON=1,"9
                                      39 36 33 31 34 22 2c 22  22 2c 22 22 2c 22 61 33 |96314"," ","","a3
                                      34 6b 37 77 61 30 39 75  6a 75 63 63 2d 61 74 73 |4k7wa09u jucc-ats
                                      2e 69 6f 74 2e 75 73 2d  65 61 73 74 2d 31 2e 61 |.iot.us- east-1.a
                                      6d 61 7a 6f 6e 61 77 73  2e 63 6f 6d 22 2c 38 38 |mazonaws .com",88
                                      38 33 2c 33 32 31                                |83,321           
[00:00:50.040,618] <dbg> slm_at_host.uart_callback: RX_DISABLED

OK

#XMQTTEVT: 0,0
[00:00:52.713,745] <dbg> slm_at_host: TX
                                      0d 0a 4f 4b 0d 0a                                |..OK..           
[00:00:53.009,368] <dbg> slm_at_host: TX
                                     0d 0a 23 58 4d 51 54 54  45 56 54 3a 20 30 2c 30 |..#XMQTT EVT: 0,0
                                      0d 0a                                            |..               

OK

#XMQTTEVT: 7,0
[00:01:01.125,518] <dbg> slm_at_host: RX
                                      41 54 23 58 4d 51 54 54  53 55 42 3d 22 24 61 77 |AT#XMQTT SUB="$aw
                                      73 2f 74 68 69 6e 67 73  2f 39 39 36 33 31 34 2f |s/things /996314/
                                      73 68 61 64 6f 77 2f 67  65 74 2f 61 63 63 65 70 |shadow/g et/accep
                                      74 65 64 22 2c 31                                |ted",1           
[00:01:01.126,007] <dbg> slm_at_host.uart_callback: RX_DISABLED
[00:01:01.128,845] <dbg> slm_at_host: TX
                                      0d 0a 4f 4b 0d 0a                                |..OK..           
[00:01:01.482,604] <dbg> slm_mqtt.mqtt_evt_handler: SUBACK packet id: 1
[00:01:01.482,696] <dbg> slm_at_host: TX
                                      0d 0a 2 058 4d 51 54 54  45 56 54 3a 20 37 2c 30 |..#XMQTT EVT: 7,0
                                      0d 0a                                            |..               
[00:01:13.534,118] <dbg> slm_at_host: RX
                                      41 54 23 58 4d 51 54 54  50 55 42 3d 22 24 61 77 |AT#XMQTT PUB="$aw
                                      73 2f 74 68 69 6e 67 73  2f 39 39 36 33 31 34 2f |s/things /996314/
                                      73 68 61 64 6f 77 2f 67  65 74 22 2c 22 22 2c 31 |shadow/g et","",1
[00:01:13.534,606] <dbg> slm_at_host.uart_callback: RX_DISABLED
[00:01:13.534,851] <inf> 
OK
slm_at_host: Enter datamode
[00:01:14.121,337] <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.121,459] <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.121,582] <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.121,704] <dbg> slm_at_host.uart_callback: RX_RDY 2
[00:01:14.121,826] <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.121,948] <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.122,070] <dbg> slm_at_host.uart_callback: RX_RDY 2
[00:01:14.122,192] <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.122,3131 <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.122,436] <dbg> slm_at_host.uart_callback: RX_RDY 1
[00:01:14.122,558] <dbg> slm_at_host.uart_callback: RX_RDY 2
[00:01:14.154,602] <inf> slm_at_host: time limit reached
[00:01:14.154,632] <inf> slm_at_host: Raw send 11
[00:01:14.154,663] <dbg> slm_at_host: RX-DATAMODE
                                      7b 22 61 22 3a 22 61 22  7d 0d 0a                |{"a":"a" }..     
[00:01:14.164,337] <inf> slm_mqtt: datamode send: 0
[00:01:14.164,337] <inf> slm_at_host: datamode off pending
[00:01:14.164,367] <dbg> slm_mqtt.mqtt_datamode_callback: MQTT datamode exit
[00:01:14.164,916] <dbg> slm_at_host.uart_callback: RX_DISABLED
[00:01:14.174,499] <dbg> slm_at_host: TX
                                      0d 0a 4f 4b 0d 0a                                |..OK..           
[00:01:14.174,530] <inf> slm_at_host: Exit datamode

#XMQTTEVT: 3,0

#XMQTTEVT: 1,-128
[00:01:14.468,353] <dbg> slm_mqtt.mqtt_evt_handler: PUBACK packet id: 1
[00:01:14.468,444] <dbg> slm_at_host: TX
                                      0d 0a 23 58 4d 51 54 54  45 56 54 3a 20 33 2c 30 |..#XMQTT EVT: 3,0
                                      0d 0a                                            |..               
[00:01:14.562,072] <dbg> slm_at_host: TX
                                      0d 0a 23 58 4d 51 54 54  45 56 54 3a 20 31 2c 2d |..#XMQTT EVT: 1,-
                                      31 32 38 0d 0a                                   |128..            
[00:01:14.562,103] <err> slm_mqtt: ERROR: mqtt_input -128
[00:01:14.562,133] <inf> slm_mqtt: MQTT thread terminated







Parents
  • I also see that there is no problem when I load JSON of the form:

    {
      "state": {
    	  "desired": {
    		  "userColor": 0,
    		  "debugMode": 1,
    		  "operMode": 2,
    		  "sosMode": 0,
    		  "algo": {
    			"petType": 0,
    			"collarSize": 0,
    			"age": 1,
    			"breed": 0,
    			"gender": 0,
    			"healthStatus": 0,
    			"medicalCondition": 0,
    			"weight": 1
    		  }
    		}
    	}
    }


    But as soon as a nested embedded array in JSON, the load immediately crashes:
    {
      "state": {
        "desired": {
          "userColor": 0,
          "debugMode": 1,
          "operMode": 2,
          "sosMode": 0,
          "algo": {
            "petType": 0,
            "collarSize": 0,
            "age": 1,
            "breed": 0,
            "gender": 0,
            "healthStatus": 0,
            "medicalCondition": 0,
            "weight": 1
          },
          "safeZone": [],
          "communicationChannels": [
            {
              "channel": "BLE",
              "state": 1,
              "timeout": 20000
            },
            {
              "channel": "WIFI",
              "state": 1,
              "timeout": 20000
            },
            {
              "channel": "CELLULAR",
              "state": 1,
              "timeout": 20000
            }
          ]
        }
      }
    }

Reply
  • I also see that there is no problem when I load JSON of the form:

    {
      "state": {
    	  "desired": {
    		  "userColor": 0,
    		  "debugMode": 1,
    		  "operMode": 2,
    		  "sosMode": 0,
    		  "algo": {
    			"petType": 0,
    			"collarSize": 0,
    			"age": 1,
    			"breed": 0,
    			"gender": 0,
    			"healthStatus": 0,
    			"medicalCondition": 0,
    			"weight": 1
    		  }
    		}
    	}
    }


    But as soon as a nested embedded array in JSON, the load immediately crashes:
    {
      "state": {
        "desired": {
          "userColor": 0,
          "debugMode": 1,
          "operMode": 2,
          "sosMode": 0,
          "algo": {
            "petType": 0,
            "collarSize": 0,
            "age": 1,
            "breed": 0,
            "gender": 0,
            "healthStatus": 0,
            "medicalCondition": 0,
            "weight": 1
          },
          "safeZone": [],
          "communicationChannels": [
            {
              "channel": "BLE",
              "state": 1,
              "timeout": 20000
            },
            {
              "channel": "WIFI",
              "state": 1,
              "timeout": 20000
            },
            {
              "channel": "CELLULAR",
              "state": 1,
              "timeout": 20000
            }
          ]
        }
      }
    }

Children
No Data
Related