SD card image with Debian 8.0, Red Pitaya web server and SDK

Just about everything about Red Pitaya
Post Reply
fbalakirev
Posts: 73
Joined: Thu Sep 03, 2015 6:56 pm

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by fbalakirev » Fri Oct 29, 2021 4:38 pm

Hi Pavel,

I noticed that you switched from HP to ACP port for ram writing in your example designs. Are there particular problems you encountered with HP port or is there some other reason to switch?

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

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by pavel » Sat Nov 06, 2021 12:28 pm

I switched to ACP to improve the performance of my applications using DMA. The memory buffer is now allocated using contiguous memory allocator (CMA) and the allocated memory is cacheable. The ACP bus has the cache coherency functionality necessary to write to cacheable memory.

The data transfer speed from the Red Pitaya board to a computer has improved by approximately 30% (from 60 MB/s to 80 MB/s).

fbalakirev
Posts: 73
Joined: Thu Sep 03, 2015 6:56 pm

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by fbalakirev » Thu Apr 14, 2022 11:19 pm

Thank you for the detailed explanation.

I gave ACP a try - I followed your adc_recorder example and changed one of my own block designs the same way (switched from HP0 to ACP). I'm also using your axis ram writer core and your old style memory mapping to ram, which mostly worked fine for with HP port. The end result looks a bit funny. Here're couple of recordings of a sine wave:

Image

Image

I guess the cache got messed up and I need to redesign the PS code quite a bit to move to ACP?

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

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by pavel » Fri Apr 15, 2022 6:00 pm

The only redesign that I had to do was to use the contiguous memory allocator (CMA) and add a configuration register for the address of the allocated memory region:

Code: Select all

  fd = open("/dev/cma", O_RDWR);
  size = 128*sysconf(_SC_PAGESIZE);
  ioctl(fd, _IOWR('Z', 0, uint32_t), &size);
  ram = mmap(NULL, 128*sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
  *addr = size; 
I also had to set m_axi_awcache to 4'b1111 in axis_ram_writer.

fbalakirev
Posts: 73
Joined: Thu Sep 03, 2015 6:56 pm

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by fbalakirev » Fri Apr 15, 2022 7:37 pm

Thanks Pavel. m_axi_awcache is set to 4'b1111 indeed from the latest upstream merge. I wonder if cma sets up cache flags in a proper way. I'd have to give CMA a try.

fbalakirev
Posts: 73
Joined: Thu Sep 03, 2015 6:56 pm

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by fbalakirev » Thu Sep 07, 2023 9:31 pm

Hi Pavel,

I'm working on merging your latest code and I'm trying to understand the current functionality of your axis_oscilloscope.v core module in connection with the axis_ram_writer.v module in the adc_recorder_trigger example. It looks to me that once started, the oscilloscope module passes through the data stream, which is then recorded in RAM as pre-trigger data. Once the external trigger arrives, the oscilloscope then stops the stream after a preset total number of points past the trigger is streamed through.

Is this a correct assumption? If so, what happens if the RAM buffer allocated through CMA fills up with pre-trigger data before the external trigger arrives?

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

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by pavel » Thu Sep 07, 2023 10:02 pm

Your description of the algorithm is correct.

Normally, the current version should behave very similarly to the old one.

When the RAM buffer fills up, the axis_ram_writer module continues to write from the start of the RAM buffer.

I regularly test these modules in the MCPHA application and they seem to work.

fbalakirev
Posts: 73
Joined: Thu Sep 03, 2015 6:56 pm

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by fbalakirev » Fri Sep 08, 2023 12:08 am

Thank you for the clarification Pavel.

If I understand your comment and your code right, the CNTR_WIDTH parameter of the oscilloscope and ADDR_WIDTH parameter of the writer should be interrelated? E.g. in adc_recorder_trigger CNTR_WIDTH=23 and ADDR_WIDTH 18, so that the writer address increment would warp around after 2^25 (32M) bytes and the oscilloscope sts_data can correctly track the start address of the record?

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

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by pavel » Fri Sep 08, 2023 7:32 am

Yes, the sample counter in axis_oscilloscope and the address counter in axis_ram_writer should overflow after the same number of bytes. The address counter counts bursts of 16*8=128 bytes. The sample counter counts samples of 4 bytes. 128/4=32=2^5 that gives the difference of 5 between the widths of these two counters.

fbalakirev
Posts: 73
Joined: Thu Sep 03, 2015 6:56 pm

Re: SD card image with Debian 8.0, Red Pitaya web server and SDK

Post by fbalakirev » Fri Sep 08, 2023 3:48 pm

Thank you again Pavel.

Do you happen to know if CMA would support a 256M buffer and what would be the top transfer rate to RAM in this design?

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 22 guests