New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[next] Compare the 3 sync methods in ofdm-processor.cpp (freqsyncMethod) #247
Comments
@mpbraendli Please describe how to enable/disable the different methods. |
It is set through the last argument of the ofdmProcessor constructor: https://github.com/AlbrechtL/welle.io/blob/next/src/backend/radio-receiver.cpp#L54 Currently fixed to the value 3, it is used in https://github.com/AlbrechtL/welle.io/blob/next/src/backend/ofdm/ofdm-processor.cpp#L493 I'm not sure it is necessary to present this to the user, but it would be good to understand how these methods compare. |
All three methods behave badly in presence of two signal components (two peak in CIR), when the first peak is weaker than the second. The receiver locks onto the stronger one, but should lock on the earlier one instead. Locking on the second leads to increased inter-symbol interference and can kill reception. |
See #256 |
I've added the ability to chose the sync method in the settings page. The default seems to be the best option in general. @AlbrechtL do we close this ticket? |
Thanks for the GUI options. |
It would be nice to keep these settings permanent and store them. I wrote https://github.com/AlbrechtL/welle.io/wiki/Backend-Implementation-Remarks with some more details. |
Thanks for the docs. I can also make the settings permanent. |
Ok, I'll let you close the ticket as soon as you think it's ok to do so. |
The settings are permanent now (ce3f8c1). But I discovered an issue with the new frequency synchronization. After some time the receiver lost the lock - even with a good signal. At the moment I'm working with rtl-sdr dongles without an TCXO. In this case the frequency offset (> 4 kHz) is shifting permanently. |
So this is with coarse correction enabled but with the new FFT window placement? Is the old FFT window placement fine? |
I discovered the issues a little bit more in detail and I found 3 major problems. All test are applied with enabled coarse correction (PatternOfZeros), new FFT window and a rtl-sdr without a TCXO (3.5 kHz offset in warm state). First of all I let the synchronization succeed successfully so that a station is played. After some time the following issues occurred (sometimes).
I discovered some of these issues also in the old qt-dab and welle.io 1.0 implementation. Therefor I added a timer to check the sync status after some time and I resented the backend if somethings goes wrong. In the current next branch I removed this timer because it was just a workaround to get welle.io 1.0 working. |
The tricky part with these changes is that there is no right nor wrong thing to do, there is "relatively better" and "relatively worse", in average or on specific cases. I tried to put together some meaningful test metrics in
If you're able to make an IQ recording that exhibits bad behaviour (especially locking to an invalid state), that would be really good, because it would be easy to take it into the tests. I believe it is the backend's responsibility to get out of a locked state, and having a "restart" timer in the frontend feels like a hack. I'll think about a way to do this in the backend... |
That's a plan. I'm thinking about to add an IQ recording including some sort of ring buffer recording functionality. For example, the IQ samples of the last 5 minutes (5 min * 60 s * 4 MB = 1.2 GB) will be stored inside the RAM and if the user discovers an issue he or she just hit a button or key and the data will be saved into a file. The time span will be also flexible.
Great! That's also what I'm thinking. |
That would work. 5 minutes is already a long time, both for file sizes and for the duration of the tests. Keep in mind the recording format should depend on the device you're using, it's not always |
In 10a6bdd I added a simple RAW recorder. The very interesting discovery is, even if the backend lost the lock the recording is fine. So losing of the lock must be something else. I saw this only on slow CPUs where welle.io needs around 70 % of the CPU power. Can it be that IQ ring buffer overflows and then we are losing the time synchronization because of the lost data? On my Windows 10 testing machine with a Intel Z3736F CPU it can happen that Windows is doing updates or something else in the background and most likely the lock losing happens then. |
You mean the recorded file plays better than the live signal? |
Yes, but on a different CPU. |
Here is a test RAW file: https://transfer.sh/YN7yp/sample_sync_lost.iq |
So the recording was made with the new function in welle.io? The file has the same problem with qt-dab and qirx. Sync lost. |
Yes @mpbraendli Can you give a recommendation how to proceed with the sync lost / resync issue? |
I didn't follow the discussion so closely, but the hypothesis that the buffer between input and backend can lose samples and break sync sounds plausible. |
I added an overflow detection in e62e39c. First I would like to see if the overflow is the origin of the sync lost. |
@mpbraendli Do you know an alternative ring buffer implementation? I don't trust the current implementation. |
No I don't know one in particular. I also don't like the implementation because lockless designs are more difficult to prove to be correct. |
What do you think about https://github.com/dhess/c-ringbuf? |
Finally I caught the bug! A ring buffer overflow was not an issue. The issue was in line 364. If the first sync was successfully then welle.io/src/backend/ofdm-processor.cpp Lines 364 to 371 in ae2e668
In 7b1765f I changed As default I enabled the coarse frequency correction and the PRS correlation as algorithm in the GUI version. I think we can close this issue now. |
Good observation! I mostly run with disabled coarse corrector, and have not noticed this behaviour. (The pedantic guy inside me would argue that |
That's why I changed it into welle.io/src/backend/ofdm-processor.cpp Line 364 in 7b1765f
|
Reopened because there is still an instability inside coarse corrector. |
It seems that there is an instability inside coarse corrector. With all three coarse correctors there are drop outs (the drop out counts are different). IQ file: https://transfer.sh/S11OT/20181226_Paderborn_5C.7z (link valid until 10. Jan. 2019) @mpbraendli Do you have an idea whats going wrong? |
Interesting view! If you plot the CIR over time in the same way (as a waterfall), you will see more easily where sync gets lost. It will however be a view of the effect, not the causes. |
In 7e77191 I added the waterfall plot also for the CIR. What can be the cause? |
Great, that's a nice visualisation! Attention: x axis isn't in Hz, it's in samples (i.e. it's time, not frequency) In order to understand the cause it would be good to have IQ files which reliably trigger this behaviour. |
I replaced the new FFT placement algorithm in ccc87b5 that applies a window on the peaks and uses a threshold. (Active when Maybe that approach is better than the "find N peaks". (Active when @AlbrechtL do you still see the lock loss happening in your scenario? |
Thanks for looking into it.
Unfortunately this link is not valid anymore. I uploaded the IQ file again. |
I tested the three new options FFT window placement algorithm Used Settings
Which is the algorithm that you mentioned in ?
|
Before the change, I will try to understand the significance of the |
I have slightly improved ThresholdBeforePeak, because the lack of I used your Paderborn recording to test. It's interesting because it has a large enough frequency offset so that it requires the coarse offset. This makes it more complex because of the interplay between coarse offset corrector and PRS detection. |
I tried to verify this, but I get a Please try to create a link for it here. |
Please use this one. |
@mpbraendli With cheap rtl-sdrs without the TCXO you see such high frequency offsets. |
Any news here? |
From my point of view the sync issue is improved with commit 54f66c9. |
Good to hear it does improve the behaviour! Thanks |
There are 3 sync methods in ofdm-processor.cpp (freqsyncMethod). Compare!
The text was updated successfully, but these errors were encountered: