Skip to content

Commit

Permalink
docs: Clarify docs around setting clock source and side-effects
Browse files Browse the repository at this point in the history
  • Loading branch information
mbr0wn authored and joergho committed Mar 19, 2024
1 parent b8375fb commit f6b0e4a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
17 changes: 15 additions & 2 deletions host/include/uhd/rfnoc/mb_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ class UHD_API mb_controller
virtual void set_ticks_now(const uint64_t ticks) = 0;

/*! Set the time at next PPS from a time spec
*
* \b Note: When changing clock sources, a previously set time will
* most likely be lost. It is recommended to set the time after
* changing the clock source. Otherwise, an unexpected time may line
* up with future PPS edges.
*
* This will convert \p time into a tick count value and use that to
* call set_ticks_next_pps().
Expand Down Expand Up @@ -348,15 +353,23 @@ class UHD_API mb_controller
*
* Example:
* ~~~{.cpp}
* auto usrp = uhd::usrp::multi_usrp::make("");
* usrp->set_sync_source(
* auto graph = uhd::rfnoc::rfnoc_graph::make("");
* graph->get_mb_controller(0)->set_sync_source(
* device_addr_t("clock_source=external,time_source=external"));
* ~~~
*
* This function does not force a re-initialization of the underlying
* hardware when the value does not change. See also set_time_source() and
* set_clock_source() for more details.
*
* \b Note: Reconfiguring the sync source may affect the clocking
* within the FPGAs of USRPs, and affect timekeeping as well as proper
* functioning of blocks that depend on these clocks. It is therefore
* strongly recommended to configure clock and time source before doing
* anything else. In particular, setting the device time should be done
* after calling this, and there should be no ongoing streaming operation
* while reconfiguring the sync source.
*
* \param sync_source A dictionary representing the various source settings.
* \throws uhd::value_error if the sources don't actually exist or if the
* combination of clock and time source is invalid.
Expand Down
30 changes: 28 additions & 2 deletions host/include/uhd/usrp/multi_usrp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,22 @@ class UHD_API multi_usrp : uhd::noncopyable
* after this call before making any calls that depend on the time to
* ensure that the time registers will be in a known state prior to use.
*
* Note: Because this call sets the time on the next PPS edge, the time
* \b Note: Because this call sets the time on the next PPS edge, the time
* spec supplied should correspond to the next pulse (i.e. current
* time + 1 second).
*
* Note: Make sure to not call this shortly before the next PPS edge. This
* \b Note: Make sure to not call this shortly before the next PPS edge. This
* should be called with plenty of time before the next PPS edge to ensure
* that all timekeepers on all devices will execute this command on the
* same PPS edge. If not, timekeepers could be unsynchronized in time by
* exactly one second. If in doubt, use set_time_unknown_pps() which will
* take care of this issue (but will also take longer to execute).
*
* \b Note: When changing clock sources, a previously set time will most
* likely be lost. It is recommended to set the time after changing the
* clock source. Otherwise, an unexpected time may line up with future PPS
* edges.
*
* \param time_spec the time to latch into the usrp device
* \param mboard the motherboard index 0 to M-1
*/
Expand All @@ -307,6 +312,11 @@ class UHD_API multi_usrp : uhd::noncopyable
* - Step1: wait for the last pps time to transition to catch the edge
* - Step2: set the time at the next pps (synchronous for all boards)
*
* \b Note: When changing clock sources, a previously set time will most
* likely be lost. It is recommended to set the time after changing the
* clock source. Otherwise, an unexpected time may line up with future PPS
* edges.
*
* \param time_spec the time to latch at the next pps after catching the edge
*/
virtual void set_time_unknown_pps(const time_spec_t& time_spec) = 0;
Expand Down Expand Up @@ -447,6 +457,14 @@ class UHD_API multi_usrp : uhd::noncopyable
* // The clock source is still guaranteed to be "internal" at this point
* ~~~
*
* \b Note: Reconfiguring the clock source will affect the clocking
* within the FPGAs of USRPs, and affect timekeeping as well as proper
* functioning of blocks that depend on these clocks. It is therefore
* strongly recommended to configure clock and time source before doing
* anything else. In particular, setting the device time should be done
* after calling this, and there should be no ongoing streaming operation
* while reconfiguring the clock/time source.
*
* See also:
* - set_time_source()
* - set_sync_source()
Expand Down Expand Up @@ -503,6 +521,14 @@ class UHD_API multi_usrp : uhd::noncopyable
* hardware when the value does not change. See also set_time_source() and
* set_clock_source() for more details.
*
* \b Note: Reconfiguring the sync source may affect the clocking
* within the FPGAs of USRPs, and affect timekeeping as well as proper
* functioning of blocks that depend on these clocks. It is therefore
* strongly recommended to configure clock and time source before doing
* anything else. In particular, setting the device time should be done
* after calling this, and there should be no ongoing streaming operation
* while reconfiguring the sync source.
*
* \param sync_source A dictionary representing the various source settings.
* \param mboard which motherboard to set the config
* \throws uhd::value_error if the sources don't actually exist or if the
Expand Down

0 comments on commit f6b0e4a

Please sign in to comment.