I want to use the sntp client of my Connect ME.
I have this in my appconf.h:
#define APP_USE_NETWORK_TIME_PROTOCOL TRUE
Then I start SNTP:
NAstartSntp(SNTP_addr_1, SNTP_addr_2, 30, 1, SNTP_CallbackFunc);
where SNTP_addr_1/2 are IP adresses in the notation “192.168.0.1”.
This NAstartSntp() call returns 0 (NASNTP_SUCCESS).
But NAgetSntpAsciiTime() or NAgetSntpTime() return -12 (NASNTP_SERVER_TIMEOUT) and I can’t get any time information.
What’s going wrong here?
Not sure exactly what is happening with your code but I have got the SNTP system working correctly in my application with the attached code if that is of any help.
This expects to get some configuration data using functions starting with GBLCFG_ so you will need to either put constants in or generate these functions to get it to compile.
The basic code maintains a clock that can be set manually or can be synchronised by SNTP. Within the main program the standard ‘C’ library time functoins operate correctly.