Re: Symbol timing estimator block and CPM modulations

2020-08-16 Thread Andy Walls
Hi Nick:

On Fri, 2020-07-31 at 17:21 -0700, Nick Foster wrote:
> Thanks for the feedback, Andy! I'm back at this now. I've filed a bug
> on it with my findings so far. Comments welcome.
> 
> https://github.com/gnuradio/gnuradio/issues/3678

I've added some comments, some plots, and an Octave script to the issue
on github.

TL;DR:

The original TED from the paper is correct, if computed when shifted by
a 1/4 symbol and the result negated. 

-Andy







Re: Symbol timing estimator block and CPM modulations

2020-07-31 Thread Nick Foster
Thanks for the feedback, Andy! I'm back at this now. I've filed a bug on it
with my findings so far. Comments welcome.

https://github.com/gnuradio/gnuradio/issues/3678

Nick

On Mon, Jun 29, 2020 at 1:06 PM Andy Walls 
wrote:

> Hi Nick:
>
> On Wed, 2020-06-24 at 17:39 -0700, Nick Foster wrote:
> > Hi,
> >
> > I'm finally getting around to doing some more CPM work
>
> I forgot to mention, my company found the GMSK demoulation technique
> found in this paper:
>
>
> https://www.researchgate.net/publication/241629765_Coherent_demodulation_of_AIS-GMSK_signals_in_co-channel_interference
>
> coupled with the "method 0" CFO correction in this paper:
>
>
> https://www.researchgate.net/publication/290776860_Preprocessing_AIS_Signals_for_Demodulation_in_Co-Channel_Interference
>
> along with analog RF components in front of an SDR, and precise timing
> with a GPSDO w/PPS to aid in looking for preambles, gave us fantastic
> results for AIS reception in GNURadio.
>
> Although it required quite a few custom blocks.
>
> Anyway, Douglas Nelson seems to have a lot of cool papers available in the
> public:
>
> https://www.researchgate.net/profile/Douglas_Nelson8
>
> Regards,
> Andy
>
> > Best,
> > Nick
>
>
>


Re: Symbol timing estimator block and CPM modulations

2020-06-29 Thread Andy Walls
Hi Nick:

On Wed, 2020-06-24 at 17:39 -0700, Nick Foster wrote:
> Hi,
> 
> I'm finally getting around to doing some more CPM work 

I forgot to mention, my company found the GMSK demoulation technique
found in this paper:

https://www.researchgate.net/publication/241629765_Coherent_demodulation_of_AIS-GMSK_signals_in_co-channel_interference

coupled with the "method 0" CFO correction in this paper:

https://www.researchgate.net/publication/290776860_Preprocessing_AIS_Signals_for_Demodulation_in_Co-Channel_Interference

along with analog RF components in front of an SDR, and precise timing
with a GPSDO w/PPS to aid in looking for preambles, gave us fantastic
results for AIS reception in GNURadio.

Although it required quite a few custom blocks.

Anyway, Douglas Nelson seems to have a lot of cool papers available in the 
public:

https://www.researchgate.net/profile/Douglas_Nelson8

Regards,
Andy

> Best,
> Nick





Re: Symbol timing estimator block and CPM modulations

2020-06-29 Thread Andy Walls
On Mon, 2020-06-29 at 14:11 -0500, Alex Roberts wrote:
> Copy that. Would a preamble with better properties like a gold code
> allow to raise that threshold? I guess I need to dig into what that
> threshold means. On the examples I’ve seen it’s always 0.9 or higher.
> 

You could use a Gold code.  Although the length 13 Barker code is
probably good too, just to play around with.
Yeah, so the fixed correlation threshold algorithm is somewhat staright
forward, but I caused to to have a bit of a wrinkle.
You'll notice in the algorithm, it checks using the square of the
correlation's magnitude.  That's because long ago, to save CPU cycles,
I coded the block to compute the magnitude squared of the correlation
and check against that.  Taking the square-root of every I^2+Q^2 sample
of the correlation output seemed like a waste of CPU to me at the
time.  I now regret that decision, as it has been a source of confusion
for people working with this block, oh well.
The block has undergone a few revisions regarding the thresh holding
algorithm, since I last touched it myself.  I know that the dynamic
algorithm only works with preambles with good correlation properties
(gold codes, barker codes).
The non-adaptive algorithm is sensitive to the incoming signal level
compared to the reference level of the correlation filter taps.  In
hindsight, I probably should have had my correlation filter taps script
normalize h_iq to some nominal gain value.
Anyway, I highly recommend you do test correlation runs in
Matlab/Octave first, duplicating the corr_est block's thresh hold
crossing detection algorithm, before jumping into a GNURadio
implementation.  The analysis in Matlab/Octave will much better inform
you on how your GNURadio parameters should be set.
Regards,Andy

