I’m trying to manage the core’s WiFi and Cloud connections manually. I’m using SYSTEM_MODE(MANUAL) and able to successfully manage starting up and tearing down the WiFi connection. I can successfully send data to a remote server after the WiFi connection is up. I was trying to add support for enabling the Spark Cloud however I am running into some problems.
If I call Spark.connect() after I have an established WiFi connection it will connect to the cloud (breathing cyan) and pass the Spark.connected() test but my subsequent TCP Client connect call fails everytime. I try 10 times and it will pause for the first call and then immediately fail on the 9 subsequent calls. I have verified that I have an IP address and a valid DNS address
In troubleshooting this I tried to connect to the cloud in my setup routine, however in that case calling Spark.connect() from within the setup routine hangs the spark.
- Does anyone know why my TCP client connect calls fail after I have manually established the WiFi and Spark connections?
- Why does calling Spark.connect() from setup cause the core to hang?