Keyboard Shortcuts
Likes
- N2adr-Sdr
- Messages
Search
Re: Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
I just found ?an interesting discussion about this subject in the documentation for the WDSP signal processing library that quisk uses.
The Github for it is at and I'm finding that the help file called WDSP_Guide.pdf ?(especially the "Variable Ratio Resampler" function on page 140) appears quite interesting. M |
||
Re: Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
开云体育
Thanks Jim,
This sounds very encouraging.? I only need receive, and the sample rate will be as close to 48 kHz as I can get it with the clocking on the Pico.? I am using a PCM1808, but the timing signals are coming from the Pico, so that is where my error is coming from.?
This thing is very like a softrock sdr receiver using the Si5351a (one clock for I and one for Q and one for TX on digital mode.? I will be using only the mono audio for WSJT-X receive, and the
?ideas for digital mode transmission.? I? Then I want to try and make the rig only connected with the computer via WIFI.? That is when I need to use the PCM1808 and the data you have so kindly provided.? One of my
goals with this is moving to micropython for the MCU code.? The class I teach is not emphasizing the software, and I find students catch on to micropython a lot more quickly and easier than they do to C++.? I looked at all the existing protocols I could find
and after all that I decided the simple IQ and control data I'm sending is probably best just to use my own custom protocol.? We will see how it goes.
73,
Rob
KL7NA
From: [email protected] <[email protected]> on behalf of jimahlstrom via groups.io <jahlstr@...>
Sent: Saturday, November 25, 2023 1:27 PM To: [email protected] <[email protected]> Subject: Re: [n2adr-sdr] Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc? ?
CAUTION: This email originated from outside the Walla Walla University email system.
Please take a look at function quisk_process_decimate() in quisk.c. Quisk can accept a variety of sample rates even if they are not multiples of 48 ksps. It decimates by an integer to a rate close to 48 ksps. The fractional rate correction happens after
demodulation when the audio is mono so there is no problem with images. This applies only to Rx.
I am not sure this helps. If you want I/Q data for a program like WSJT-X it won't work. But many digital programs can work with monophonic data. If you try to drift the frequency back and forth to average to 48.000 ksps, you will have frequency drifts in WSJT-X. I must point out that Pico is not a real audio codec. Jim N2ADR |
||
Re: Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
Please take a look at function quisk_process_decimate() in quisk.c. Quisk can accept a variety of sample rates even if they are not multiples of 48 ksps. It decimates by an integer to a rate close to 48 ksps. The fractional rate correction happens after demodulation when the audio is mono so there is no problem with images. This applies only to Rx.
I am not sure this helps. If you want I/Q data for a program like WSJT-X it won't work. But many digital programs can work with monophonic data. If you try to drift the frequency back and forth to average to 48.000 ksps, you will have frequency drifts in WSJT-X. I must point out that Pico is not a real audio codec. Jim N2ADR |
||
Re: Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
开云体育Rob
Have a look at something called a Costas loop. It should get you
to your goal. Of course you will have to integrate it into the
FPGA code. Every one up for the challenge? ? It's a PLL that locks onto the data carrier.
Regards,
Flash
On 11/24/23 12:00, Rob Frohne (KL7NA)
wrote:
|
||
Re: Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
Mario, check out my Teensy SDR transceiver project which uses the SGTL5000 (other codecs possible).? ?Maybe it helps fill in the radio UI/Control aspect you mentioned to keep your project moving forward.? I do still wrestle with sample rate vs USB audio rate mismatch.
The WIKI pages have more details. |
||
Re: Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
Hi all,
I think it's time for me to jump in again... I've been trying to deal with this problem for some time and am having some good luck in solving the problem for my own hardware design. Perhaps there may be some insights here for you in my incomplete solution... I use an SGTL5000 codec for the heart of my design and clock it from a spare channel of an si5351 clock oscillator. The si5351 generates quadrature clocks for the Tayloe style modulator and demodulator. The third channel is used to generate the nominal 12.288mhz clock for the SGTL5000. In addition, my hardware allows use of the same codec for the microphone/line input and for receiver speaker/line outputs. When I designed the hardware, past experience with the two clock problem led me to believe that one way to simplify things would be to keep everything synced to the same 48khz sample rate from a single clock. This design helps to achieve this. This requires some complicated T/R switching however to reconfigure the audio routing as needed for half-duplex operation to turn the input and output channels around to serve both IQ in -> speaker and mic in -> IQ out. It certainly practical to do this, but it REALLY complicates the changeover. Although I was able to design and build prototype software that takes advantage of this and works well, it turned out that in the real world writing transceiver software is a problem because of the thousands of tiny details it takes to make a useful and usable radio. I've had to abandon the hope of writing my own at this time. Projects like Quisk deal well with these details and Jim has done an outstanding job of juggling them to give a very polished result so I've decided to focus on interfacing my hardware with Quisk. This meant abandoning (for now) the idea of using the same codec for all 4 endpoints since most standard software assumes separate devices for IQ io and operator audio IO and is not easily modified to handle the needed multiplexing. I'm fine with that for now, especially since the trend is to embed digital IO directly in to the endpoint devices and most systems now have one interface device per endpoint - not to mention the complication from non hardware IO sources like CW oscillators and monitors and external digital programs like WSJT-X! Unfortunately, this makes the classic "Two Clock Problem" into a much more complicated "N clock" problem! It becomes a game of "Whack-a-Mole" that requires a lot of compromise and messy fixes for mode and TR switching. The present Quisk fixes this using simple "interpolate/drop" resampling, and it usually seems to do the job of keeping things from overflowing most of the time - at least for the classic 2 input/2 output situation. Interfacing to external program is another question, but I'm avoiding that problem for now as the situation has become fluid again now that "Pulse Audio" is now dead and has become yet another legacy API implemented by emulation in Linux. Anyway! back to the matter at hand: I've been testing a hacked in API to read the error correction variable "cr_correction" in the quisk output drivers (sound.c) from the python hardware API and then to use it to trim my codec clock frequency periodically to keep the buffer levels stable and hopefully minimize the need for the existing resampling method. I temporarily replaced one of the fields in the Config/status communication from the real time thread with the live "cr_correction" value. This allows it to be read (inefficiently) from the 10hz periodic method call in the hardware interface. I initially made no other modifications to the real time thread for these experiments. I then used code runninng about every 5 seconds to read that value and use it to implement a simple proportional feedback loop to adjust the si5351 channel that clocks the codec. Once it locks up, this keeps things to within 10-15hz and prevents the resampling logic from coming in to play completely. This works well enough to achieve my original goal of fixing the IQ output artifacts from the splice/drop resampler that were making the output spectrum of the modulator a real mess. It didn't help the receiver however, so I decided to experiment some more... I'm running a klugy scheme right now to keep separate codec clock values for transmit and receive and swap them as needed during T/R switching. The other channel reverts to "chop/splice" during this period, but it's not in use, so the problem is not audible. It works nicely, but it takes a long time to settle down - especially because each channel must now recover from an additional error transient during the changeover. I changed "sound.c" to update the correction value once per second instead of every 10 seconds and that helped a lot, but basically I think I need a much fancier software PLL design to do the correction and am working on that right now. My intention is to wait until I have a solution I'm happy with and then request that the distribution releases of quisk implement a simple API to allow this to be optionally done from the hardware.py file eliminating any need for recompilation. I believe all that will be needed will be a python API to allow reading the correction values.? I originally hoped that no method of changing the behavior of the existing resampler would be needed, but it's starting to look like it may at least require an option setting added to adjust the integration time for the error values to make this work. I think this would be useful to other HW designs as well. I'll continue to report as I learn more, but the project is proceeding slowly as there's a lot to mull over and I'm not as young as I used to be (!) Anyway, my advice to Rob is to try to work a finely programmable clock into to your codec design! It is very helpful to be able to trim the audio clock frequency without causing a major disruption as that will cause a phase glitch in the IQ signals. The si5351 does this well, but other methods may be possible... As far as the external quisk interprogram interfaces go, that's going to be a problem in any case as the new sound api in Rasbian is being revised weekly and the latest revisions appear to have broken quisk's pulse audio IO for wsjtx. It is now being shut down by pipewire after a few minutes of non-use. I'm waiting for that situation to stabilize before I worry about it... That's all for now - once again a million thanks to Jim for his hard work in getting us this far! M |
||
Re: Quisk Version 4.2.24 November 2023
And I do not understand why I found quisk v.4.2.23 installed in c:\users\my name\AppData\local\Programs... at the beginning of this attempt to repair and upgrade. I had always used the "pip install --upgrade quisk" command to upgrade it. Today when I reinstalled v.4.2.23 it went directly in c:\users\my name\AppData\local\packages.... as v.4.2.24 does also. |
||
Re: Quisk Version 4.2.24 November 2023
I uninstalled again v.4.2.24 and reinstalled 4.2.23, which complained when clicking quisk.exe that there were no quisk_hardware_hl2_oob.py file. I downloaded it from github, pasted it in \hermes and v.4.2.23 starts well as it has always done!
Then I uninstalled v4.2.23, reinstalled v.4.2.24 using "pip install quisk4.2.24", I took care to paste quisk_hardware_hl2_oob.py in \hermes and IT WORKS!? I do not understand what happened except maybe these parts of old versions of quisk remaining on my computer, the older dated about 10 years. Thanks Jim for your help and the time you lost due to my questions. I take this opportunity to answer you for all you do for us, the community of people who love their HL2 and realize amazing things with this marvel. 73 - Pierre - FK8IH |
||
Re: Quisk Version 4.2.24 November 2023
I found several directories related to quisk:
- 11/23/2023 in C:\users\JC\AppData\Local\Packages\PythonSoftwareFoundation.Python311.....\LocalCache\local-packages\Python311\site-packages\quisk with many files related to quisk including quisk.py but from which nothing starts. - 10/04/2023 in C:\users\JC\AppData\Local\Programs\Python\Python311\scripts from which directory quisk v4.2.23 actually starts. - and some older files. I'm cleaning all that and will return after. 73 - Pierre - FK8IH |
||
Re: Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
开云体育Hi Jim,
Thanks for the expertise!??
I think I can get to 1.017253 the correct frequency if I use the standard 125 MHz Pico frequency.? It is very easy to change though.? Of course, it cannot be changed to an arbitrary frequency, but changing it can help a lot.? By changing to 86 MHz, I can get 0.9998139 correct.? There are some other frequencies that are almost as good as 86 MHz that are faster.? It sounds like adjusting a few points every so often works better in your experience.? Is that right?
Thanks & 73,
Rob KL7NA From: [email protected] <[email protected]> on behalf of jimahlstrom via groups.io <jahlstr@...>
Sent: Friday, November 24, 2023 5:45 PM To: [email protected] <[email protected]> Subject: Re: [n2adr-sdr] Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc? ?
CAUTION: This email originated from outside the Walla Walla University email system.
I have never had success with resampling I/Q data. The balance is degraded and images appear. How close to a multiple of 48 ksps can you get?
Jim N2ADR |
||
Re: Quisk Version 4.2.24 November 2023
About python quisk.py :
- if I right click on it and left click on execute with python3.11 it opens quisk v. 4.2.23 - if I go the the good directory and types python quisk.py it aborts, see the attached photo. It's just amazing and I don't understand. 73 - Pierre - FK8IH |
||
Re: Quisk Version 4.2.24 November 2023
Hello Pierre,
>I checked in the Python311/Scripts directory and the quisk.exe file is still dated 10/04/2023. This file is not Quisk. It is a startup script that runs a program like "python quisk.py" to start the real quisk located elsewhere. Search for "quisk.py", the main program. It is possible you have two of quisk.py. I tested by installing Quisk on a Windows 10 machine and everything worked. So I am not sure what the problem is. Please start Windows Power Shell, navigate to the Quisk directory (the one with quisk.py) and try this: cat __init__.py There are two underscores "__". This should show the version as 4.2.24. python quisk.py This should start Quisk?with whatever version of Python you are using, and it should report version 4.2.24. Let me know what happens. Jim N2ADR |
||
Will I have a problem if my IQ data coming in is not in sync with 48000, 96000, etc?
开云体育
I'm looking at using a Raspberry Pi Pico W to collect ADC data and it appears that my clock will not be able to get an accurate 1228800 Hz clock.? I will be sending this data over UDP to quisk, and can know accurately what the sample rate is.? Will I need to
resample this at the proper rate in the PC, before sending it to quisk, or does quisk have that built in?
73,
Rob
KL7NA
|
||
Re: Quisk Version 4.2.24 November 2023
Jim, I checked my Python version and I have only 3.11 installed. I had some 3.9 and 3.10 directories remaining but they were not effective and I deleted them. 73 - Pierre - FK8IH |
||
Re: Quisk Version 4.2.24 November 2023
Not getting breakpoints to work in VS Code, I manually traced through the error path placing exit() at key points, mostly in the hermeslite.py file.? I ended up causing a new error about hardware config not found.? After several attempts to delete and reinstall (including force-reinstall per the linux install notes), I manually copied a new heremeslite.py file in and still no joy.? I then started up quisk v4.2.24 with -c argument pointing to quisk\hermes\quisk_hardware.py and that came up with old HL2 config but only used the sound interface.? I created a new hermes radio config and that worked.? Deleted the old config.? So 4.2.24 is now working.? ?Cannot say exactly what the problem was.
|