How do I set the clock and time references of USRP to external reference or to MIMO cable for a secondary USRP?

29 views (last 30 days)
I am using the Communications Toolbox with USRP2 and USRP N210 SDRs to build a MIMO system. Specifically, I am building an Rx antenna array for indoor wireless positioning using directional of arrival concept and USRP2 or USRP210 devices (Daughter board XCVR2450). I perform parallel computing as follows:
matlabpool open 2
switch (labindex)
case 1
case 2
Now, I want to configure the clock and time reference of USRP to an external GPS source because all USRPs in the array should be synchronized. I want the USRP to get its references externally or, in the case of using two USRPs, from MIMO cable (one controller and one receiver).

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Sep 2023
Edited: MathWorks Support Team on 22 Sep 2023
After R2016a:
External Clock and PPS Source are available since R2016a. GPSDO support is available with USRP Hardware Support Package since R2021a.
Both External or GPSDO Clock Source and PPS source can be used with USRP by setting the "ClockSource" and "PPSSource" property of the "comm.SDRuReceiver" system object.
Before R2016a:
External clock reference for USRP radios and data stream synchronization via the MIMO cable is not directly supported in releases prior to R2016a. 
The following workaround may be useful to program both the Reference clock source and PPS clock source to be external. Please note that this is an undocumented workaround, which may not work starting in R2014b.
Please note that R2013a onwards, steps 1 and 5 are not required.
Edit the 'UsrpMaskMapiT.m' file. This file resides under the
'commusrp/usrp_uhd_mapi' directory in the USRP Support Package installation directory.
Edit line 55 to change 'setClockConfig' to 'setClockConfigFull'
Power up the USRP radio.
Connect the 10 MHz reference clock to the Reference Clock input (e.g. +7dBm sine wave).
Click the "Add SDRu" shortcut, which should be in the root MATLAB window after installing the USRP Support Package.
If you are not using Simulink blocks and are working from the MATLAB Command Window or writing a MATLAB script or function, you may skip steps 6 and 7.
Build or load the Simulink model with the USRP block.
Open the USRP block mask by double-clicking on the block. Then, close the mask.
At the MATLAB Command Window, please enter the following commands:
h = UsrpMaskMapiT('', BoardIdCapiEnumT.MboardId)
9) At this point, the E LED on USRP2 should light steadily, indicating that the USRP2 has locked to the reference clock. If it flickers or is not lit, check your reference. It may be off frequency or at an incorrect level.
Now, you can run your model, function, or script. If you disconnect or power down the USRP radio, you must repeat steps 7 and 8.
If you skip step 7, the E LED may light up, but you may not receive any data. If you would like to see the options or mix internal/external for ref/pps, modify step (8) to be:
h = UsrpMaskMapiT('', BoardIdCapiEnumT.MboardId)
c = ClockConfigCapiT
c.refSource = RefSourceCapiEnumT.External
c.ppsSource = PPSSourceCapiEnumT.External
c.ppsPolarity = PPSPolarityCapiEnumT.Positive
You should be able to change from external clocking to internal clocking by shutting down MATLAB and restarting it.

More Answers (1)

Karunya Choppara
Karunya Choppara on 19 Sep 2023
GPSDO support is available with USRP Hardware Support Package since R2021a.
Both External or GPSDO Clock Source and PPS source can be used with USRP by setting the ClockSource and PPSSource property of system object.


Find more on Communications Toolbox in Help Center and File Exchange


No tags entered yet.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!