> On Monday, June 29, 2020, Andy Walls 
> wrote:
> > On Sun, 2020-06-28 at 16:31 -0500, Alex Roberts wrote:
> > 
> > > Andy, 
> > 
> > > 
> > 
> > > I had a copy of an old flowgraph that you posted on the mailing
> > list
> > 
> > > a long while back (
> > 
> > > 
> > https://lists.gnu.org/archive/html/discuss-gnuradio/2016-03/msg00735.html
> > 
> > > ). This is what initially confused me on what to pass in as gmsk
> > 
> > > symbols to corr_est block as it has strictly real values.
> > 
> > > 
> > 
> > > I modified it to mux in the preamble that's in the octave code
> > with a
> > 
> > > random source. I also modified the octave code to match the
> > samples
> > 
> > > per symbol of the flowgraph (10) and generated the modulated
> > symbols
> > 
> > > for the corr_est block. The corr_est block does indeed
> > 
> > > perform conjugation and reversal of the symbols, so I used the
> > "h_iq"
> > 
> > > value from the octave code as the modulated symbols since it has
> > not
> > 
> > > been conjugated or reversed. I'm not getting corr_est tags. 
> > 
> > 
> > 
> > On that flowgraph, set your threshold on the corr_est block to
> > 0.23.
> > 
> > 
> > 
> > BTW, that preamble has horrible correlation properties.
> > 
> > 
> > 
> > 
> > 
> > > Thanks,Alex.
> > 
> > 
> > 
> > -Andy
> > 
> > 
> > 
> > 


Re: Symbol timing estimator block and CPM modulations

2020-06-29 Thread Alex Roberts
Copy that. Would a preamble with better properties like a gold code allow
to raise that threshold? I guess I need to dig into what that threshold
means. On the examples I’ve seen it’s always 0.9 or higher.

On Monday, June 29, 2020, Andy Walls  wrote:

> On Sun, 2020-06-28 at 16:31 -0500, Alex Roberts wrote:
> > Andy,
> >
> > I had a copy of an old flowgraph that you posted on the mailing list
> > a long while back (
> > https://lists.gnu.org/archive/html/discuss-gnuradio/2016-03/
> msg00735.html
> > ). This is what initially confused me on what to pass in as gmsk
> > symbols to corr_est block as it has strictly real values.
> >
> > I modified it to mux in the preamble that's in the octave code with a
> > random source. I also modified the octave code to match the samples
> > per symbol of the flowgraph (10) and generated the modulated symbols
> > for the corr_est block. The corr_est block does indeed
> > perform conjugation and reversal of the symbols, so I used the "h_iq"
> > value from the octave code as the modulated symbols since it has not
> > been conjugated or reversed. I'm not getting corr_est tags.
>
> On that flowgraph, set your threshold on the corr_est block to 0.23.
>
> BTW, that preamble has horrible correlation properties.
>
>
> > Thanks,Alex.
>
> -Andy
>
>


Re: Symbol timing estimator block and CPM modulations

2020-06-29 Thread Andy Walls
On Sun, 2020-06-28 at 16:31 -0500, Alex Roberts wrote:
> Andy, 
> 
> I had a copy of an old flowgraph that you posted on the mailing list
> a long while back (
> https://lists.gnu.org/archive/html/discuss-gnuradio/2016-03/msg00735.html
> ). This is what initially confused me on what to pass in as gmsk
> symbols to corr_est block as it has strictly real values.
> 
> I modified it to mux in the preamble that's in the octave code with a
> random source. I also modified the octave code to match the samples
> per symbol of the flowgraph (10) and generated the modulated symbols
> for the corr_est block. The corr_est block does indeed
> perform conjugation and reversal of the symbols, so I used the "h_iq"
> value from the octave code as the modulated symbols since it has not
> been conjugated or reversed. I'm not getting corr_est tags. 

On that flowgraph, set your threshold on the corr_est block to 0.23.

BTW, that preamble has horrible correlation properties.


> Thanks,Alex.

-Andy




Re: Symbol timing estimator block and CPM modulations

2020-06-28 Thread Alex Roberts
Andy,

