Spare Core interfacing, sos codes

In using the Arduino example code of the API, I found that the example is not running well on the Spark Core.
Others mentioned the same thing here: reflashing the Core was needed.

I found that the example code was entering an endless loop when parsing the result after connecting. Details in the spark_plotly.cpp file.
I modified the example a little, resulting in a working example, at least in my Core.

Please enjoy:

But… in the example code, now and then I encounter the red flashing SOS code, with code 1 (hard fault).
Strawling through this community I found a few other messages mentioning this when using TCP client or server, altough the problems seem erratic and not very reproducable by others.
What I couldn’t find: is the SOS code related to a bad wireless connection, or to software problems in the TCP client or my plotly-example code? Is there any one that can shine a light on this?

BTW: what exactly does lead to a hard fault sos code? I read that a hard fault is generated when there is a Memory Management Fault, Bus Fault, or Usage Fault, if they are not captured through their own vector. But in the firmware, these 3 are covered as well… so when one of these three exceptions occur, it should give it’s own sos code (3,4, or 5). So what causes a hard fault then?