NTP time retrieval with reference to the sample rarely results in errors.
Error Displayed
ERROR:LTEUDP:337 sendoto() error:22
The source is simple:
timeClient.begin();
timeClient.update();
now=timeClient.getEpochTime();
tm_now = localtime(&now);
timeClient.end();
When this error occurs,
even if you run the above source to get the time again via NTP.
The same error occurs repeatedly, and NTP does not have time for a long time.
If there is no error, there is no problem to get the time normally.
It's hard to verify because it's less frequent
If you know how to deal with it, I would appreciate it if you could let me know.
spresense
When this error occurs,
even if you run the above source to get the time again via NTP.
The same error occurs repeatedly, and NTP never takes time.
In the event of an error, you may be able to obtain the correct time by reacquiring NTP as follows:(Once end
is invoked, begin
is invoked.)
timeClient.end();
timeClient.begin();
timeClient.update();
now=timeClient.getEpochTime();
tm_now = localtime(&now);
If you still can't get it, you might want to check the LTE connection status.
© 2024 OneMinuteCode. All rights reserved.