SDMA EXT_EVENT_1

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

SDMA EXT_EVENT_1

Jump to solution
2,600 Views
dddd
Contributor II

Hi all,

我当前使用的芯片是imx6sx, 需要用EXT_EVENT_1 触发SDMA进行MEM2MEM复制数据, 有下面几个疑问

1. DMA PAD #1 对应SDMA_EXT_EVENT0 ?

dddd_0-1605167546096.png

dddd_1-1605167588373.png

2. dts 文件这样是不是这样写就能够使用 GPIO_IO09 上升沿触发SMDA进行复制数据了

		pinctrl_dma_ext_event: dma_ext_event {
			fsl,pins = <
				MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x000010B0
			>;
		};
	gpio-dma {
		compatible = "dmatest";
		pinctrl-names = "dmaext";
		pinctrl-1 = <&pinctrl_dma_ext_event>;
		dmas = <&sdma 14 16 0>;
            	dma-names = "dmatest";
		fsl,sdma-event-remap = <0 13 1>;
		status = "okay";
	};

 

如果能够提供一份示例最好了。

期待你们的回复。

Thanks!

Labels (1)
0 Kudos
Reply
1 Solution
2,508 Views
ceggers1
Contributor IV

Hi dddd,

> I'm going to learn the SDMA script and try to write it myself.

As a first step, I recommend reading the following:

  1. http://billauer.co.il/blog/2011/10/imx-sdma-howto-memory-map/
  2. http://blog.petri.us/sdma-hacking/part-1.html

You should not expect much (free) support from NXP regarding SDMA.

Eli Billauer provides a free assembler for SDMA scripts, which is nice for the first steps. But for finding bugs in your own scripts you will likely require a debugger for SDMA (also very useful for learning how the existing scripts work). Additionally you may want to reuse existing ROM subroutines for your own scripts. As there is almost no documentation available, this will require reverse engineering... 

Before reinventing the wheel, you may consider using my tools:
https://community.nxp.com/t5/i-MX-Processors/SDMA-port-for-GNU-binutils-assembler-linker-debugger/m-...

Don't hesitate to ask if you have further questions.

regards
Christian

 

View solution in original post

0 Kudos
Reply
12 Replies
2,592 Views
ceggers1
Contributor IV

Hi,

will try to answer your question. Can you please ask in English (or in German:-)) ?

regards

Christian

0 Kudos
Reply
2,582 Views
dddd
Contributor II

Hi ceggers1,

Thank you for helping me, there are a few questions about EXT_EVENT_1 triggering SDMA for MEM2MEM, I'm using imx6sx.

1. DMA PAD #1  is SDMA_EXT_EVENT0 ,   DMA PAD #2  is SDMA_EXT_EVENT1?

2. I want to use GPIO_IO09 rising edge to trigger SMDA,please check if there is a problem with dts。

 

		pinctrl_dma_ext_event: dma_ext_event {
			fsl,pins = <
				MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x000010B0
			>;
		};
	gpio-dma {
		compatible = "dmatest";
		pinctrl-names = "dmaext";
		pinctrl-1 = <&pinctrl_dma_ext_event>;
		dmas = <&sdma 14 16 0>;
            	dma-names = "dmatest";
		fsl,sdma-event-remap = <0 13 1>;
		status = "okay";
	};

 

3. Can you provide some examples about sdma EXT_EVENT?

 

 

Best Regards!

0 Kudos
Reply
2,562 Views
ceggers1
Contributor IV

Hi,

interestingly I had a similar question a few days ago:
https://community.nxp.com/t5/i-MX-Processors/i-MX7D-SDMA-for-mem-to-ext-peripheral-transfers/m-p/117...

It looks like you want to use the SDMA for transferring data between the CPU's RAM (obvious) and an external peripheral (FPGA?) connected on the external memory interface (EMI). On the peripheral side, you want either ...

  1. transfer data from/to a fixed address (e.g. a FIFO)
  2. transfer data from/to a consecutive address range (e.g. RAM)

For the first case, you'll need different SDMA scripts (mcu_2_app/app_2_mcu). Peripheral type 16 (IMX_DMATYPE_MEMORY) uses the ap_2_ap script which copies to an address range (as opposed to a fixed FIFO address).

For the second case, IMX_DMATYPE_MEMORY (16) is correct, but this script doesn't utilize the SDMA event lines at all. It does more or less the same as memcpy(). Or in other words: <&sdma 14 16 X> is not a useful combination.

