Error trying to connect to AWS IoT "the device does not recognize the command"

I have a project using MKR NB 1500 and Adafruit stemma soil sensor connecting to AWS to upload the sensor data. I had this working before just fine. I am developing in VS Code and PlatformIO. Yesterday I got a notification that there was an update available to VS Code, so I updated it. Then I made an inconsequential update to the code (minor change to one line of text to output to the serial monitor) and now when I run the sketch on the board I get the following error when trying to connect to AWS.

I can only assume that the update somehow caused this issue, but I'm a pretty novice programmer and don't know where to start with this error. Any help is appreciated!

I only changed
Serial.print("Attempting to MQTT broker: ");
Serial.print("Attempting to connect to MQTT broker: ");.

But just to be sure, I reverted back to the last know working version of the code from a few weeks ago and I still get the same error. After reverting I am sure that the only thing that’s changed is the update to VS Code.

The other thing that confuses me is that while the error seems to point to an issue with the serial connection, as you can see in the screenshot, it successfully writes several lines to the serial monitor before the error is thrown.

ok so I figured out the antenna became disconnected from the board. That's all it was. It's surprising that it was able to connect to the cellular provider without an antenna. I'm glad it was something so simple.

well, it seems I declared victory too soon. After connecting the antenna and battery it’s still happening, just taking a while. After seeing the error again I tried the Adafruit soil sensor example sketch, which just reads to soil sensor data and publishes the reading to the serial monitor. After a while, I get the same error with that sketch too. Any other ideas?

As another test I tried the following code:

#include <Arduino.h>

void setup() { Serial.begin(115200); }
void loop() { Serial.prinltn("Looping"); delay(5000); }

No issues with that code, it has been running for more than 20 hours now with no problem. In the instances in which I got the error, it was thrown anywhere from a couple to 30 min after it started running.

I realized that the version of the soil sensor example code I tested included some additional JSON code that I was using to test putting the sensor readings into JSON for sending to AWS. I'm wondering if how I'm doing the JSON is causing a memory leak. I'm going to make some modifications to the JSON in the soil sensor to ensure I'm properly allocating memory.

In the meantime I'm also running the soil sensor example with the JSON commented out to see if that runs error-free. If it does I'm guessing that's my problem.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.