Continuous playback

Discussions about active development projects
hermy_sf
Posts: 12
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: 656
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: 12
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: 656
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

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: Bing [Bot] and 1 guest