Hello people,

I will try to keep it short. After more than one entire week of intense work on making the given examples for data logging and MQTT communication working without bugs, I am now facing - again btw - a severe problem, that makes the use of the XDK somehow almost impossible at the moment.
After making the examples for DL and MQTT seperately compilable, I have now joined the two solutions into one project. Now the Problem is:
"ERROR : region RAM overflowed with stack"

I would really like to have data logging and mqtt connection running on only one device, but as it seems, the RAM of the XDK is not sufficient. Any suggestions?

I am using Bosch XDK110 and XDK Workbench version 3.3.1

Thank you in advance!

0 (0 Votes)
RE: MQTT and Data Logging --> ERRORS AFTER ERRORS
Answer
4/12/18 11:27 AM as a reply to Chris.
Hello Chris,

given the error message ERROR : region RAM overflowed with stack , it is safe to assume that the memory did not suffice for the application in its current state.

The DataLoggerDemo was not built with the intention of merging it with another application (while of course, the possibility was always there). This is why the memory management had not been optimized.

But the first things I would recommend changing are the stack depths of the various tasks and command processors that are running in the background, and afterwards the size of the FreeRTOS heap as well.

The command processors do not need nearly as much memory as they are given. The App Command Processor and the ServalPAL Command Processor are given 700 and 600 words respectively. That's 20kB in total, and the Application Command Processor is not even used after initializing the applications, but the memory remains reserved.

If you reduce that as much as possible (ensuring that the XDK still runs), then you can also reduce the total FreeRTOS heap size, allowing the MCU's stack to use more memory. You can do this by going to SDK > xdk110 > Common > config > FreeRTOSConfig.h and modifying #define configTOTAL_HEAP_SIZE to suit your needs. Per default, it is set to use 61kB of the MCU's 128kB total RAM.

Of course, changing this is not neccessarily going to solve your issue once and for all, but it should definitely help.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Alex
0 (0 Votes)
RE: MQTT and Data Logging --> ERRORS AFTER ERRORS
Answer
5/8/18 12:29 PM as a reply to Alexander Sawtschuk.

Hello Alex!

Thank you very much for your reply! Unfortunately, I could not test your proposed solution so far, because I have switched to MQTT publishing only. Now I am about to inject the capabilities of logging the sensor data on the SD card in addition to the MQTT capabilities. Sometimes the WiFi connection gets lost and we want to have our data to remain consistent. So I will try to adjust the code in a manner that we can always update our data sets with logged data, in case of loss. But if I find some time (as always not much of it left), I will try to adjust the settings of the Free RTOS as you proposed.
Meanwhile the sensor is doing a great job, by the way! And it makes pretty much fun to code on it.

For now, again, thank you for your help!

0 (0 Votes)
RE: MQTT and Data Logging --> ERRORS AFTER ERRORS
Answer
5/8/18 3:20 PM as a reply to Chris.
Hello Chris,

I am always glad to help and I am glad to hear that you are having fun while programming the XDK.

Please feel free to ask if any questions are coming up again.

Kind regards,
Alex
0 (0 Votes)
RE: MQTT and Data Logging --> ERRORS AFTER ERRORS
Answer
8/8/18 2:50 PM as a reply to Alexander Sawtschuk.

I finally found the reason why the stack overflow occurs:

#define BUFFSIZE  19500
Now the whole program compiles without telling me, that the RAM overflows with the stack...
I will test further now...
0 (0 Votes)
RE: MQTT and Data Logging --> ERRORS AFTER ERRORS
Answer
8/8/18 3:12 PM as a reply to Alexander Sawtschuk.

I found a workaround. The error was caused by:

#define BUFFSIZE  19500

(in the main data logger file)

So you can decrease this number in order to compile the source.

0 (0 Votes)
RE: MQTT and Data Logging --> ERRORS AFTER ERRORS
Answer
8/8/18 3:30 PM as a reply to Chris.
Sorry for spamming the board, it told me, that an error occured, but it published the previously formulated message none the less...
0 (0 Votes)
RE: MQTT and Data Logging --> ERRORS AFTER ERRORS
Answer
8/8/18 5:39 PM as a reply to Chris.
Hello Chris,

The spamming is no issue, since the information will definitely assist other users.

In that regard thank you very much for this hint.

Kind regards,
Franjo
0 (0 Votes)