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

asset tracker crashing on MQTT_EVT_PUBLISH

I am trying to parse the contents of a JSON packet sent from the nrfCloud connect application. The asset tracker program is working fine but I want to sent a message down to the board using the "send" button in the nrfcloud application. The message is seen at the board and I do get the MQTT_EVT_PUBLISH message. when I try to look at the contents of the message asset tracker crashes (reboot.). 

I am sending a very simple message.{"XXX":"YYY"} which is 13 characters. in the function aws_fota_mqtt_evt_handler at the case statement MQTT_EVT_PUBLISH. I have put some debug statements in oder to be able to see the contents of the message and parse it.

I am using the line shown below to display some of the parameters. this works fine so I can see the topic size and topic string without a problem. I can also see the payload length which is 13 and correct. BUT if I try to do anything with the payload data the system crashes.

a simple statement like printk("%02X\r\n",buff[0]); causes a crash. anytime I access any part of the data the system crashes. I am sure I am doing something stupid. I would appreciate any help you could give. I need to be able to send JSON packets down to the board and parse the message. This is a system requirement. I have parse messages before with other AWS applications so i must be doing something wrong.

printk("*** TOPIC: %d %d %s\r\n",p->message.payload.len,p->message.topic.topic.size,p->message.topic.topic.utf8);

Related