MQTT_PAHO buffer-size, RAM
Answer
5/19/17 1:34 PM

Dear community,

I am using the demo project MQTT_PAHO as starting point for my own project. With some adaptions to my needs it works very well. Sensor data is read, written in buffer as json-like string and send.

Now data should be bundled to reduce the number of transmissions by the UM-server. Data is sensed with a frequency of 50 Hz. Every single message has a size of 330 Byte. At total I get a buffer-size of 198 KB for 12 seconds. That’s more than the RAM size of 128 KB.

Is there a way to store buffer in flash memory and send it, although total message size is larger than the RAM of XDK?

Thanks for your help.

0 (0 Votes)
RE: MQTT_PAHO buffer-size, RAM
Answer
5/23/17 4:20 PM as a reply to Jan-Oliver Kunert.

Hello Jan-Oliver,

Welcome to the XDK community.

You can indeed store data on the flash memory. There are three interfaces available (BCDS_FlashW25Q256FV.h, BCDS_FlashS25FL116K.h and BCDS_NVM.h) to store data on the flash memory. Unfortunately, there is no guide available about how to implement the functionality in detail yet. But I think, the descriptions in the header files should be sufficient enough to use them as a starting point.

Please note that if you use the interfaces BCDS_FlashW25Q256FV.h and BCDS_FlashS25FL116K.h, these have to be activated prior to placing a 1 in the respective define-statement in BCDS_MiscDriversConfig.h.

In addition, you can store the sensor data on the SD card as well. Unfortunately, there is also no guide for the SD card functionality either.

But you can use the Data Logger demo as a starting point to implement the functionality to write data to the SD card.

Regarding your questions about the capability of the RAM, it depends which transfer protocol you use to send the sensor data to your server.
MQTT is based on TCP, as such I assume it has a maximum package size of about 1460 byte. This is slightly more than 1 kB. This results in that the 192 kB payload of your message will be split anyway into multiple TCP requests.  Every package will have a maximal size of 1460 bytes and not extend the maximal RAM size of the XDK. Thus I would recommend to not worry about extending the RAM size of the XDK.

Nevertheless I assume it would be possible to implement a sending buffer manually on the flash.

Please tell me if this is helpful and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 Votes)