Part Number: OMAP-L138
Other Parts Discussed in Thread: OMAPL138,
Tool/software: TI-RTOS
I have a problem with SNTP. I have configured EMAC in C code using the CfgAddEntry function. This working good, because I using FTP and I don't have any problems.
My code:
#define SNTP_PORT 123
int32_t retVal;
uint32_t seconds;
uint32_t secondsFraction;
SlNetSock_Timeval_t timeval;
uint64_t ntpTimeStamp = 0;
SlNetSock_AddrIn_t ipv4addr;
ipv4addr.sin_family = SLNETSOCK_AF_INET;
ipv4addr.sin_port = SlNetUtil_htons(SNTP_PORT);
ipv4addr.sin_addr.s_addr = SlNetUtil_htonl(3639550724);
//ipv4addr.sin_addr.s_addr = inet_addr("216.239.35.4");//time.google.com
timeval.tv_sec = 5;
timeval.tv_usec = 0;
retVal = SNTP_getTimeByAddr((SlNetSock_Addr_t *)&ipv4addr, &timeval,
&ntpTimeStamp);
SNTP_getTimeByAddr function return (-102) -> SNTP_ESOCKCREATEFAIL (Failed to create a socket)I noticed that the problem is when function "Create a UDP socket to communicate with NTP server".
I added SlNetSock_init(0) before SNTP_getTimeByAddr() and now SNTP_getTimeByAddr return (-105) -> SNTP_ECONNECTFAIL (Failed to connect to the NTP server).Additionally I observed that SlNetSock_getVirtualSdConf() in SlNetSock_connect() return -2023L
Where is the problem?
I'm using:
-> pdk_omapl138_1_0_6
-> ndk_3_40_01_01
-> ns_2_40_01_02
Regards,
Patryk
