Go Down

Topic: MKR1010 Wifi.ping() problems (Read 54 times) previous topic - next topic


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):

Code: [Select]
void loop()    // Ping test with Assigned local device IP eand google.com
int counter=0;
char GeoFence3[] = "";     // 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) {
  int result1 =WiFi.ping(GeoFence3);
  int result2 =WiFi.ping(GeoFence6);
    Serial.print(counter);Serial.print(". ");
    Serial.print(result1);Serial.print(", ");
    Serial.print(result2);Serial.println(", ");

This is the Serial-Print result :
Code: [Select]
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.  :)


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.

Go Up