Run-time Configuraiton
All µC/SNTPc require a run-time configuration that must be passed during the initialization. SNTPc run-time configuration template files are provided. The run-time configuration template file (sntp-c_cfg.*
)
should be copied into application folder and modified following your requirements.
Micrium provides sample configuration code free of charge; however, most sample code will likely require modification depending on the combination feature requirements and memory limitation.
Structure Fields
µC/SNTPc run-time configuration is based on a structure that contains different configuration sections with many parameter settings. This section describes the run-time configuration settings, and should provide you an in-depth understanding of all parameters configuration. You will also discover which settings to modify in order to enhance the functionalities and the performances. Refer to the configuration field description section for further details.
SNTOc Run-time Configuration Structure
const SNTPc_CFG SNTPc_Cfg = { /* ----------------- NTP SERVER CFG ------------------ */ "0.pool.ntp.org", /* .ServerHostnamePtr */ SNTPc_DFLT_IPPORT, /* .ServerPortNbr */ NET_IP_ADDR_FAMILY_NONE, /* .ServerAddrFamily */ /* ------------------- TIMEOUT CFG ------------------- */ SNTPc_DFLT_MAX_RX_TIMEOUT_MS, /* .ReqRxTimeout_ms */ };
Server configuration
Structure Field | Type | Description | Possible Values |
---|---|---|---|
ServerHostnamePtr | CPU_CHAR | NTP Server hostname or IP address. | Pointer to a string that contains either the IP address or the host name to be resolved by DNS. |
ServerPortNbr | NET_PORT_NBR | NTP Server port number. | Any port number value. (Default NTP port is 123). |
ServerAddrFamily | NET_IP_ADDR_FAMILY | Select IP family of address when DNS resolution is used | NET_IP_ADDR_FAMILY_NONE |
Timeout Configuration
Structure Field | Type | Description | Possible Values |
---|---|---|---|
.ReqRxTimeout_ms | CPU_INT32U | Maximum timeout for packet reception after a SNTP request. | Any integer value |