Arduino Forum

Products => MKR Boards => MKR1000 => Topic started by: sGerli on Jul 20, 2016, 10:59 pm

Title: Wifi RTC not working
Post by: sGerli on Jul 20, 2016, 10:59 pm
I am working with this tutorial https://www.arduino.cc/en/Tutorial/WiFiRTC (https://www.arduino.cc/en/Tutorial/WiFiRTC) but when I upload it it gets stuck in this loop:
Code: [Select]
unsigned long epoch;
  int numberOfTries = 0, maxTries = 6;
  do {
    epoch = readLinuxEpochUsingNTP();
    numberOfTries++;
  }
  while ((epoch == 0) || (numberOfTries > maxTries));

  if (numberOfTries > maxTries) {
    Serial.print("NTP unreachable!!");
    while (1);
  }
  else {
    Serial.print("Epoch received: ");
    Serial.println(epoch);
    rtc.setEpoch(epoch);

    Serial.println();
  }

And it loops more than 6 times, it loops infinitely. And I am sure that it is connected to a Wifi network with internet access. Is there a problem with this tutorial?
Title: Re: Wifi RTC not working
Post by: ballscrewbob on Jul 21, 2016, 02:43 am
Compiles and runs fine here directly from the tutorial.

Did you change any of the code (apart from ssid and password) ?
Does it fail right away or after a while ?

If its after a while you are subject the a known MKR bug that seems linked to the serial output and as yet I have not found a cure despite a lot of testing.

The other thing maybe a firewall / port issue at your end either in house or at your ISP seeing as you seem to be hitting the max re-tries ?

Win 7 X64 here btw working with or without VPN connection

How did you isolate the specific section of code  as the issue ?
Title: Re: Wifi RTC not working
Post by: Leone_Euglena on Feb 10, 2018, 01:30 pm


probably found a solution to this problem at this topic:

https://forum.arduino.cc/index.php?topic=449906.0  (https://forum.arduino.cc/index.php?topic=449906.0)