This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: PRU ADC with FFTW integration

Part Number: AM3358

Hello,

I wrote the ADC/DMA code for a ping pong buffer configuration. The code works and it can run in the firmware correctly on the PRU. I am using the Linux SDK 06.00.00.07.

I am trying to figure out how I can integrate the ADC/DMA firmware code with FFTW. Ideally, I want to be able to do FFT calculations on the ping/pong buffers.

The issue I am having is I don't know how to integrate these two code files together. I can enable the ADC/DMA code from the FFTW code using Remoteproc. However, the issue is that since I am assuming I have to run the FFTW code in the userspace, I am not sure how to access the ping/pong buffers.

For instance, let's say my ping buffer is at 0x81000000 and my pong buffer is at 0x82000000. How can I access these buffers from the userspace in the FFTW code? I assuming all code compiled in the userspace is using virtual memory from what I understand.

Any advice is greatly appreciated.

Best Regards,

Tyler

  • Hello Tyler,

    The DMA is useful if the PRU in your design is going to process data at such a rate that it will not be able to spend cycles copying data over. I have not spent much time looking at the DMA yet, so here are my suggestions if you were not going to use DMA:

    1) If your system was going to be an isolated embedded system where root access could be preserved, and if the data rate was such that the PRU had the processor cycles to copy data into DDR itself, then the simplest suggestion I have is to use the PRU to copy data over, and then perform a mmap from userspace to access that data.

    2) You may need to write a kernel driver if mmap from userspace is not an option. The kernel driver could then expose the memory to userspace to allow your userspace application to access the data.

    If you are interested in 1 or 2, I can point you to additional resources. I am taking a look at DMA stuff now.

    Regards,

    Nick

  • Hello Nick,

    Great news is that I was just able to figure out how to use mmap in the userspace. Since I need as much processor overhead as possible for FFT calculations, I went with your option 2. I am now successfully able to transfer ADC data directly from the FIFO0DATA register to a specified memory in the external memory using DMA, I can then use mmap to map the physical memory to access that specified memory, and I can then use that data at the specified memory to perform arithmetic operations. I just tested the arithmetic operations using FFTW which was my goal and it seems to be working properly.

    Thank you!

    Best Regards,

    Tyler