I was trying out the develop branch but I don’t seem to be able to get the ping working… Can someone validate that this is an issue? I used this as example code:
/* Includes ------------------------------------------------------------------*/
#include "application.h"
SYSTEM_MODE(SEMI_AUTOMATIC);
uint8_t sparkApi[] = {62, 116, 130, 8};
IPAddress sparkApiIP = sparkApi;
/* This function is called once at start up ----------------------------------*/
void setup()
{
// Initiate serial communication
Serial.begin(9600);
while(!Serial.available()) // Wait here until the user presses ENTER
Spark.process(); // in the Serial Terminal. Call the BG Tasks
WiFi.on();
WiFi.clearCredentials();
WiFi.setCredentials("SSID", "PW");
if (WiFi.hasCredentials()) {
Serial.println("Has credentials go into connecting mode...");
// Check for proper internet connection
WiFi.connect();
Serial.println("Connecting...");
// Keep waiting untill ip is assigned
while (WiFi.connecting() == true) {
Serial.println("Connecting...");
}
while (!WiFi.ready());
// Connect!
Spark.connect();
}
}
/* This function loops forever --------------------------------------------*/
void loop()
{
if (Spark.connected()) {
Serial.println("Connected...");
Serial.print("Pingcount: ");
Serial.println(WiFi.ping(sparkApiIP, 2));
}
delay(100);
}
@geert and @kennethlimcp, if I recall, ping is weird on the Core due to the CC3000. Doing a ping OUT of the Core first seems to set something in the CC3000 which will subsequently start responding to external pings. @kennethlimcp, can you confirm?
@kennethlimcp yes I know but the thing is I’ve been using the ping on the feature/hal branch without really experiencing issues until yesterday when we did a longer test with more cores. Also on the V0.3.4 branch it wasn’t an issue… I just was wondering what @peekay123 ment with “Ping is weid on the core”… If he ment that sometimes it does work and sometimes it doesn’t then I’m not gonna use it in my firmware of course and if so, or the weirdness was also on the V0.3.4 branch because like I said I had experienced issues before until we did a test with more cores…
The “weird” things about ping on the Core that I know of are:
It does not always work to ping another host on the first try. I believe this to be a TI CC3000 ARP issue. The second try always works in my experience.
The TI CC3000 does not always answer ping’s autonomously. This one is strange in that if the Core has started the Cloud connected, pings will not be answered, but if it has not started it, they will.
Pinging a remote host from a Core seems to clear up certain connection problems for UDP connections when the Cloud is not used. This again seems to be ARP problems inside the TI CC3000.
Unfortunately the cores are built in a casing and it’s rather hard to open up all the prototypes and patch the CC3000 every time the pinging feature stops working on the CC3000… So I’m just gonna figure out another way to do this. Maybe I can just try opening a tcp connection first if that succeeds I can safely call Spark.connect(). Thanks for the help guys!