I am learning DSP and I am trying to simulate a simple phase difference calculator between two sinusoidal signals using GNU radio.
Other interesting points are:
- fft_width variable: Calculated by an expression - int(freq/20)
- freq variable: Controlled by a GUI range with steps of 1.2KHz. Min 1.2KHz, Max 9.6KHz
- The skip head and Keep M in N blocks - used together to extract only the FFT bin in interest. To do so the skip head calculates the first N blocks to be skipped via this expression: int((samp_rate/fft_width))+2 . Idea taken from this video: https://youtu.be/GJKbD--MsLM?t=326
This flowchart works when the samp_rate and freq are divisible - say samp_rate=10k and freq = 1k. However, for more of a real world scenario I have chosen variables that have lower ratio and are not divisible. In particular: samp_rate=11k and freq=1.2k. As a result of this the phase calculation fluctuates between 180 degree difference - for example 3.42 and 3.42-pi.
How do I make this flowchart work when the samp_rate and freq are not divisible? Furthermore how do I make it work for samp_rate of 11k, but different frequencies (chosen by the freq range GUI)?
What I tried:
Not much unfortunately, as I cannot find much information about this problem. That said, I read somewhere that clock synchronization via a PLL or Clock Recovery MM might help, but I do not know how to apply the relevant GNU radio blocks to this flowchart. Furthermore, if PLL is used would it not change the phase difference between the signals when trying to synchronize them?
Thank you for your time!
For the parameters I used:
loop bandwidth: pi/200 (documentation states it should be either that or 2*pi/100)
min_freq & max_freq: (2*pi*1.1e3)/samp_rate (documentation states it needs to be in radians per sample)
My goal was to try to make it work for 1.2k frequency, but unfortunately I still face the same problems. How can I fix it?