Hi Marcus,
Thank you very much for your reply. I have few doubts. Please clarify:
In the link that you sent there are total 8 sma ports for A slot and B slot
LO Sharing with Neighbour TwinRXs
TwinRX (A Slot) TwinRX (B Slot)
J1 LO2 Export J2 LO2 Input
J2 LO2 Input J1 LO2 Export
J3 LO1 Export J4 LO1 Input
J4 LO1 Input J3 LO1 Export
But in USRP 2955R only 4 ports are exposed out, so the configuration what is
given in your link is totally different than what is available in the back side
of 2955 R. Do you mean to open up the box and then the 8 ports will be visible?
We are using following commands on the software side:
usrp->set_rx_lo_freq(frequncy+(sampleRate/2),"LO1",2);
std::cout<<usrp->get_rx_lo_freq("LO1",2);
usrp->set_rx_lo_source("internal",usrp->ALL_LOS,2);
usrp->set_rx_lo_export_enabled(true,usrp->ALL_LOS,2);
usrp->set_rx_lo_freq(usrp->get_rx_lo_freq("LO1",2),"LO1",3);
usrp->set_rx_lo_source("companion",usrp->ALL_LOS,3);
usrp->set_rx_lo_freq(usrp->get_rx_lo_freq("LO1",2),"LO1",0);
usrp->set_rx_lo_source("external",usrp->ALL_LOS,0);
usrp->set_rx_lo_freq(usrp->get_rx_lo_freq("LO1",2),"LO1",1);
usrp->set_rx_lo_source("external",usrp->ALL_LOS,1);
Also you mentioned using "set_time_unknown_pps()" command so is this command
along with the above commands enough in the software side or some more commands
are there for LO sharing? If so what are those?
Regards,
Koyel Das
Senior – Product Engineer
Vehere | Proactive Communications Intelligence & Cyber Defence
M: +919051132173 | T: +91 33 40545454 | F: +91 33 40545455 | W:
www.vehere.com<http://www.vehere.com/>
[unnamed]<https://www.linkedin.com/company/vehere-interactive-p-ltd> [unnamed
(1)] <https://twitter.com/VehereIndia> [unnamed (2)]
<https://www.facebook.com/VehereIndia/>
Vehere is the proud recipient of the Fastest Growing Technology Company Awards
in India & Asia since 2012!
The content of this e-mail is confidential and intended solely for the use of
the addressee. The text of this email (including any attachments) may contain
information, which is proprietary and/or confidential or privileged in nature
belonging to Vehere Interactive Pvt Ltd and/or its associates/ group companies/
subsidiaries. If you are not the addressee, or the person responsible for
delivering it to the addressee, any disclosure, copying, distribution or any
action taken or omitted to be taken in reliance on it is prohibited and may be
unlawful. If you have received this e-mail in error, please notify the sender
and remove this communication entirely from your system. The recipient
acknowledges that no guarantee or any warranty is given as to completeness and
accuracy of the content of the email. The recipient further acknowledges that
the views contained in the email message are those of the sender and may not
necessarily reflect those of Vehere Interactive Pvt Ltd. Before opening and
accessing the attachment please check and scan for virus. WARNING: Computer
viruses can be transmitted via email. The recipient should check this email and
any attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.
________________________________
From: USRP-users <[email protected]> on behalf of Marcus D.
Leech via USRP-users <[email protected]>
Sent: Tuesday, April 2, 2019 7:07 PM
To: [email protected]
Subject: Re: [USRP-users] not getting phase coherence between channels
On 04/02/2019 01:34 AM, Koyel Das (Vehere) via USRP-users wrote:
Hi,
I am using the given code for data receiving from two channels. I need to do LO
sharing for phase coherent application, which is done as shown in the code and
externally as shown in the image attached but I am not getting constant phase
difference.
We have connected one antenna to input of a power splitter and then connected
two output ports of the splitter to two ports of USRP. We are receiving signals
(say noise) from these two ports of USRP. We are dividing the whole chunk
(5*10^6 samples) of data into 5000 chunks each having 1000 continuous samples.
Then we are doing FFT of each of the chunk of 1000 samples and multiplying the
results from the two channels. Then averaging 1000 chunks of the multiplication
(cross-power) together so we are left with 5 averaged chunks each of 1000
samples of cross-power. The phase of the cross power is omega(td1-td2), where
omega is 2*pi*frequency and td1 is the time delay of channel1, td2:time delay
of channel2. so omega(td1-td2) is the phase difference. Since we are doing
averaging the noise effect should reduce to 0 and we should get phase
difference due to time delays due to internal circuitry. Now since frequencies
are in the range of 2.4*10^9 to 2.401*10^9 for 1 MHz bandwidth and td1-td2 is
also expected to be very small so omega(td1-td2) for this frequency range would
be almost identical, which is not happening.
In short I am not getting constant phase difference. I have also made
connections as shown in the attached figure. What is missing in the code below:
See:
https://kb.ettus.com/TwinRX_Getting_Started_Guides#LO_Sharing_with_Neighbour_TwinRXs
----------------------------------------------------------------------------------------------------------------------------------------
#include "vdds_device.h"
#include "vdds_util.h"
#include "vdds_device_interface.h"
#include <uhd/utils/safe_main.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <iostream>
#include <fstream>
#include <complex>
#include <thread>
#include <chrono>
#include <QFile>
#include <vector>
#include <string>
VDDSDevice::VDDSDevice()
{
deviceIPAddress="addr0=192.168.10.2";
gain=70;
sampleRate=1e6;
bandwidth=1e6;
buffer=NULL;
frequncy=2422e6;
numberOfChannel=0;
wrapped=false;
}
void VDDSDevice::init()
{
usrp = uhd::usrp::multi_usrp::make(deviceIPAddress.toStdString());
uhd::usrp::subdev_spec_t subdevClass = std::string("A:0 A:1 B:0 B:1");
usrp->set_rx_subdev_spec(subdevClass);
numberOfChannel=usrp->get_rx_num_channels();
std::cout<<"NUmber Of Channels : "<<numberOfChannel<<std::endl;
usrp->set_rx_rate(sampleRate);
//Doing changes (sharing LOs)
usrp->set_rx_lo_freq(frequncy+(sampleRate/2),"LO1",2);
std::cout<<usrp->get_rx_lo_freq("LO1",2);
usrp->set_rx_lo_source("internal",usrp->ALL_LOS,2);
usrp->set_rx_lo_export_enabled(true,usrp->ALL_LOS,2);
usrp->set_rx_lo_freq(usrp->get_rx_lo_freq("LO1",2),"LO1",3);
usrp->set_rx_lo_source("companion",usrp->ALL_LOS,3);
usrp->set_rx_lo_freq(usrp->get_rx_lo_freq("LO1",2),"LO1",0);
usrp->set_rx_lo_source("external",usrp->ALL_LOS,0);
usrp->set_rx_lo_freq(usrp->get_rx_lo_freq("LO1",2),"LO1",1);
usrp->set_rx_lo_source("external",usrp->ALL_LOS,1);
// Changes done */
for(size_t count=0;count<usrp->get_rx_num_channels();count++){
usrp->set_rx_gain(gain,count);
usrp->set_rx_bandwidth(bandwidth,count);
//usrp->set_rx_freq(frequncy,count);
std::cout<<"Antenna : "<<usrp->get_rx_antenna(count)<<" is for channel
: "<<count<<std::endl;
}
uhd::stream_args_t streamArgs("fc32");
for (size_t i = 0; i < usrp->get_rx_num_channels(); i++){
streamArgs.channels.push_back(i);
}
rxStream = usrp->get_rx_stream(streamArgs);
MAX_SAMPLE_PER_PACKET=rxStream->get_max_num_samps();
if(buffer==NULL){
for(size_t count=0;count<MAX_CHANNEL_SUPPORTS;count++){
channelBuffers[count]=new
std::complex<float>[(MAX_SAMPLE_REQUIRED_FOR_DD/MAX_SAMPLE_PER_PACKET)*MAX_SAMPLE_PER_PACKET+MAX_SAMPLE_PER_PACKET];
}
buffer=new
std::vector<std::complex<float>*>[(MAX_SAMPLE_REQUIRED_FOR_DD/MAX_SAMPLE_PER_PACKET)+1];
for(size_t
count=0;count<(MAX_SAMPLE_REQUIRED_FOR_DD/MAX_SAMPLE_PER_PACKET)+1;count++){
for(size_t channel=0;channel<MAX_CHANNEL_SUPPORTS;channel++){
buffer[count].push_back(channelBuffers[channel]+(count*MAX_SAMPLE_PER_PACKET));
}
}
}
uhd::stream_cmd_t
stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
stream_cmd.num_samps = MAX_SAMPLE_PER_PACKET;
stream_cmd.stream_now = true;
stream_cmd.time_spec = uhd::time_spec_t(0.0);
rxStream->issue_stream_cmd(stream_cmd);
}
void VDDSDevice::setFrequency(double frequncy){
for(size_t count=0;count<numberOfChannel;count++){
usrp->set_rx_freq(frequncy,count);
}
wrapped=false;
totalNumberOfSamplesRceived=0;
this->frequncy=frequncy;
}
void VDDSDevice::receiveBuffer(double frequncy,size_t
totalNumberOfSamplesRequired){
uhd::rx_metadata_t md;
totalNumberOfSamplesRceived=0;
double timeout = 0.1;
size_t sampleReceived = 0;
setFrequency(frequncy);
while(startFlag){
sampleReceived =
rxStream->recv(buffer[totalNumberOfSamplesRceived/MAX_SAMPLE_PER_PACKET],
MAX_SAMPLE_PER_PACKET, md, timeout,true);
if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){
std::cout<<"ERROR : "<<md.to_pp_string()<<"ERROR CODE :
"<<md.error_code<<" FOR DEVICE : "<<deviceIPAddress.toStdString()<<". Total
Sample Received : "<<totalNumberOfSamplesRceived<<std::endl;
}
if(sampleReceived!=MAX_SAMPLE_PER_PACKET){
std::cout<<MAX_SAMPLE_PER_PACKET<<" !=
"<<sampleReceived<<","<<std::endl;
}
if(VDDSDeviceInterface::startScanFlag){
totalNumberOfSamplesRceived+=sampleReceived;
if(totalNumberOfSamplesRceived>=totalNumberOfSamplesRequired){
totalNumberOfSamplesRceived=0;
std::cout<<"Wrapping"<<std::endl;
wrapped=true;
}
}
}
}
void VDDSDevice::run(){
startFlag=true;
init();
receiveBuffer(frequncy,MAX_SAMPLE_REQUIRED_FOR_DD);
}
void VDDSDevice::stop(){
startFlag=false;
}
void VDDSDevice::flushToFiles(const char *directory){
char fileName[256]={0};
unsigned long long int ts=VDDSUtil::getTimeInMicro();
size_t totalSamples;
std::complex<float> *channelBuffer=NULL;
for(size_t count=0;count<numberOfChannel;count++){
getChannelDataSamples(count,&channelBuffer,totalSamples);
if(totalSamples && channelBuffer){
sprintf(fileName,"%s/%llu_%u.cfile",directory,ts,(unsigned int)count);
QFile file(fileName);
if(file.open(QFile::WriteOnly|QFile::Truncate)){
file.write((char*)channelBuffer,MAX_SAMPLE_REQUIRED_FOR_DD*sizeof(std::complex<float>));
file.close();
}
}
}
}
std::complex<float> * VDDSDevice::getChannelDataSamples(size_t channel){
if(channel >= MAX_CHANNEL_SUPPORTS){
return NULL;
}
std::cout<<channel<<","<<std::endl;
return channelBuffers[channel];
}
void VDDSDevice::getChannelDataSamples(size_t channel,std::complex<float>
**samples,size_t &totalSamples){
totalSamples=MAX_SAMPLE_REQUIRED_FOR_DD;
if(MAX_SAMPLE_REQUIRED_FOR_DD==0 || channel >= MAX_CHANNEL_SUPPORTS){
*samples=NULL;
totalSamples=0;
return;
}
*samples=channelBuffers[channel];
}
--------------------------------------------------------------------------------------------------------------------------------------------------------Regards,
Koyel Das
Senior – Product Engineer
Vehere | Proactive Communications Intelligence & Cyber Defence
M: +919051132173 | T: +91 33 40545454 | F: +91 33 40545455 | W:
www.vehere.com<http://www.vehere.com/>
[unnamed]<https://www.linkedin.com/company/vehere-interactive-p-ltd> [unnamed
(1)] <https://twitter.com/VehereIndia> [unnamed (2)]
<https://www.facebook.com/VehereIndia/>
Vehere is the proud recipient of the Fastest Growing Technology Company Awards
in India & Asia since 2012!
The content of this e-mail is confidential and intended solely for the use of
the addressee. The text of this email (including any attachments) may contain
information, which is proprietary and/or confidential or privileged in nature
belonging to Vehere Interactive Pvt Ltd and/or its associates/ group companies/
subsidiaries. If you are not the addressee, or the person responsible for
delivering it to the addressee, any disclosure, copying, distribution or any
action taken or omitted to be taken in reliance on it is prohibited and may be
unlawful. If you have received this e-mail in error, please notify the sender
and remove this communication entirely from your system. The recipient
acknowledges that no guarantee or any warranty is given as to completeness and
accuracy of the content of the email. The recipient further acknowledges that
the views contained in the email message are those of the sender and may not
necessarily reflect those of Vehere Interactive Pvt Ltd. Before opening and
accessing the attachment please check and scan for virus. WARNING: Computer
viruses can be transmitted via email. The recipient should check this email and
any attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.
_______________________________________________
USRP-users mailing list
[email protected]<mailto:[email protected]>
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
USRP-users mailing list
[email protected]
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com