Help with precoding (SDR implementation)

Started by cogwsn 4 years ago14 replieslatest reply 4 years ago184 views

I am trying to implement a very basic pre-coder using SDR (USRP B210). 

Both Tx and Rx have single antenna and the transmit and receive SDRs are frequency synced through a common frequency source (Octoclock). Both Tx and Rx SDR are connect to the same PC. 

The channel is estimated at Rx and written to a file. This file is accessible to the Tx and used to precode the symbols before transmission. Here is the signal model. 

screenshot from 2020-06-07 02-21-13_3964

So while doing precoding at Tx, I precode X by multiplying it with negative of the angle of channel est and divide by the magnitude. This gives X hat which is further transmitted and at the receiver Y hat is obtained. 

screenshot from 2020-06-07 02-22-27_7720

But at the receive side, when I plot the constellation, it keeps rotating. Here is a video of the same.

However, when I do not do precoding and simply do equalization at the Rx as below, the rotation stops. 

screenshot from 2020-06-07 02-29-09_7677

I am not sure why it is happening. Is it because the delay in file write by the Rx and file read by the Tx. I mean the Rx writes some channel estimate and by the time Tx reads that and performs precoding, the channel has changed ? 

To verify this, I simply connected the Tx and Rx port with SMA cable so that the channel stays stable. But the constellation still rotates when I do precoding and stays stable when I perform equalization at Rx (precoding). 

However, in my simulation, when I do the precoding in the way I said above, it works perfectly because between file write and read, the channel stays the same. 

Any pointer what I am doing wrong ? 



[ - ]
Reply by SlartibartfastJune 11, 2020

If the channel has a phase component and is rotating the signal, you need to make sure that the predistortion (precoder, whatever), rotates it back in the other direction.   Typically you don't need to do this in a real system if the receiver phase locks, because it'll take care of it on its own, but if your test setup is phase-locked with the same oscillator this could be a reason.

[ - ]
Reply by cogwsnJune 11, 2020

By phase lock, do you mean the PPS signal ? Right now I am not giving PPS, only Freq reference. 

[ - ]
Reply by SlartibartfastJune 11, 2020

What PPS?   I've no idea what signalling you're trying to use other than one of the pics you posted appears to have a QAM constellation.   Usually a receiver phase-locks on the constellation.

If there are details that matter it's hard to help you if you omit them.

[ - ]
Reply by cogwsnJune 11, 2020

I am sorry. Here is a picture of the SDR I am using. 


I have two of them and I am providing only "REF IN" (frequency reference) to both of them through a common frequency source. The "PPS IN" (time reference) is not provided. 

Yes I am using 64QAM. 

The problem is that only receiver side equalization works pretty good. But the pre-distortion (precoding) does not work. 

When you say phase-lock, is that something related to the pilot symbols inserted in between the 802.11 OFDM symbols which keep track of the phase rotation.  



[ - ]
Reply by SlartibartfastJune 11, 2020

It sounds like what you're doing has a lot of unstated details, e.g., PPS, OFDM, etc., etc.   As such I can't really help you other than to say that carrier recovery or carrier phase lock is covered in most wireless comm texts.   If the constellation is rotated, the carrier recovery system corrects the phase error (and phase-locks it).  This is a deeper area of study than can be covered here.

[ - ]
Reply by Mannai_MuraliJune 11, 2020

In OFDM other than frequency offset and channel the sampling clock offset between DAC in the transmitter and ADC in the receiver can cause phase rotation.The phase rotation due to sampling clock offset deponds on tone index.(Higher tones will rotate more than lower ones).The delay between your estimate of combined channel in the receiver(Including sampling clock offset) could cause this rotation.You can give the same DAC and ADC clock or include time reference then if it vanishes then you can confirm it is due to sampling clock offset.

[ - ]
Reply by Mannai_MuraliJune 11, 2020

If it is not possible to use same DAC and ADC clock in transmitter and receiver(No time reference) and the hardware does not support you may do the following test.

In OFDM suppose the tones are indexed from -N/2 to +N/2.

Put any one valid contellation point in tone 0.All other tones (+ve or -ve) write 0.

Put in tone index 1 the same constellation point all other tones write data 0.

Put in tone index N the same constellation point all tones write 0.

If the phase rotation is due to sampling clock offset of DAC/ADC then

in test case 1 there will be no rotation.Test case 2 very slight rotation.Test case 3 maximum rotation.(I assume you do pre coding).

If this happens then it is due to sampling clock offset only.

[ - ]
Reply by cogwsnJune 11, 2020

Ok, I will do this. 

[ - ]
Reply by Mannai_MuraliJune 11, 2020

If PPS is the timing reference signal (DAC/ADC Sampling) and if you use it may stop rotation.While simulating you may not have introduced sampling clock offset and hence this may not have happened.If you want I can mail you few lines of matlab code which introduces linear interpolator to introduce sampling clock offset.This will rotate the receiver contellation even with precoding.I can also share two papers from Meyr for OFDM to understand how sampling clock offfset and frequency offset can rotate the constellation and how they can be estimated and tracked using pll implemented in frequency domain using pilots.I need your email.


[ - ]
Reply by sachinwannabeJune 11, 2020

Hi Sumit,

The rotation of the constellation looks like a classic phase shift. Since your frequency source is between TX and RX is the same (and hence in sync), it is unlikely that this phase rotation is due to lack of sync between TX and RX. 

Given that you are manipulating the phase/angle in the precoding process, it is likely that the delay between when the estimate is taken and the correction applied is larger than the time the angle estimate is stable. You can try out this by removing the angle correction in the precoder. So just divide by the magnitude but don't change the angle. With this change, if the constellation stays stable you can confirm that the rotation is due to the angle component of the correction.

[ - ]
Reply by kazJune 11, 2020

You haven't told us what is that mystery signal you are sending from Tx. Is it ofdm signal 64 QAM or is it FDM 64QAM? If it is ofdm is it proper ofdm frame/pss/sss/ etc or just spectrally correct ofdm? 

[ - ]
Reply by cogwsnJune 11, 2020

Hi, so it is a proper OFDM signal with preambles (gold sequence). I use preambles for frame sync and channel estimation. 

No matter what I am doing at the transmitter, unless I do some sort of equalization at the RX, the constellation rotates. 

My understanding is that when we pre-code at the TX, nothing should be done at the Rx. That's why we do pre-coding, isn't it ?   

It works perfect in simulation :-/ 

[ - ]
Reply by SlartibartfastJune 11, 2020

No, that's not why precoding is done, or, probably more correctly, predistortion.   Precoding often refers to coding related to space-time diversity or spatial multiplexing, but you already described that you're not doing any of that, so what you're trying might be more aptly described as predistortion.   Assuming I understand the few details you've diven.

I think you'd get further faster if you backed up and studied receiver synchronization (symbol timing and carrier phase), for single carrier systems until you understand it and then see how it's different for OFDM.

[ - ]
Reply by jbrowerJune 11, 2020


Did you work this out ?  It sounded like sachinwannabe had a good debug idea. Did you try that ?