Monday, April 29, 2024

Re: Transmitting a waveform, and recording input, at an adjustable rep rate

Interesting, thanks, I'll check that out. 

And no, I don't need precise timing control. 

If I do have to do this with Python I might copy the data counting example in the Python Block wiki and connect the message output to the Message To Variable block which could be used to set the state of the recording-Boolean used in the previously mentioned example design. 




On Mon, Apr 29, 2024, 3:13 PM Paul Atreides <maud.dib1984@gmail.com> wrote:
You might have luck modifying this tutorial. 
This gives you the ability to change parameters via a separate python script where simple logic may be easier to implement. Not precise timing, but simple. 

<end transmission>

On Apr 29, 2024, at 14:16, Jameson Collins <jameson.collins@gmail.com> wrote:


I'm trying to use GNU Radio to build a test/measurement rig.

At a user-defined interval I want to perform two actions:
 1) Transmit an FM sweep with user definable properties like frequency
 2) And record to a file for a fixed duration.

For the transmitter I was able to adapt the demo case for the lambda function found here: https://wiki.gnuradio.org/index.php/PDU_Lambda.  This seems to work great.

For the recording feature I started with  the example "Pushbutton IQ Recorder with descriptive filenames" (https://wiki.gnuradio.org/index.php?title=Pushbutton_IQ_Recorder_with_descriptive_filenames).  This works by creating a new file, and recording, whenever a user presses and holds a button.  That button sets a variable to true which enables the recording.

But, short of using custom python blocks, I can't figure out a way to trigger the recording at the same time I perform the transmit and I can't figure out a way to stop the recording automatically after a fixed amount of time / samples.

Re: Transmitting a waveform, and recording input, at an adjustable rep rate

You might have luck modifying this tutorial. 
This gives you the ability to change parameters via a separate python script where simple logic may be easier to implement. Not precise timing, but simple. 

<end transmission>

On Apr 29, 2024, at 14:16, Jameson Collins <jameson.collins@gmail.com> wrote:


I'm trying to use GNU Radio to build a test/measurement rig.

At a user-defined interval I want to perform two actions:
 1) Transmit an FM sweep with user definable properties like frequency
 2) And record to a file for a fixed duration.

For the transmitter I was able to adapt the demo case for the lambda function found here: https://wiki.gnuradio.org/index.php/PDU_Lambda.  This seems to work great.

For the recording feature I started with  the example "Pushbutton IQ Recorder with descriptive filenames" (https://wiki.gnuradio.org/index.php?title=Pushbutton_IQ_Recorder_with_descriptive_filenames).  This works by creating a new file, and recording, whenever a user presses and holds a button.  That button sets a variable to true which enables the recording.

But, short of using custom python blocks, I can't figure out a way to trigger the recording at the same time I perform the transmit and I can't figure out a way to stop the recording automatically after a fixed amount of time / samples.

Transmitting a waveform, and recording input, at an adjustable rep rate

I'm trying to use GNU Radio to build a test/measurement rig.

At a user-defined interval I want to perform two actions:
 1) Transmit an FM sweep with user definable properties like frequency
 2) And record to a file for a fixed duration.

For the transmitter I was able to adapt the demo case for the lambda function found here: https://wiki.gnuradio.org/index.php/PDU_Lambda.  This seems to work great.

