MQTT publishing using a Sim800C

Hi all,

I hope someone could advise met. I’m interfacing with an SIM800C module using an STM32L MCU. My problem is this: I’m trying to publish data to cloudmqtt using the SIM800C. I’m constructing the entire MQTT packet in firmware and in essence it seems to be working. I ensure that the connect and publish packets are correctly constructed, but I cannot see data arriving on cloudmqtt. Here’s the catch…I fill the actual data array that I want to send with zeros (I add 0xAA and the beginning and end of the array, but the rest is zeros) and then everything seems to be working - I can see data arrive. As soon as I replace the zeros with actual values, the publising fails.

Note that I change NOTHING else, I only forge the actual data part that I want to send by replacing with zeros with actual values incremented from 1. All the other mqtt parameters (remaining lenght etc.) stays the same.

I thought it could be something to do with voltage levels or even the baud rate that is off between the two devices.

I thought I would take a chance here and that maybe someone had some experience.

Thanks in advance!

I have checked the test data array that I’m trying to send. At first the entire array of size 54 was padded with zeros. After this I have tried to add non zero values to determine at what time the communication error occurs.

It seems as if the problem occurs when I enter the values 26 or 27 at a location in my array. Coincidentally this is 0x1A or 0x1B. 0x1A is the send command for the Sim800 if I’m not mistaken.

How do I send data that contains the values 0x1A/0x1B?


Ok after some further investigation I found that the AT+CIPSEND= command can be sent where the length determines the amount of data. In doing this, the ESC (0x1B) and CNTRL+Z (0x1A) commands can actually be contained in the total data packet

Yes you are correct. You can use the length parameter in CIPSEND or otherwise you cant use those character as 0x1A is understood as packet end.
So, you got it working then :slight_smile: