Best practices for uploading CAN data via MQTT on MC60

Hello Community,

I am working with Quectel’s MC60 interfaced with ARM micro-controller (uC), trying to upload CAN data to a MQTT broker coming continuously from another uC. I am using “” AT+QMTPUB=0,0,0,1,“Topic”, “” command to send data. As the size mentioned the command should accept the incoming CAN data till it matches the mentioned size and then upload that data automatically. But only first element of the CAN data set is uploaded and not the whole.
Flow of data:
uC --CAN–> uC (main) <–UART–> MC60

What is the best practice in a case as explained above in terms of programming in C or the GSM-MQTT AT command formats? What AT commands can I use to keep Publishing data continuously?

If you send charactors, you could ignore the parameter “size” and end with CRTL+Z(ASCII code is 0x1a). If you send binary data. You’d better to set the and no doulbe quotation included.

You flow should be good. If you still have issue, please send the UART logs to us.

Yes Sir, I have tried both the methods with incoming CAN data. But, somehow MQTT broker receives one element of the whole data when I mention a size in the publish command and that in case of Ctrl+Z broker receives a space or blank.
I think may be there is an issue with data type of the CAN data in ‘C’ program, I will check that and get back to you with UART logs.
Thank you.

Hello Sir,

I have checked the C program, the data array is received properly in the CAN and the UART RX buffers. Also, have checked on the MQTT broker side, seems everything is fine here too. But when this array is sent over the MQTT PUBLISH AT command only one of the element is uploaded.
Kindly, suggest on how can I rectify this problem or suggest possible methods that I can use to work on the solution part.

Following are samples of UART logs that I have used:

248 48 52 127 67 178 232 69

14 1 216 39 128 187 88 153

So, in each case as above only ‘248’ and ‘14’ respectively are sent to the broker.
Sir if possible please reply at your earliest.

1 Like

This issue is resolved. The problem was on the microcontroller side. Thank you WillieYao.

1 Like