MKR1010 Wifi.ping() problems

I have an application in mind that using MKR1010 on my local networks that acts once I arrive at home.
I though of a simple 'GeoFencing' mechanism by using the WiFi.ping() command.
I gave My Mobile Phone a fixed IP (basicaly 2 IP's , as I have 2.4 and 5G networks) and used the ping function to check if i'm home.
To my suprise the ping-function gets corrupted once you ping too many times a non-connected device or IP ! >:(

I tried 4 tests - see attachement, and every time I ping unconnected devices too many times (4 to 6 times), the ping-functions results in -1 for ANY IP or host you like to ping, and it nevers recover.

This is my Loop-code (Wifi setup is generic, wifi runs fine for days):

void loop()    // Ping test with Assigned local device IP eand google.com
{
int counter=0;
char GeoFence3[] = "192.168.200.19";     // assigned Ip adress by Router for my cellphone
char GeoFence6[] = "www.google.com";   // random global adress to Ping

  while (1) {
    if  (WiFi.status()==WL_CONNECTED) {
      counter++;
  int result1 =WiFi.ping(GeoFence3);
      delay(500);
  int result2 =WiFi.ping(GeoFence6);
    Serial.print(counter);Serial.print(". ");
    Serial.print(result1);Serial.print(", ");
    Serial.print(result2);Serial.println(", ");
    delay(500);
    }
  }

This is the Serial-Print result :

1. 140, 10,      ==> count 1. Local IP ping = 140, google.com ping is 10
2. 50, 10, 
3. 13, 10, 
4. 10, 20, 
      ..             ==> Keeps on running ,as long as target is connected :) GOOD !!!
27. 170, 20, 
28. -1, 10,      ==> Target / Cellphone is disconnected from Wifi, looks ok !
29. -1, 10, 
30. -1, 10, 
31. -1, 10, 
32. -1, -1,      ==> EVER ONGOING PING RESULT -1 for both IP's, never recovers  !!
33. -1, -1, 
34. -1, -1,

I verified many forum and the WifiNINA GitHub, nothing is known of this problem.
Can anyone test this? - I wonder if this is a local problem, of a Library issue. :slight_smile:

Mkr1010_PingProblem.txt (3.41 KB)

Hi. I can reproduce this issue when using the 1.2.1 version of the NINA firmware, but not when I use the new 1.2.2 version of the firmware. Please try updating the firmware on your MKR WiFi 1010 to see if that solves the issue for you. The new firmware wasn't available at the time of the Arduino IDE 1.8.9 release so the easiest way to get it is probably to use the hourly build of the Arduino IDE, which you can download here:

After extracting the downloaded file, run the hourly build of the Arduino IDE, and then follow this tutorial to update the firmware:

Make sure you have the "NINA firmware (1.2.2) (Arduino MKR WiFi 1010)" selected from the menu in the "2. Update Firmware" section of the Firmware Updater window before you click the "Update Firmware" button.

After that, you don't need to continue to use the hourly build of the Arduino IDE. The hourly build is intended primarily for beta testing.

Let me know whether that resolves the issue for you.

Hi Pert,
Good point, just updated the firmware. Meanwhile its 1.2.3.
Did the test again, and it passed.
Excellent!! this ping() function can now be used to build a simple GeoFence function around yourwifi area.

Remarkable feedback after the update :

WiFiNINA firmware check.
Firmware version installed: 1.2.3
Latest firmware version available : 1.2.1
Check result: PASSED

Seems my example-sketch was not up to date as well.
Any idea why there is no 1.2.3 post on this part of the forum - first post still shows 1.2.1

voske65:
3.
Did the test again, and it passed.

I'm glad to hear it!

voske65:
Any idea why there is no 1.2.3 post on this part of the forum - first post still shows 1.2.1

The hourly build of the Arduino IDE is primarily intended for beta testing. I would not generally encourage people to use the hourly build otherwise because it's not as thoroughly tested as the production releases. I suspect the posts about the previous releases of the firmware were prompted by the need to get those releases out there faster than the relatively slow release schedule of the Arduino IDE could provide. Perhaps the update from the 1.2.1 version of the firmware is not seen to be such a high priority and they are waiting on the next IDE release to push out the firmware update to the users.