Continuous playback

Discussions about active development projects
pavel
Posts: 478
Joined: Sat May 23, 2015 5:22 pm

Continuous playback

Post by pavel » Tue Nov 17, 2015 12:57 pm

cdekker wrote: My next question deals with the high speed DAC's for analog outputting these recordings on the PC (to use it for other measuring equipment for comparison reasons). I could not find if this issue better suits an already existing topic.
My question is: can the generate module be used for that?
Hi Cees,

I don't think that the generate module can be used to continuously send an infinite sequence of samples to DAC at 10 Msps.

However, just this morning, I've made a small project that continuously sends samples to DAC and that should work at sample rates as high as 12.5 Msps. The source code can be found at:

https://github.com/pavel-demin/red-pita ... laser_test

At the moment, it does not have the network related code but it's not difficult to add.

If you are interested, this code can be easily converted to a continuous DAC player.

Best regards,

Pavel

cdekker
Posts: 31
Joined: Fri Oct 30, 2015 3:33 pm

Re: Continuous playback

Post by cdekker » Wed Nov 18, 2015 4:40 pm

Pavel,

Thanks for your reaction.
To make things easier, I plan to start with a external hard disk (Voyager Air) with an ethernet port. It can be seen from the RedPitaya - or anyone on the small LAN - as just a hard disk. Can this make things easier for a continous DAC output stream with your program?
I am not such a good C-programmer however to be able to add this functionality into your program.

Best regards, Cees Dekker, Netherlands

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

Re: Continuous playback

Post by pavel » Wed Nov 18, 2015 5:12 pm

cdekker wrote:To make things easier, I plan to start with a external hard disk (Voyager Air) with an ethernet port. It can be seen from the RedPitaya - or anyone on the small LAN - as just a hard disk. Can this make things easier for a continous DAC output stream with your program?
I like the idea to use a disk with an ethernet port. If Red Pitaya is capable to read files from this disk fast enough, then It can indeed make things a lot easier.

Could you try to read a large (at least 1-2 GB) file from this disk using Red Pitaya and check how fast the file is read and what is the CPU usage? I'd say that the following command should be enough for this kind of test:

Code: Select all

dd if=file_from_disk of=/dev/null bs=1M
Another question. How you want to interpolate the recorded samples from ~10 Msps to 125 Msps? I can think of several possibilities:
  • interpolate by simply repeating the same sample N times
  • interpolate and filter using CIC filter
  • interpolate and filter using CIC filter and FIR filter to compensate for the drop in the CIC frequency response
At the moment, I'm using the first option. The CIC and FIR filters could be easily added if needed.

cdekker
Posts: 31
Joined: Fri Oct 30, 2015 3:33 pm

Re: Continuous playback

Post by cdekker » Thu Nov 19, 2015 12:56 am

Hi Pavel,

Maybe we should start a bit easier to get something working first. Therefore let us assume that:
- we want to output not 10 Msps but 1 Msps. And let's assume that the hard disk is certainly fast enough over its Gigabit ethernet poort.
- we only use - if needed - interpolation by simply repeating each sample N times.
- the 2 bytes for each sample are the unmodified version of the 2 byte samples that Nils' re-acquire module puts earlier onto the hard disk file.

Given all these assumptions, what would you prefer as next steps?

Best regards, Cees Dekker, Netherlands

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

Re: Continuous playback

Post by pavel » 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

cdekker
Posts: 31
Joined: Fri Oct 30, 2015 3:33 pm

Re: Continuous playback

Post by cdekker » Sun Dec 06, 2015 12:51 pm

Hi Pavel,

I am sorry not to have reacted for some time, due to holiday and because we were busy already trying to use the rp_remote_acquire module, as we need the CIC filtering and decimation factor.
We have now a file recorded, and we can off line convert the bytes if needed.
The two byte samples recorded were collected at 1 Msps (actually 125/128 Msps).

Now we want to use your DAC module. How must the two-byte samples for output be 'formatted'? Must every sample start e.g. on a new line, must it be binary, two's complement, ... ?
Perhaps it might be helpful to us it you can send us a small testfile that your DAC module can handle?

Please accept our apologies not having used your ADC module yet.

You suggested to let the DAC output a sample and zero's in between. Then the analog signal will have a very small effective value. Can this avoided to reuse the sample value for each zero ?

Best regards, Cees Dekker, Netherlands

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

Re: Continuous playback

Post by pavel » Sun Dec 06, 2015 2:48 pm

cdekker wrote:as we need the CIC filtering and decimation factor.
I'm slightly surprised by this comment. In one of my previous comments, I asked you about filters and you answered that you did not need any in that comment.

If you're interested, I can add the CIC and/or FIR filters.
cdekker wrote:How must the two-byte samples for output be 'formatted'? Must every sample start e.g. on a new line, must it be binary, two's complement, ... ?
It's a very simple binary format with all samples represented as signed 16-bit integers (int16_t) in the little-endian format. The samples for DAC1 and DAC2 are interleaved.

The code that reads the input file can be found on line 67 in dac-player.c:
https://github.com/pavel-demin/red-pita ... ayer.c#L67
cdekker wrote:You suggested to let the DAC output a sample and zero's in between.
I did not suggest that.

The zeros are only sent to DAC when the output buffer is empty. This way, the DAC output is zero when the system is idle.

You can find the description of what I implemented in my previous comment:
Simple interpolator (sends the same sample N times)
If I'm not mistaken, it's exactly what you asked for in your previous comment:
we only use - if needed - interpolation by simply repeating each sample N times

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

Re: Continuous playback

Post by pavel » Sun Dec 06, 2015 3:05 pm

cdekker wrote: Perhaps it might be helpful to us it you can send us a small testfile that your DAC module can handle?
Here is a link to a sample of a square wave:
https://googledrive.com/host/0B-t5klOOy ... record.dat

You can download it directly to Red Pitaya and play it with the following commands:

Code: Select all

wget https://googledrive.com/host/0B-t5klOOymMNfmJ0bFQzTVNXQ3RtWm5SQ2NGTE1hRUlTd3V2emdSNzN6d0pYamNILW83Wmc/dac_player/record.dat
./dac-player 125 record.dat
More detailed instructions can be found in one of my previous comments.

cdekker
Posts: 31
Joined: Fri Oct 30, 2015 3:33 pm

Re: Continuous playback

Post by cdekker » Sun Dec 06, 2015 4:07 pm

Hi Pavel,

I am very sorry if I misinterpreted your posts and may have given you incorrect information.

A question first: if you add CIC filtering and decimation to your ADC_recorder, will that be then actually a kind of new version of rp_remote_aquire (runs only on ecosystem 0.92-73 so far)?

To speed things up on our side, we will continue with your DAC_recorder module (runs on ecosystem 0.94) following your guidelines. We understand your info on the content coding.
I will keep you informed.

Best regards, Cees Dekker, Netherlands

cdekker
Posts: 31
Joined: Fri Oct 30, 2015 3:33 pm

Re: Continuous playback

Post by cdekker » Sun Dec 06, 2015 9:28 pm

Hi Pavel,

I understand so far from your posts toward using the DAC recorder module, that the file with the samples, e.g. record.dat, must be on the RP board.
In our situation the file will be too big for this step, as it will be on the network.
Are there any additional steps we should take before starting the DAC_recorder module, or add some commandline parameters?

Best regards, Cees.

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: Yahoo [Bot] and 4 guests