S32R45 DDR3 fastDMA example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32R45 DDR3 fastDMA example

6,030 Views
WenChao
Contributor II

HI :

  experts,we want to use S32R45 and DDR3, could you help me where to find the example project or use case?

 

0 Kudos
Reply
9 Replies

5,995 Views
GaryRK
NXP Employee
NXP Employee

Hi WenChao,

NXP can give some initial support to you here but the most effective way of seeking S32R45 support is to contact your local NXP FAE or sales representative directly. S32R45 and other radar specific products are not actively supported on the NXP Community as we have a separate internal support ticket system for radar business.

For now I can share some files as an example usage of the FastDMA for DRAM <> SRAM transfers in the context of S32R45 Linux BSP and the RadarSDK. These files can be used to build a FastDMA kernel driver module that can be used from a Linux application software.

  • FDMA.tar.gz contains the kernel driver source. Extract this at the root of your RSDK install directory, e.g. <RSDK>/FDMA/. The module can be built in the same way as other RSDK driver components by using the provided makefile.
  • FastDMA_patches.tar.gz contains the device tree source patch (0001-dts-fast_dma-basic-node.patch) and a patch for the RSDK RFECapture example application (0001-RFECapture-FastDMA-test-integrated.patch) to demonstrate FastDMA driver usage.

The FastDMA kernel module exposes the memory to user space. The module creates filesystem entry in /dev/rsdk_fdma. This can be used to access directly the fastDMA registers from an application.

The files attached to this message are licensed by NXP LA_OPT_EVAL_DEMO_ONLY license and by downloading and/or using the files you are agreeing to the license terms.

Best regards,

Gary

 

 

5,577 Views
BinksH
Contributor I

Hi Gary,

I'm trying to implement fastDMA into my S32R45 SDK(built by yocto). I met some problems followed your replay. I don't really understand 'the root of your RSDK install directory' & where to put patch file. I searched my SDK project, but did not found any dir similar to rsdk install directory. I also modified rsdk recipe with patch, but it didn't work as well.

Can you explain it detailedly? Thank you.

Best regards,

Binks

0 Kudos
Reply

5,558 Views
GaryRK
NXP Employee
NXP Employee

Hi Binks,

The RSDK is a separate software product from the Linux BSP, it contains drivers and example applications. Some of the drivers have kernel module components and to rebuild these one needs to have both the RSDK sources and Linux kernel sources available (kernel modules must be built using header files referenced in the sources for the exact kernel the modules will be used with).

So you need to acquire the RSDK for S32R45, it can be downloaded from your NXP Software Account in the same area as the Linux BSP - S32R45 Standard Software. When you download and install it the root directory "rsdk" is revealed, here is where you place the FastDMA kernel module source folder. Please read the RSDK release notes and user manual for instructions on how to build RSDK driver kernel modules, these same instructions also apply to FastDMA module since the makefile is composed in a similar way. For example you will supply the path to your Linux kernel sources on the command line when invoking the FastDMA makefile.

Don't confuse this with the Linux BSP Yocto RSDK recipe/layer, that is used to build the Linux kernel including customisations needed by Linux BSP. Once this is built the sources can be used to build kernel modules against, such as FastDMA and RSDK drivers.

Best regards,

Gary

4,841 Views
Brinton_H
Contributor I
Hi GaryRK,
What you're offering is already working. However, there is still a problem, which is very time-consuming and occupies cpu time, which makes me very confused. My need is to transfer a large amount of data from SRAM to DDR (take 2M as an example below); My approach is to open up 64K(4K*16) cache in the memory, and then configure 16 TR queues in a loop, and then start the transmission for each tr and wait for the transmission result, but because the amount of data is relatively large, a maximum of 16 tr can only be supported at a time, resulting in I need to cycle to process, occupying cpu time. It does not meet my actual needs. I would like to ask if there are other ways to meet the needs of high real-time performance, such as interrupt or other ways. Is there a routine? Thank you very much.
Best regards,
Brinton_H
0 Kudos
Reply

4,739 Views
GaryRK
NXP Employee
NXP Employee

Hello Brinton_H,

The maximum size of single FastDMA transfer is limited by the Transfer Record LINE_SIZE field which is 21 bits wide giving 2^21 bytes = 2 MB so a 2 MB contiguous transfer can be made with single DMA operation.

I assume the data block you need to transfer is not contiguous in memory so you need to use multiple transfers of smaller LINE_SIZE to complete the full transfer. To do this you need to use either the separate eDMA module or CPU software to trigger a subsequent TR following completion of a FastDMA transfer. You can use the IRQ_EN register to enable the eDMA request trigger (this allows FastDMA to trigger eDMA which has the ability to write FastDMA registers to trigger a subsequent FastDMA transfer) or enable an interrupt to CPU where the handler code can trigger another FastDMA transfer.

Best regards,

Gary

0 Kudos
Reply

4,553 Views
Brinton_H
Contributor I

Hi GaryRK,

    Thank you for your reply, now FastDMA can work, but there are some problems. For example, the transmission of 8M (the actual data amount is much larger than this), my current scheme is the whole CPU to do, first configure 4 TR(each maximum 2M), and then cycle 4 times to start the transmission and wait for the completion of the transmission. FastDMA_wait_done this function is blocked waiting, the full CPU participation also has a large time overhead, not enough to meet the demand. If I want to use the eDMA and FDMA scheme you mentioned, do you have a sample? If so, could you provide me with one? Thank you very much!

Best regards,

Brinton_H

0 Kudos
Reply

5,521 Views
BinksH
Contributor I

Hi Gary,

The problem solved! FDMA does work! I understand your replay now. I modified dts with your basic patch, and then built fdma module independently. My workmate varified it with rsdk application release. We found it deliver data with great speed.

Best regards,

BinksH

5,957 Views
WenChao
Contributor II

HI GaryRK:

thank U very much, I git the patch file in widows environment, there is an error that is space before tab in indent.

0001-RFECapture-FastDMA-test-integrated.patch:202: space before tab in indent.
size = mParamVC.bufLineLen * mParamVC.bufNumLines + 15;
0001-RFECapture-FastDMA-test-integrated.patch:203: space before tab in indent.
FastDMA_config_tr(DMA_CH, (uint32_t)dram.physical_addr, (uint32_t)sram.physical_addr, SRAM_TO_DRAM, size, size, tr); should RFECapture case work in linux environment?

0 Kudos
Reply

5,924 Views
GaryRK
NXP Employee
NXP Employee

Hi Wenchao,

You are welcome. I think the error in the patching process is because you are using Windows and it has different line endings compared with Linux systems (CR+LF vs LF). Please try using these options with the patch command on command line:

--ignore-space-change --ignore-whitespace --whitespace=nowarn file.patch

If this doesn't work please try to apply the patch on Linux environment (either Linux OS or Cygwin/Msys2) and check the output by compiling RFECapture. 

0 Kudos
Reply