Altera Home Page
Literature Licensing
Buy On-Line Download

  Home   |   Products   |   Support   |   End Markets   |   Technology Center   |   Education & Events   |   Corporate   |   Buy On-Line  
  Knowledge Database   |   Devices   |   Design Software   |   Intellectual Property   |   Design Examples   |   mySupport   |   Reference Designs  

 Products
      MAX/MAX II
      Stratix/Stratix GX
      Nios II
  
 Functionality
      Arithmetic
      Memory
      Bus & I/O
      Logic
      Interfaces & Peripherals
      DSP
      Communications
      PLL & Clocking
  
 Design Entry
      Quartus II Project
      Tcl
      VHDL
      Verilog HDL
      C Code Examples
      DSP Builder
      TimeQuest
   On-Chip Debugging
  
 Simulation Tools
      Mentor Graphics ModelSim
      Cadence NCsim
      Synopsys VCS
  
 Legacy Examples
      Graphic Editor
      AHDL
  

Network Time Protocol Client Design Example

The network time protocol (NTP) client design example demonstrates a user datagram protocol (UDP) client using the industry-standard sockets interface to transmission control protocol/Internet protocol (TCP/IP). This is a minimal implementation of a simple network time protocol (SNTP) client (RFC 2030). This design example serves as a good starting point for Lightweight IP (LWIP) designs running on Nios® II processors.

The design example displays the current UTC time on the LCD display. On startup, the LCD displays the epoch time. Once the current time is acquired, the system time is set, and the current time is displayed on the LCD. Periodically, the client sends another request to the NTP server for the current time.

Using This Design Example

Ensure that you have installed a Nios II development kit. Download the NTP Client design example and unzip the files into a directory under <Nios II kit path>/examples/software (for example, <Nios II kit path>/examples/software/ntp_client). If installed in this directory, the design example is available as a Nios II integrated development environment (IDE) project template. The NTP client design example includes the project settings required to run this design example on the supported target hardware configuration. To use the NTP client design example, simply create a new C/C++ application project in the IDE and choose the desired project template.

Hardware Requirements

The NTP client design example requires the following devices to be present in the target hardware design:

  • JTAG UART
  • Timer
  • LCD character display

You can run the NTP client design example on the following Nios II hardware design examples:

  • Stratix® design examples
    • Standard
    • Full-featured
  • Cyclone® design examples
    • Standard
    • Full-featured

Host Machine Requirements

The Nios II development board used to run this design must have access to an NTP server. The NTP server can be a server on a network, or it can be connected directly to a host machine running NTP server software via a crossover cable. The NTP server must be on the same subnet as the Nios II development board. If there is no NTP server on the network, or a direct connection is being made, there is a freeware version of an NTP software package located here: http://sourceforge.net/projects/nettime or http://www.ntp.org/links.html.

The NTP client attempts to use DHCP to acquire an IP address. If there is no DHCP server on the network or a direct connection is being used, then the static IP address, gateway,and subnetmask must be set in user.h and recompiled.


Feedback

Did this information help you?

If not, please log onto mySupport to file a technical request or enhancement.


These Web Site Design Examples may be used within Altera® Corporation devices only and remain the property of Altera. They are being provided on an "as-is" basis and as an accommodation, and therefore all warranties, representations, or guarantees of any kind (whether express, implied or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.

 
Nios II Literature

Nios II IDE Tutorial

  Please Give Us Feedback