Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Sign in
G
GSI Timing Starter Kit
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • Wiki
    • Wiki
  • image/svg+xml
    Discourse
    • Discourse
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • Projects
  • GSI Timing Starter Kit
  • Wiki
  • Read the current time

Read the current time

Last edited by Cesar Prados Feb 04, 2013
Page history

Read the current time

The White Rabbit PTP Core includes a PPS generating device at address 0x20300. That device has these registers:

PACKED struct PPSG_WB {
  /* [0x0]: REG Control Register */
  uint32_t CR;
  /* [0x4]: REG Nanosecond counter register */
  uint32_t CNTR_NSEC;
  /* [0x8]: REG UTC Counter register (least-significant part) */
  uint32_t CNTR_UTCLO;
  /* [0xc]: REG UTC Counter register (most-significant part) */
  uint32_t CNTR_UTCHI;
  /* [0x10]: REG Nanosecond adjustment register */
  uint32_t ADJ_NSEC;
  /* [0x14]: REG UTC Adjustment register (least-significant part) */
  uint32_t ADJ_UTCLO;
  /* [0x18]: REG UTC Adjustment register (most-significant part) */
  uint32_t ADJ_UTCHI;
  /* [0x1c]: REG External sync control register */
  uint32_t ESCR;
};

The current time is found in CNTR_UTCHI, CNTR_UTCLO, and CNTR_NSEC. Be warned that CNTR_NSEC actually counts in 8ns units despite its name. The current time is thus CNTR_UTCHI*2^32 + CNTR_UTCLO seconds since 1970 and CNTR_NSEC*8 nanoseconds.

To access the device, you will need to know it's Etherbone address:

  • SCU accessed from the ComExpress board (read how to Setup-an-SCU-Bootstick), the address is dev/pcie_wb0.
  • SPEC accessed from a host system (read how to Configure-a-SPEC-host), the address is dev/spec_wb0.
  • VETAR accessed from a hot system TO BE DONE.

For a FEC accessed from the data master, you form the address as udp/IP where IP is the BOOTP address assigned when you Configure-a-Data-Master.

A shell script is available (see Building-from-Sources) to simplify reading the date:

terpstra@belapc060:~/gsi-timing-starter-kit$ ./scripts/get-time.sh udp/10.0.0.1
4927.219493104 = 1970-01-01 02:22:07.219493104
Clone repository
  • Building from sources
  • Capture timestamps
  • Configure a data master
  • Configure a spec host
  • Configure a vme host
  • Configure a vme system
  • Documents
  • Flash a xilinx device
  • Flash an altera device
  • Home
  • Io assignments
  • Prebuilt images
  • Read the current time
  • Documents
    • Project attachments
    • Syslinux.cfg
More Pages

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.