====== How the Timing Bus works ====== {{tag>project hgg documentation hardware}} ====== Design Goals / General information ====== The goal of the timing bus is to provide cards put into the ground station with timing information and synchronize the ground stations. In the first implementation GPS is used for timing distribution. ====== Components of the timing bus ====== The timing bus contains three informations that are transmitted seperately. - PPS ... when a new second starts - SLOWCLOCK ... what the next second is and how long the last second lasted - FASTCLOCK ... how far the current second has gone. I guess you'll need some kind of explanation on this: ===== SLOWCLOCK - What the next second is ===== This sends a 72 bit long package containing - the number of clock ticks in the second before the current as an unsigned 32-bit integer. - the timestamp for the next second as a 40-bit integer Both numbers are being sent LSB. Tweak: If some module does not need the fasttime information becuase the developer feels that a 1 second resolution is good enough, it can recieve this packet into a 40-bit register. The timestamp of the next second will be sent as a unix timestamp (the number of seconds since UTC 1970/01/01 00:00:00 without leap seconds and not accounting for daylight savings time). This second will be valid after the PPS signal is activated. The number of clock ticks in the second before the current second is being sent to compensate for clock drift on the oscillator. ===== FASTCLOCK - how far the current second has gone ===== Every module needing fast timing needs to count the number of oscillator ticks. Every module needing accurate timing information needs to count the ticks in a local register. When the PPS Pin is activated the module can reset this register and begin counting again. When a module needs to measure the exact time (eg triggered by a measurement event), it should latch the current slowtime and fasttime information into a Parallel-in-serial-out Register to have that data available for further processing. Within a Ground-station the speed of the oscilator should be known and can assumed to be constant but clock drifts. ===== PPS - a new second begins ===== When the PPS is activated (Active Low), the previously sent slowtime becomes valid. The local counters for the fastclock should be resetted. ====== Measuring the Time with the Timing bus ====== This describes how it would be for a Fast-Timing Module, for a module needing only the slow time information, ignore everything about the fast time and read the Tweak from the SLOWCLK section. Prerequisites: * There is a +1 Counter with 32 bits that counts up on every clock tick of the FASTCLK. * The SLOWCLK Information is being put into a Register * When PPS comes, the counter is being reseted and restarts from 0. The SLOWCLK Information from the Bus is latched into a register CURTIME. When the event comes in, the following is happening: - Latch CURTIME + the current Value of the Counter into a Parallel-in-Serial-Out Register (makes 72+32 bit). - Process the event - Get the Information from the PISO - Send all information to the target over the What you get is a 40-bit timestamp of the current time and the number of clock ticks within the current second. With a known FASTCLK frequency you can easily calculate the fraction of a second and thus complete the timestamp to SECOND and FRACTION OF SECOND values. The maximum resoltution is dependent on the oscilator speed. Eg: 10Mhz FASTCLOCK makes 100ns resolution.