Continuous playback

Discussions about active development projects
hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Wed May 05, 2021 8:47 am

Hi Pavel,
Sorry for my delayed reply, I was too busy. Thanks for these code snippets, I implemented them and they work perfectly. Very happy indeed :D !

Best regards

Hermann

Darki91
Posts: 1
Joined: Mon May 24, 2021 12:34 am

Re: Continuous playback

Post by Darki91 » Mon May 24, 2021 12:48 am

pavel wrote:
Thu Nov 19, 2015 4:05 pm
Hi Cees,

OK for an easy start at 1 Msps with very simple interpolation and decimation.

I've prepared a new FPGA configuration that contains two data processing chains:
  1. DAC data processing chain
    • Writer (gets samples from AXI bus and writes them to AXI-Stream bus)
    • FIFO (32k samples)
    • Zeroer (sends zeros if FIFO is empty)
    • Simple interpolator (sends the same sample N times)
    • FIFO (transports samples from FPGA clock domain to DAC clock domain)
    • DAC interface
  2. ADC data processing chain:
    • ADC interface
    • FIFO (transports samples from ADC clock domain to FPGA clock domain)
    • Simple decimator (accepts 1 sample every M samples)
    • RAM writer (gets samples from AXI-Stream bus and writes them to RAM via AXI bus)
This FPGA configuration also contains some configuration and status registers to configure and to monitor some of the elements of these two data processing chains.

There are two short C programs: adc-recorder.c and dac-player.c.

All the source codes can be found at:
https://github.com/pavel-demin/red-pita ... dac_player

Pre-built FPGA configuration bitstream file (dac_player.bit) can be downloaded from:
https://googledrive.com/host/0B-t5klOOy ... player.bit

Commands to configure FPGA and run the C programs:
  1. download and install the latest Red Pitaya SD card image following the instructions at http://redpitaya.com/quick-start
  2. set FPGA clock to 143 MHz

    Code: Select all

    devcfg=/sys/devices/soc0/amba/f8007000.devcfg
    echo fclk0 > $devcfg/fclk_export
    echo 1 > $devcfg/fclk/fclk0/enable
    echo 143000000 > $devcfg/fclk/fclk0/set_rate
    
  3. configure FPGA

    Code: Select all

    cat dac_player.bit > /dev/xdevcfg
  4. compile and run ADC recorder at 1 Msps (decimation factor 125)

    Code: Select all

    gcc adc-recorder.c -o adc-recorder
    ./adc-recorder 125 record.dat
  5. compile and run DAC player at 1 Msps (interpolation factor 125)

    Code: Select all

    gcc dac-player.c -o dac-player
    ./dac-player 125 record.dat
Best regards,

Pavel
Hi Pavel,

Maybe some things have changed since 2015 but i'm interested by this adc_recorder / dac_player couple and, perhaps due to my lack of experience, i have not been able to make it works.

My RP board used V1.04 build 9 Ecosystem, i have generate the bitstream under vivado using your Tcl scripts and compile the two c programs. However i get an error after adc_recorder execution, it seems that something missing which is probably the "Contiguous Memory Allocator" (/dev/cma does not exists).

A little help is possible would be welcome, is there ant way to enable the CMA in the ecosystem Kernel ?

Thanks by advance.
Darki

pavel
Posts: 786
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Mon May 24, 2021 10:28 am

I've recently written a small driver that allocates memory using the contiguous memory allocator (CMA). With this new driver, my applications can now write directly to the cached memory.

Here is a link to the source code of this driver:

https://github.com/pavel-demin/red-pita ... ches/cma.c

To compile this driver during the compilation of the Linux kernel, I copy it to drivers/char directory in the source code of the Linux kernel and apply the following patches:

https://github.com/pavel-demin/red-pita ... #L170-L196

The code without the CMA driver is also accessible. Here is a link to the last commit before I added the CMA driver:

https://github.com/pavel-demin/red-pita ... 2bd6185449

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback with sdr-transceiver-wide.c

Post by hermy_sf » Tue Aug 03, 2021 12:50 pm

