# Ping not working on develop branch?

**URL:** <https://community.particle.io/t/ping-not-working-on-develop-branch/12662>\
**Category:** Firmware\
**Created:** [June 18, 2015, 2:04pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662 "2015-06-18T14:04:08Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![geert](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/geert/32/5145_2.png) [@geert](https://community.particle.io/u/geert)\
**Post date:** [June 18, 2015, 2:04pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/1 "2015-06-18T14:04:08Z")

</div>

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);
}
```

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [June 18, 2015, 2:07pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/2 "2015-06-18T14:07:04Z")

</div>

Just curious did `Serial.println("Connecting...");` print?

I remember there’s some weirdness going on with `WiFi.clearCredentials();` followed by `WiFi.setCredentials("SSID", "PW");` not returning correctly.

---

<div class="post-metadata">

**Author:** ![geert](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/geert/32/5145_2.png) [@geert](https://community.particle.io/u/geert)\
**Post date:** [June 18, 2015, 2:08pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/3 "2015-06-18T14:08:07Z")

</div>

yes… Core connected as normal and printed out Connecting… an after that connected… Just always return 0 on the count of pings…

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [June 18, 2015, 2:08pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/4 "2015-06-18T14:08:46Z")

</div>

Core? `develop` branch is not fully tested against the Core so it might not be working 😉

---

<div class="post-metadata">

**Author:** ![geert](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/geert/32/5145_2.png) [@geert](https://community.particle.io/u/geert)\
**Post date:** [June 18, 2015, 2:09pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/5 "2015-06-18T14:09:19Z")

</div>

Should I be using feature-hal then for core?

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [June 18, 2015, 2:11pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/6 "2015-06-18T14:11:02Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [June 18, 2015, 2:11pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/7 "2015-06-18T14:11:17Z")

</div>

I would recommend V0.3.4 in the release that corresponds to what you are using on the Web IDE for now

There might be but we need to test further 😉

---

<div class="post-metadata">

**Author:** ![geert](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/geert/32/5145_2.png) [@geert](https://community.particle.io/u/geert)\
**Post date:** [June 18, 2015, 2:18pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/8 "2015-06-18T14:18:29Z")

</div>

So even on the V0.3.4 branch this is gonna be an issue @peekay123?

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [June 18, 2015, 2:20pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/9 "2015-06-18T14:20:03Z")

</div>

Quick way to find out would be to use the Web IDE and compile the code to test 😉

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [June 18, 2015, 2:21pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/10 "2015-06-18T14:21:33Z")

</div>

@geert, yes the issue is still there since it is a CC3000 problem. Try the ping out trick to see if it works.

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [June 18, 2015, 2:23pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/11 "2015-06-18T14:23:13Z")

</div>

HI @geert

Can you try an experiment for me? Can you try reversing the order of bytes in the uint8\_t byte array?

```cpp
uint8_t sparkApi[] = {8, 130, 116, 62};

```

I think some code was removed when ping was ported to the HAL for the Core.

---

<div class="post-metadata">

**Author:** ![geert](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/geert/32/5145_2.png) [@geert](https://community.particle.io/u/geert)\
**Post date:** [June 18, 2015, 2:27pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/12 "2015-06-18T14:27:33Z")

</div>

@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…

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [June 18, 2015, 2:28pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/13 "2015-06-18T14:28:15Z")

</div>

I would do a CC3000 patch if things were working and it suddenly did not 😉

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [June 18, 2015, 2:30pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/14 "2015-06-18T14:30:49Z")

</div>

Hi @geert

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.

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [June 18, 2015, 2:33pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/15 "2015-06-18T14:33:46Z")

</div>

> [@geert](#):
>
> 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.

This makes @kennethlimcp advice to repatch the TI CC3000 an especially good idea!

---

<div class="post-metadata">

**Author:** ![geert](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/geert/32/5145_2.png) [@geert](https://community.particle.io/u/geert)\
**Post date:** [June 18, 2015, 2:57pm UTC](https://community.particle.io/t/ping-not-working-on-develop-branch/12662/16 "2015-06-18T14:57:10Z")

</div>

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!