Can you provide me some more information? What type of external peripheral you would like to interface? Maybe you'll need a custom script for this. In this case, the tools created by me would be interesting for you: https://community.nxp.com/t5/i-MX-Processors/SDMA-port-for-GNU-binutils-assembler-linker-debugger/m-...

For the case you need a custom SDMA script and you don't want to do this on your own, I can help you with this task.

regards
Christian

0 Kudos
Reply
2,545 Views
dddd
Contributor II

Hi ceggers1,

Thank you for telling me this, I just need to trigger SDMA with EXT_EVENT_1, I don't know how to do it, and  I don't understand SDMA scripts at all.

Best Regards!

0 Kudos
Reply
2,540 Views
ceggers1
Contributor IV

Hi,

in order to help you, I need some more information. Can you please try to answer the following questions:

  1. What type of peripheral do you want to connect?
  2. Which transfer direction do you need?
    1. RAM --> Peripheral
    2. Peripheral --> RAM
    3. both
  3. Does you have a single address for data (FIFO) or a consecutive range of addresses (RAM)?

regards
Christian

0 Kudos
Reply
2,538 Views
dddd
Contributor II

Hi ceggers1,

Thanks for your help.

1. Peripheral is FPGA.

2. Peripheral --> RAM.

3. OCRAM  0x00901000 -- 0x0091FFFF

Best Regards!

0 Kudos
Reply
2,531 Views
ceggers1
Contributor IV

> 3. OCRAM 0x00901000 -- 0x0091FFFF
sorry, I meant the FPGA side.

The address range 0x00901000 -- 0x0091FFFF is the CPU's internal SRAM. I need to know whether the FPGA has a single address for reading data (FIFO) or provides data via RAM like access (consecutive address range).

regards
Christian

0 Kudos
Reply
2,527 Views
dddd
Contributor II

FPGA side is consecutive address range

 

Best Regards!

0 Kudos
Reply
2,523 Views
ceggers1
Contributor IV

> FPGA side is consecutive address range

ok, so you need a memcpy() style transfer from your FPGA's RAM (connected via EMI), to the CPU's internal OCRAM. This transfer shall be triggered by the SDMA event input.

As I already wrote, the exiting ap_2_ap script does memcpy() style transfers, but cannot be triggered by (S)DMA events (only by one of the ARM CPUs). In contrast, the mcu_2_app script uses (S)DMA events, but copies to a single address (FIFO).

In my opinion, you have the following options:

  1. Change your FPGA design, so that you can access your FPGA's RAM via a single FIFO address.
  2. Use a processor which a different DMA technologie
  3. Write your own SDMA script (based on ap_2_ap and mcu_2_app)
    1. Do this yourself.
    2. Ask NXPs professional service
    3. Ask me.

regarding 1)
Even if you can change the FPGA design, you probably would need a customized version of the mcu_2_app script.

regarding 2)
You should know that many processors have also limits accessing external devices via DMA. Some SOC series don't have external event lines at all.

regarding 3)
I have already successfully written a number scripts for the SDMA. In theory, you could do this yourself, but this would add additional efforts and risks to your project.

Christian

2,512 Views
dddd
Contributor II

Hi ceggers1,

Thank you for your advice. It helped me a lot.  I'm going to learn the SDMA script and try to write it myself.

Best Regards!

0 Kudos
Reply
2,509 Views
ceggers1
Contributor IV

Hi dddd,

> I'm going to learn the SDMA script and try to write it myself.

As a first step, I recommend reading the following:

  1. http://billauer.co.il/blog/2011/10/imx-sdma-howto-memory-map/
  2. http://blog.petri.us/sdma-hacking/part-1.html

You should not expect much (free) support from NXP regarding SDMA.

Eli Billauer provides a free assembler for SDMA scripts, which is nice for the first steps. But for finding bugs in your own scripts you will likely require a debugger for SDMA (also very useful for learning how the existing scripts work). Additionally you may want to reuse existing ROM subroutines for your own scripts. As there is almost no documentation available, this will require reverse engineering... 

Before reinventing the wheel, you may consider using my tools:
https://community.nxp.com/t5/i-MX-Processors/SDMA-port-for-GNU-binutils-assembler-linker-debugger/m-...

Don't hesitate to ask if you have further questions.

regards
Christian

 

0 Kudos
Reply
2,581 Views
dddd
Contributor II

image.pngimage.pngimage.png

0 Kudos
Reply