Hi Pavel,
I have been using the sdr-wideband transceiver now many times and it works still perfectly in all cases of my applications. However, I have to use the host PC for data storage and playback. In principle I could also use the SD-card in the STEMLab without using the PC as client, thus allowing for a stand-alone solution. I thought of re-writing the code in sdr-transceiver-wide.c throwing out the socket communication and implementing a simple file I/O from/to a local file on the SD card. I have two questions:

(1) Are there some speed issues with SD cards which makes such an approach suboptimal ?
(2) Do I face file size limits such as the 4 GB in the RP streaming webapp ?

Or have you maybe even already written a code for this case ?

Best regards

Hermann

pavel
Posts: 786
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Tue Aug 03, 2021 2:35 pm

Hi Hermann,

I have never really tested continuous writing to SD cards. However, I think it's indeed suboptimal.
(1) Are there some speed issues with SD cards which makes such an approach suboptimal ?
Most probably.
(2) Do I face file size limits such as the 4 GB in the RP streaming webapp ?
It depends on the file system. For example, FAT32 has maximum file size of 4 GB.
Or have you maybe even already written a code for this case ?
No.

Best regards,

Pavel

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Thu Apr 14, 2022 9:21 am

Dear Pavel,

Some time has passed and meanwhile I have started a project named COHIRADIA for which I am using the STEMLAB125-14 together with an App which I wrote in Python. The project is now hosted by https://www.radiomuseum.org and you can find information on a provisional landing-page (not yet completed, also there are still some access restrictions): https://www.radiomuseum.org/dsp_cohirad ... guage_id=2there. A demovideo where I show the basic RF band playback function is: https://cohiradia.radiomuseum.org/downl ... deo_v1.mp4. So your help has led to an exciting activity, thanks a lot. There are already 3 'beta-testers' who tried out the STEMLAB with my software and who are very excited. I am now starting to stimulate the community to make own wideband recordings for historic archiving purposes.

Now I have two questions for you:

(1) I have started a GITHub repository for my software and am just wondering what would be the best licensing option. I thought of MIT, as my current dependencies just include your sdr-wideband codes which are also MIT and the code snippets converting from complex64 to complex 32 which you provided in this thread. What is your opinion, are there arguments against MIT?

(2) I am frequently using the PowerSDR Charly 25 HAMlab STEMlab Edition together with the STEMLAB125-14. This software is very useful and I wonder if it can be also used to directly read my datafiles from disk instead of reading the data stream from the STEMLAB. I guess that you have written the respective interfaces for the PowerSDR Charly 25 Software. Is this also an open source project, so that I could make my own modifications ? And what would then be the implications for licensing, if I would link my code to that software? Would MIT then still be o.k. ?

Best regards

Hermann (even more enthusiastic than at the beginning !)

pavel
Posts: 786
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Thu Apr 14, 2022 4:03 pm

Thank you for the news about your project. It is good to know that it is going well.

I see you are using the Qt library in your application. So I think you need to follow the Qt guidelines from this link. My understanding of these obligations is that if you choose to use the Qt library in your application under the terms of the GPL license, then your application must also be licensed under the terms of the GPL license.

If you plan to distribute my code as part of your application, then please respect the terms of its license (MIT). Basically, the LICENSE file should be included with the code. There is no obligation regarding the licensing of your code in this license.

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Thu Apr 14, 2022 7:40 pm

Dear Pavel,
Thanks for the valuable hints - it seems that I have to use GPL indeed. I will of course respect the MIT license of code re-used/modified from you.

Do you also have an answer to my question #2 concerning the PowerSDR Charly 25 HAMlab STEMlab Edition, i.e. if this is also an open source project which I coud try to modify in such a way that it reads my data files from disk instead of reading the data stream from the STEMLAB ?

Many thanks and best greetings

Hermann

pavel
Posts: 786
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Thu Apr 14, 2022 8:13 pm

A quick web search for iq file shows a few options that could probably be used: SDR#, SDRuno, HDSDR, GQRX, SDRangel, GNU Radio.

Maybe they would require some modifications of the format of your files.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 5 guests