IMX6uLL NO_ SYS SDMA Register Settings

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

IMX6uLL NO_ SYS SDMA Register Settings

2,212 Views
zhangtao
Contributor I

SDMA driver in the official SDK, memory_ To_ For the example of memory, how to set the source address to fixed (FROZEN) and the target address to increment. Currently, the code I have modified is as follows (SDMA_LoadContext in fsl_sdma. c),
Memset (context, 0, sizeof (sdma_context_data_t));
/*Set SDMA core's PC to the channel script address*/
Context ->PC=config ->scriptAddr;
Context ->MSA=0x10;
Context ->MDA=0x04;
After the modification, there was no effect. Please help to take a look.
The information I have found now is that it needs to be modified using LDF and STF assembly, but I think there is already an API for C, so there should be no need to use assembly to set it up. I am very confused

Labels (1)
0 Kudos
Reply
9 Replies

2,180 Views
ceggers
Contributor V

The STYPE/DTYPE (increment/decrement/frozen) depends on the SDMA script which is selected. The app_2_mcu script uses a fixed source address and a incrementing destination address.

There is no need to initialize MSA/MDA via the channel context. The values will be overwritten by the SDMA script.

regards,
Christian

2,161 Views
zhangtao
Contributor I

First of all, thank you for your reply, but How can I load the SDMA script (app_2_mcu script) mode in the fsl_sdma. c file?
Can only be done through the following link? Isn't this too complicated

https://billauer.co.il/blog/2011/10/imx-sdma-howto-assembler-linux/

0 Kudos
Reply

2,151 Views
ceggers
Contributor V

I have only experience using the SDMA under Linux. But you don't need to load any SDMA firmware for using the app_2_mcu script, as this script resides in the ROM of the SDMA. The start address is 0x2ab (683 in decimal). See sdma_script_imx6q in imx-sdma.c (Linux) for all start addresses in ROM.

regards,
Christian

0 Kudos
Reply

2,126 Views
zhangtao
Contributor I

When

config ->scriptAddr=FSL_ FEATURE_ SDMA_ M2M_ When using ADDR (642)

(the official default value),

my program can only read three identical values at once (what I want to achieve is to transfer 1024 bytes at a time,FPGA FIFO)

(read three identical values each time, which is another issue),

but setting config ->scriptAddr=FSL_ FEATURE_ SDMA_ P2M_ Where is the problem with ADDR (683) where no value can be read in destaddr?

thanks2.png1.png

0 Kudos
Reply

2,117 Views
ceggers1
Contributor IV

what I want to achieve is to transfer 1024 bytes at a time,FPGA FIFO

Ok, that's new information for me...

The SDMA script APP_2_MCU (and MCU_2_APP) are designed for copying data between a fixed peripheral address and a range in memory. The data flow is controlled by internal event lines between the peripheral and the SDMA (lets call them "DMA events").

In your case I guess that transfer of individual bytes is not controlled by such event lines. Instead you have either a specific event in your application or you get an interrupt from the FPGA which shall start a transfer of a specific amount of data between the FPGA's FIFO and the µC's RAM.

In contrast to the APP_2_MCU and MCU_2_APP scripts, the M2M script is not driven by such peripheral events, that's the reason why you are able to transfer some bytes. But it's likely (I haven't checked yet)  that M2M uses incrementing SRC and DST addresses which doesn't match your use case.

You can try to configure "peripheral event override" together with APP_2_MCU. In this case no peripheral event is required and the script should instantly transfer as many bytes as you have configured.

There are two other points to consider:

1. If your FPGA provides interrupt driven data, you may want to configure the SDMA in a way that the data is transferred in a way which doesn't require intermediate CPU intervention.

2. Although you can configure the data with for APP_2_MCU to 8/16/32 bit, actual peripheral accesses (to the external bus) may always be performed as 32 bit accesses.

regards,
Christian

2,098 Views
zhangtao
Contributor I

The information I just received from my colleagues indicates that EIM adopts an asynchronous communication mode. Is this the problem?
I am a novice in ARM and may not have accurately described some issues.

0 Kudos
Reply

2,092 Views
ceggers
Contributor V

I think that EIM is an asynchronous external bus interface which means that there is no external clock signal. This needs to be considered for the interfacing with the FPGA, but this shouldn't have any impact on the SDMA programming.

regards,
Christian

0 Kudos
Reply

2,108 Views
zhangtao
Contributor I

Hello, Eggers1

 

1. In my project, FGPA indeed generates an interrupt and SDMA reads the data from FIFO

 


2. The data read in the above figure is already data from the FPGA's FIFO (0x3A 0x0D)

 

3. The specific code is as follows

SDMA_PrepareTransfer(&transferConfig, 0x50000040, (uint32_t)destAddr, 4,
4, 4, 1024, 0, kSDMA_PeripheralTypeMemory,
kSDMA_MemoryToMemory);

I can read the data using the above code (0x3A 0x0D)。

SDMA_PrepareTransfer(&transferConfig, 0x50000040, (uint32_t)destAddr, 4,
4, 4, 1024, 0, kSDMA_kSDMA_PeripheralNormal,
kSDMA_PeripheralToMemory);

Using the above code, the program will freeze。


am I using these two parameters correctly?

The EIM interface is used between FPGA and IMX.

0 Kudos
Reply

2,093 Views
ceggers
Contributor V

SDMA_PrepareTransfer(..., kSDMA_PeripheralTypeMemory, kSDMA_MemoryToMemory)
SDMA_PrepareTransfer(..., 0, kSDMA_kSDMA_PeripheralNormal, kSDMA_PeripheralToMemory)

As I already mentioned, I have no experience using the SDMA with the SDK (outside of Linux). I think that you need some kind of combination of the two above:

- kSDMA_MemoryToMemory selects the M2M script, which doesn't utilize any peripherals event lines, but definitely uses auto incremented addresses for source and destination.

- kSDMA_PeripheralToMemory uses a peripheral specific script (app_2_mcu in case of kSDMA_kSDMA_PeripheralNormal). This script relies on peripheral event lines. Using '0' as event source doesn't help here.

I think you'll have to modify SDMA_PrepareTransfer() in the SDK in way that ...

- you use the app_2_mcu script

- peripheral event lines are ignored

regards,
Christian

0 Kudos
Reply