Ilya,
I had enabled a few of the debug messages. It looks like SNTP is running out of memory buffers. I cannot attach a Wireshark capture or TeraTerm capture. I've changed the NTP updates to 15 seconds. The failure starts showing up at NTP update 68 and it crashed completely at 70.
Here are the last few lines of the TeraTerm session, just before the crash:
sntp_send_request: Sending request to server
SNTP settime() #67 seconds=1262794411 TZ=-8.0 datetime=Wednesday 01/06/2010 16:13:31
sntp_process: Thu Jan 7 00:13:31 2010
sntp_recv: Scheduled next time request: 15000 ms
sntp_send_request: Sending request to server
SNTP settime() #68 seconds=1262794426 TZ=-8.0 datetime=Wednesday 01/06/2010 16:13:46
sntp_process: Thu Jan 7 00:13:46 2010
sntp_recv: Scheduled next time request: 15000 ms
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
sntp_send_request: Sending request to server
SNTP settime() #69 seconds=1262794441 TZ=-8.0 datetime=Wednesday 01/06/2010 16:14:01
sntp_process: Thu Jan 7 00:14:01 2010
sntp_recv: Scheduled next time request: 15000 ms
mem_malloc: could not allocate 700 bytes
sntp_send_request: Sending request to server
SNTP settime() #70 seconds=1262794456 TZ=-8.0 datetime=Wednesday 01/06/2010 16:14:16
sntp_process: Thu Jan 7 00:14:16 2010
sntp_recv: Scheduled next time request: 15000 ms
mem_malloc: could not allocate 700 bytes
sntp_send_request: Sending request to server
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
sntp_try_next_server: Sending request to server 2
sntp_request: Waiting for server address to be resolved.
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
mem_malloc: could not allocate 700 bytes
Here is what I turned on in lwipopts.h:
#ifndef HOSTNAME
#define HOSTNAME "mbed-c3p0"
#endif
#define LWIP_DEBUG 1 //*kb*
#define LWIP_DBG_TYPES_ON ~0x0 //*kb*
#define LWIP_DBG_MIN_LEVEL 0 //*kb*
#define MEM_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) //*kb*
#define TCP_INPUT_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) //*kb*
#define TCP_OUTPUT_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) //*kb*
#define NETIF_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) //*kb*
//#define DHCP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING)
//#define IP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING)
//#define TCP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING)
//#define TCP_CWND_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING)
//------------------------------------------------------------------------------
// [iva2k] Defines for LWIP/sntp, using SNTPClient wrapper
......
#define SNTP_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING) // *kb*
...kevin
Hello All,
I asked this question before in one of the HTTP threads, but I thought I'd make this a topic on its own. I think that this would be a useful tool for synchronizing the RTC in the LPC1768, but I am a rookie at this and have no knowledge on where to start.
Features would include:
1. direct RTC update from receiving the NTP time packet.
2. optionally support more than one NTP server.
3. the IP address of the NTP server(s) stored in a local file.
4. timeout error recovery should the NTP server(s) not be available. No RTC update should the NTP access fail.
5. allow for a UTC offset, also stored in the local file.
6. DST correction?
did I miss anything?
...kevin