Yes, I did mean the corr_est block. Thank you for the matlab code. I'll
hopefully get to play with it today. The flowgraph I have write now is
actually doing quite well with high AWGN just with switching to the
enhanced symbol block and using the Mengali and d'Andrea timing recovery.
For what it's worth, I'm stuck on GRC 3.7 so I had to check out from your
git from before you removed the symbol sync block (assuming it was removed
since it's been moved in-tree in 3.8)

Thanks,
Alex.

On Sun, Jun 28, 2020 at 7:32 AM Andy Walls 
wrote:

> Hi Alex:
>
> On Sat, 2020-06-27 at 19:42 -0500, Alex Roberts wrote:
> > Andy,
> >
> > I’m not sure how integrate the correlation sync block with gmsk.
>
> The correlate_and_sync block is an old block that was specific to RRC
> filtered PSK.  You must mean the corr_est block.
>
> >  It expects modulated symbols and I’m not sure how to generate a
> > modulated vector of gmsk symbols.  There doesn’t seem to be a gmsk
> > class that can be used by the modulate vector block.
>
> You can create a modulated GMSK preamble with the modulate vector block
> in GNURadio.  However, I do not recommend it.  It provides little
> insight or control over the exact correlation filter taps, so trimming
> off start and end transients becomes a hassle.
>
> Instead, generate your correlation filter taps in MatLab or Octave.
> Then you can also use Matlab or Octave to assess the performance of
> your correlation filter taps against real or simulated data.
>
> See the attached script for an example of generating GMSK correlation
> filter taps.  Note that this script generates the conjugated and time
> reversed filter taps.  You'll have to check what the corr_est block is
> expecting, as it may be performing a conjugation and time reversal for
> you, under the assumption that you didn't do it.
>
> Regards,
> Andy
>
>
> > Thanks,
> > Alex
> >
> > On Thursday, June 25, 2020, Andy Walls 
> > wrote:
> > > Recommend reading
> > >
> > >
> https://www.gnuradio.org/grcon/grcon17/presentations/symbol_clock_recovery_and_improved_symbol_synchronization_blocks/Andy-Walls-Samples-to-Digital-Symbols.pdf
> > >
> > > Yeah, the MSK TED selections for the symbol sync block expect the
> > > constant envelope FSK waveform on the input.  Demodulation from FSK
> > > to baseband pulses should happen after the symbol sync block.
> >
> >
>


Re: Symbol timing estimator block and CPM modulations

2020-06-28 Thread Andy Walls
Hi Alex:

On Sat, 2020-06-27 at 19:42 -0500, Alex Roberts wrote:
> Andy,
> 
> I’m not sure how integrate the correlation sync block with gmsk.

The correlate_and_sync block is an old block that was specific to RRC
filtered PSK.  You must mean the corr_est block.

>  It expects modulated symbols and I’m not sure how to generate a
> modulated vector of gmsk symbols.  There doesn’t seem to be a gmsk
> class that can be used by the modulate vector block.

You can create a modulated GMSK preamble with the modulate vector block
in GNURadio.  However, I do not recommend it.  It provides little
insight or control over the exact correlation filter taps, so trimming
off start and end transients becomes a hassle.

Instead, generate your correlation filter taps in MatLab or Octave. 
Then you can also use Matlab or Octave to assess the performance of
your correlation filter taps against real or simulated data.

See the attached script for an example of generating GMSK correlation
filter taps.  Note that this script generates the conjugated and time
reversed filter taps.  You'll have to check what the corr_est block is
expecting, as it may be performing a conjugation and time reversal for
you, under the assumption that you didn't do it.

Regards,
Andy


> Thanks,
> Alex 
> 
> On Thursday, June 25, 2020, Andy Walls 
> wrote:
> > Recommend reading
> >  
> > https://www.gnuradio.org/grcon/grcon17/presentations/symbol_clock_recovery_and_improved_symbol_synchronization_blocks/Andy-Walls-Samples-to-Digital-Symbols.pdf
> > 
> > Yeah, the MSK TED selections for the symbol sync block expect the
> > constant envelope FSK waveform on the input.  Demodulation from FSK
> > to baseband pulses should happen after the symbol sync block.
> 
> 
pkg load signal;  % Octave needs this

% One of the possible encodings of the AIS preamble symbols
h_bits = [-1,-1, 1, 1, ...
  -1,-1, 1, 1, ...
  -1,-1, 1, 1, ...
  -1,-1, 1, 1, ...
  -1,-1, 1, 1, ...
  -1,-1, 1, 1, ...
  -1,-1,-1,-1,-1,-1,-1, 1].';

% AIS specific GMSK parameters
Rb = 9600;
BT = 0.4;
L = 3;
modulation_index = 1/2;

% Working sample rate
sps = 5;
Fs = Rb * sps;

% Build Gaussian pulse filter
Ls = round(L*sps);
alpha = sqrt(2/log(2)) * pi * BT;
k = [(-Ls/2+1):1:(Ls/2-1)];
taps = (erf(alpha*(k/sps + 0.5)) - erf(alpha*(k/sps - 0.5)))*0.5/sps;
K = length(taps);
if (mod(K,2) == 0)
   delay = K/2;
else
   delay = (K-1)/2;
end

% Upsample and pulse shape the correlation sequence
x = sps*[upsample(h_bits,sps); zeros(delay, size(h_bits)(2))];
h_ibaseband = filter(taps, [1], x);
% Trim the pulse shaped correlation sequence
h_baseband = h_ibaseband((delay):(end-(sps-1)),:);

% modulate the correlation sequence
fm_gain = pi/(Fs/2) * Rb/2 * modulation_index;
x = h_baseband * fm_gain;
phase = cumsum(x); % phase is integral of frequency
h_iq = exp(1i*mod(phase, 2*pi));

% create the correlation filter
h = conj(h_iq(end:-1:1,:));

figure(1);
t1 = [1:size(h_ibaseband)(1)];
plot(t1, h_ibaseband(:,1), 'x-');
title('Premable Baseband Gaussian Pulses');

figure(2);
t2 = [1:size(h_baseband)(1)];
plot(t2, h_baseband(:,1), 'x-');
title('Trimmed Premable Baseband Gaussian Pulses');

figure(3);
t3 = [1:size(h)(1)];
plot(t3, real(h(:,1)), 'x-', t3, imag(h(:,1)), 'x-');
title('Correlation Filter Taps');
h(:,1)


Re: Symbol timing estimator block and CPM modulations

2020-06-28 Thread Mohamed Yaaseen
Hello Alex,

  Few months ago, I was also having some similar issues, with respect
to GFSK modulation. I was using a M TED and I was getting a loss
percentage of about 7% mainly due to having a large amount of tx packets
(100 pkts/s) . So, it was suggested to me to use a correlator sync block to
pre sync the packets, and then do timing recovery.
But, since I also couldn't find a M-fsk or MSK modulation class I start
doing some research and I found that the timing recovery block works
perfectly if there are no noise in the demodulated output, so I created my
own version of demodulator which outputs values only of signal is present,
and in case of noise I just output some negative value, say like -5. It
just a concept if signal power is above a threshold then it is actual tx if
not it is a noise

 I am not sure if this can solve your problem. Thought  just in case you
may find it useful. Cheers.!


Regards,
Mohamed Yaaseen


On Sun, 28 Jun 2020 at 02:43, Alex Roberts  wrote:

> Andy,
>
> I’m not sure how integrate the correlation sync block with gmsk. It
> expects modulated symbols and I’m not sure how to generate a modulated
> vector of gmsk symbols.  There doesn’t seem to be a gmsk class that can be
> used by the modulate vector block.
>
> Thanks,
> Alex
>
> On Thursday, June 25, 2020, Andy Walls 
> wrote:
>
>> Recommend reading
>>
>> https://www.gnuradio.org/grcon/grcon17/presentations/symbol_clock_recovery_and_improved_symbol_synchronization_blocks/Andy-Walls-Samples-to-Digital-Symbols.pdf
>>
>> Yeah, the MSK TED selections for the symbol sync block expect the
>> constant envelope FSK waveform on the input.  Demodulation from FSK to
>> baseband pulses should happen after the symbol sync block.
>>
>


Re: Symbol timing estimator block and CPM modulations

2020-06-27 Thread Alex Roberts
Andy,

I’m not sure how integrate the correlation sync block with gmsk. It expects
modulated symbols and I’m not sure how to generate a modulated vector of
gmsk symbols.  There doesn’t seem to be a gmsk class that can be used by
the modulate vector block.

Thanks,
Alex

On Thursday, June 25, 2020, Andy Walls  wrote:

> Recommend reading
>  https://www.gnuradio.org/grcon/grcon17/presentations/
> symbol_clock_recovery_and_improved_symbol_synchronization_blocks/Andy-
> Walls-Samples-to-Digital-Symbols.pdf
>
> Yeah, the MSK TED selections for the symbol sync block expect the constant
> envelope FSK waveform on the input.  Demodulation from FSK to baseband
> pulses should happen after the symbol sync block.
>


Re: Symbol timing estimator block and CPM modulations

2020-06-25 Thread Andy Walls
Recommend reading
 
https://www.gnuradio.org/grcon/grcon17/presentations/symbol_clock_recovery_and_improved_symbol_synchronization_blocks/Andy-Walls-Samples-to-Digital-Symbols.pdf

Yeah, the MSK TED selections for the symbol sync block expect the constant 
envelope FSK waveform on the input.  Demodulation from FSK to baseband pulses 
should happen after the symbol sync block.