For the recording feature I started with  the example "Pushbutton IQ Recorder with descriptive filenames" (https://wiki.gnuradio.org/index.php?title=Pushbutton_IQ_Recorder_with_descriptive_filenames).  This works by creating a new file, and recording, whenever a user presses and holds a button.  That button sets a variable to true which enables the recording.

But, short of using custom python blocks, I can't figure out a way to trigger the recording at the same time I perform the transmit and I can't figure out a way to stop the recording automatically after a fixed amount of time / samples.

Re: Debugging Existing C++ Blocks with VS Code & GDB

Thanks Walter

I realized that I had multiple gnuradio versions installed even though I thought I checked that. I completely wiped all my gnu radio files, pulled in the latest version 3.10.10.0 and built using the -DCMAKE_BUILD_TYPE=Debug, and now I can successfully debug the existing DTV code. The python code must have been importing a module from gnuradio in another directory, which caused it to not recognized any of my edits or breakpoints in the file I was working on.

Matt

On Tue, Apr 23, 2024 at 7:41 PM walter <walter@hacktuary.ai> wrote:
Hi Matt, 

I'm not sure if this is an apples-to-apples situation, but your issue sounds exactly like something I've run into while abusing Python snippets. 
It was easy to avoid after understanding order-of-events for block creation.

I suspect this is language-independent, and you can quickly create a python flowgraph / review the code - it will illustrate the principles:

1. Create a python flowgraph 'FOO.grc' with minimal blocks (e.g. [signal source] --> [throttle2] --> [null sink]).  

2. Add four [Python Snippet] blocks - one for each type of [Section of Flowgraph] param: 'Init - Before Blocks', 'Main - After Start', etc.

3. For each Python Snippet block, add a one-line snippet distinct to the [Section of Flowgraph], for example: 

print("Hello IAMA Init - Before Blocks")    
# NOTE: it's important to have a least one line of code or nothing will be generated for the snippet!

4. Set the Title param of the [Options] block (top block) to "FOO".

5. Press [F5] to generate the flowgraph code, which will be called FOO.py (in same directory as FOO.grc).

6. Examine the resulting FOO.py script in VSCode - in particular, where each of the snippets are invoked.

The most obvious example is that in 'Init - Before Block' it's possible to reference a block or variable self.X before self.X has been instantiated.

More subtle cases are possible, depending on how clever one tries to be when using this mechanism.

- W 

Attached: screencap of example error (take my word that the block 'radio' exists).  I can send a shot of the flowgraph, but it probably wouldn't shed further light.



On Apr 23, 2024, at 13:46, Matt Clemons <mattclems11@gmail.com> wrote:

Hello,

I've walked through tutorials and successfully set breakpoints and debugged OOT modules in Gnu Radio using the DCMAKE_BUILD_TYPE=Debug option. However, I'm trying to debug local changes I've made to existing gnuradio/dtv/ files and not having success.

I've followed the steps in a similar question/email chain here: https://lists.gnu.org/archive/html/discuss-gnuradio/2021-08/msg00008.html (I wasn't sure if replying to this old chain with a question or referencing it was better, let me know if there is a preference for future scenerios).

I also tried recompiling all of the gnu radio source code on my machine with the  DCMAKE_BUILD_TYPE=Debug option and still can not get VScode to stop on my set breakpoint within the dtv/dvbt_demod_reference_signals_impl.cc file. The flowchart runs, and completes but when I hover over the break point it just says "Module containing this breakpoint has not yet loaded or the address could not be obtained".

Any suggestions? I don't like the option of copying this into an OOT module just to debug. I'm not sure I understand the difference either.

Thanks,

Matt

NEWSDR 2024 on Friday May 31 at WPI in Worcester, MA, USA

The New England Workshop on Software Defined Radio (NEWSDR) is being held
at Worcester Polytechnic Institute (WPI) on Friday May 31, in Worcester, Massachusetts, USA.

There will also be a tutorial session on the evening before on Thursday May 30.

The event is free, but advance registration is required.

To learn more about this event, as well as to register for free,
please visit our website at the link below.

Please also consider submitting a poster presentation for the networking sessions.
We are actively looking for submissions.


https://newsdr.org/workshops/newsdr2024/

Sunday, April 28, 2024

Rational resample before FFT, and FFT rate

I am reading Digital RF data at 16k samples/second, and my goal is to
get the power of the maximum frequency once per second.

I start by resampling to a power-of-two rate, then translating to move
the desired frequency to the center with further decimation, then doing
an FFT, converting to log power and finally extracting the power of the
loudest bin. The decimation and FFT size are calculated to yield one
FFT per second. I'm not sure if I'm doing this correctly and I've
attached the flowgraph.

(a) Should the FFT use only a power-of-two bin size? I am resampling
to go from 16k to 8192 samples/second so that I ultimately decimate to
512 samples/second rather than 500 samples/second.

Is that the right thing to do? Should I resample up to 16384
samples/second rather than down to 8192? Or should I just use a 500 bin
FFT?

(b) Given that the final sample rate and FFT depth are equal (512), I
expected to get one vector per second, and thus one maximum value per
second. Instead, I see a much slower update rate, about once per five
seconds.

I added a QT vector sink and while that takes a long time to get
started, once going it does update about once per second. Am I doing
something wrong that the maximum value doesn't update with each new vector?

Thanks,
John

Friday, April 26, 2024

Re: Audio source - device or resource busy error - PROBLEM SOLVED

Marcus,

I have discovered a solution to this issue but I don't understand why.

The 'main()' of FT8_Receive contains lines related to sig_handler which were
included in the original file created by GNU Radio as shown below:

def main(top_block_cls=FT8_Receive, options=None):
tb = top_block_cls()

now = float(datetime.now().strftime('%S.%f'))
print ("RX main = ", now)
def sig_handler(sig=None, frame=None):
tb.stop()
tb.wait()
sys.exit(0)

signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)

check_time(cycle)
print("\nReceiving...")
#Receiving = time.time()
#now = float(datetime.now().strftime('%S.%f'))
#print ("After Receiving = ", now)
tb.start()
#start = time.time()
#print ("start = ",start)
tb.wait()

In desperation I removed those lines to see what the effect would be. I am
no longer getting the resource busy error and the code is running as I
intended.

Why are those lines included and why did their removal fix the problem?

Jim

-----Original Message-----
From: Elmore Family
Sent: Monday, April 15, 2024 11:01 AM
To: GNURadio Discussion List ; Marcus Müller
Subject: Re: Audio source - device or resource busy error



Marcus,

The following is the config.conf file as modified per your request:

[audio_alsa]
audio_module = portaudio
default_input_device = portaudio
default_output_device = pulse
nperiods = 32
period_time = 0.010
verbose = false

Did I do this correctly?

I wasn't sure what to use for the Device Name so I tried portaudio - didn't
recognize it. Used default - it ran but produced exactly the same error as
pulse after 6 iterations.

Note for reference:
Prior to calling the FT8_Receive.main() as I do now I was using either
os.system or subprocess calls to call FT8_Receive. These did not result in
any audio errors but the time to start of execution (1.2 secs) is excessive
rendering the application unusable due to critical timing constraints.

Jim

-----Original Message-----
From: Marcus Müller
Sent: Monday, April 15, 2024 4:55 AM
To: Elmore Family ; GNURadio Discussion List
Subject: Re: Audio source - device or resource busy error

Hi Jim,
so, that's an interesting problem with your sound system. I don't see why it
*should* fail
at six created sources (my suspicion is that the non-deterministic
destruction of objects
that is inherent to Python means there's six parallel endpoints active, from
a perspective
of ALSA and pulseaudio).
Sadly, we don't have a test that covers this (yet?).
Maybe this is a problem specific to the way the ALSA source works.

Would be able to test the portaudio sink? For that, we'll have to force GNU
Radio to use
it (because it uses ALSA by default). You can do that by adding

[audio]
audio_module = portaudio

to your GNU Radio configuration, so to a file ending in .conf (e.g.,
audio.conf) in the
directory that `gnuradio-config-info --userprefsdir` shows.

Best regards,
Marcus


On 15.04.24 02:18, Elmore Family wrote:
> Marcus,
>
> I first tried:
> For ALSA users with audio trouble, follow this procedure ( which I
> followed):
>
> The result was the same.
>
> Then I selected pulse as the device name. it worked for 6 iterations of
> the loop and then gave the following error:
>
> mmap() failed: Cannot allocate memory
> mmap() failed: Cannot allocate memory
> gr::log :ERROR: audio_alsa_source6 - [pulse]: Input/output error
> Traceback (most recent call last):
> File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 337, in <module>
> main()
> File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 320, in main
> FT8_Receive.main()
> File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 205, in main
> tb = top_block_cls()
> File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 85, in __init__
> self.audio_source_0 = audio.source(samp_rate, 'pulse', True)
> RuntimeError: audio_alsa_source
>
> Jim
>
> -----Original Message----- From: Marcus Müller
> Sent: Sunday, April 14, 2024 3:45 PM
> To: discuss-gnuradio@gnu.org
> Subject: Re: Audio source - device or resource busy error
>
> Hi Jim,
>
> try not using the direct hardware device, but the device provided by your
> sound system;
> see the "for users wiht audio trouble" section on the Audio Source
> documentation page.
>
> Best regards,
> Marcus
>
> On 14.04.24 18:02, Elmore Family wrote:
>> I am getting the subject error when running a Python script called
>> repeatedly from another script.
>> The snippet_ft8_rxtx.py shows the call, FT8_Receive.main(), in the while
>> loop.
>> FT8_Receive.py shows the called script.
>> FT8_Receive.pdf is the flowgraph used to generate the called script which
>> as you can see has been modified in main() and with check_time added.
>> The first call to the script is OK but the second call results in the
>> error shown in audio_error.txt.
>> Why is the audio source busy when the flowgraph is stopped (or is it not
>> stopped?) and how do I fix the issue?
>> Jim
>>
>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>> Virus-free.www.avg.com
>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>>
>> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com