What should I do to trigger the DMA channel?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
hiyac_351831
Level 3
Level 3
25 replies posted 10 replies posted 10 questions asked

Hello.

I searched component datasheet of DMA but I cannot find DMA software triggeing.
What should I do to trigger the DMA channel?

Best regards,

0 Likes
1 Solution
JamesT_21
Moderator
Moderator
Moderator
10 solutions authored 5 solutions authored First solution authored

And hello back at you!

I think you will find the PDL API Reference more useful. Look in the API Reference section, for the Direct Memory Access (DMA) driver documentation. On my machine it's here: <PDL Install Folder>/3.0.1/doc/pdl_api_reference_manual/html/group__group__dma.html.

You may want to consult the Trigger multiplexer driver docs as well. The trigger multiplexer is phenomenally flexible. You define any number of potential hardware triggers (e.g. a PWM, an ADC, etc) that will cause a trigger to fire. You can then connect that single trigger (called an intermediate signal in the documentation) to any number of outputs. So you can have N inputs to trigger all of N outputs. Typically it's 1:1, but it can be any combination. From software, you can call Cy_TrigMux_SwTrigger() and provide the trigger line you want to "fire." All outputs will be triggered. This is relatively complicated to set up by hand. PSoC Creator handles the trigger muxing transparently.

There is a code example for using a PWM to set off a DMA transfer. Look for CE218553.

The UART code example, CE219656, has a project that handles the UART data transfer via DMA. That may be useful as well.

Hope this helps. I'm going to mark this as correct, but let me know if not!

Jim

View solution in original post

0 Likes
6 Replies
JamesT_21
Moderator
Moderator
Moderator
10 solutions authored 5 solutions authored First solution authored

And hello back at you!

I think you will find the PDL API Reference more useful. Look in the API Reference section, for the Direct Memory Access (DMA) driver documentation. On my machine it's here: <PDL Install Folder>/3.0.1/doc/pdl_api_reference_manual/html/group__group__dma.html.

You may want to consult the Trigger multiplexer driver docs as well. The trigger multiplexer is phenomenally flexible. You define any number of potential hardware triggers (e.g. a PWM, an ADC, etc) that will cause a trigger to fire. You can then connect that single trigger (called an intermediate signal in the documentation) to any number of outputs. So you can have N inputs to trigger all of N outputs. Typically it's 1:1, but it can be any combination. From software, you can call Cy_TrigMux_SwTrigger() and provide the trigger line you want to "fire." All outputs will be triggered. This is relatively complicated to set up by hand. PSoC Creator handles the trigger muxing transparently.

There is a code example for using a PWM to set off a DMA transfer. Look for CE218553.

The UART code example, CE219656, has a project that handles the UART data transfer via DMA. That may be useful as well.

Hope this helps. I'm going to mark this as correct, but let me know if not!

Jim

0 Likes
JamesT_21
Moderator
Moderator
Moderator
10 solutions authored 5 solutions authored First solution authored

By the way, this was a good question! I have filed a ticket to add this information to the datasheet. I think it should be there, it's a very common use case, and a reasonable place to look. It is not obvious that the software trigger functionality you want is available, but elsewhere. We generalized that into the trigger multiplexer, to make the software trigger useful for any design, not just DMA. The side effect is "you have to know where it is." That's what documentation is for.

Thanks for asking!

0 Likes
JamesT_21
Moderator
Moderator
Moderator
10 solutions authored 5 solutions authored First solution authored

One more The engineering team was already on it. I missed this in the component datasheet as well. It's there in the build I have installed.

void DMA_1_Trigger (uint32_t cycles)

Description:

Invokes the Cy_TrigMux_SwTrigger() PDL driver function. Triggers correspondent Trigger Multiplexer output, independently on whether the Component’s tr_in terminal is connected to any trigger signal or not.

"DMA_1" is the default name of the Component. In this case you don't need to provide the "trigger line" because PSoC Creator knows what the Component is attached to and will provide that parameter automatically.

0 Likes

Hello Jim-san,

Thank you for your reply.
I already checked PDL document, but I overlook Trigger multiplexer section.
I am satisfied with your explanation.

---------------------------------------

May I ask you something?

I checked for PSoC Creator 4.2 Generated_Source and found PSoC 6 DMA API.
(DMA_1_Start, DMA_1_Init, DMA_1_SetDescriptor, DMA_1_Trigger, etc...)

I don't know what to use, because there are no details of above API in PSoC6 DMA component datasheet.
I was convinced and use PDL 3.0.1 driver instead of API.

Can I use API?
(I must not use API because it is not written in document?)

Best regards,

0 Likes

Konichiwa?

A couple of things, I hope makes this more clear.

"I already checked PDL document, but I overlook Trigger multiplexer section."

I can fix that. The PDL documentation for DMA should answer your question. The datasheet does, the PDL documentation should. So I'll get that fix into a later release. Thanks for pointing that out.

-----

"I don't know what to use, because there are no details of above API in PSoC6 DMA component datasheet.
I was convinced and use PDL 3.0.1 driver instead of API. Can I use API? "

Yes. And below is a long explanation of why the answer is a simple Yes.

-----

Most (not all) Component API function calls are simple wrappers for a PDL API function. Suppose you want to disable a DMA channel. You can use the Component API call, which is defined in DMA_1.h (in the generated code, using the default name for the Component).

__STATIC_INLINE void DMA_1_ChannelDisable(void)

{

    Cy_DMA_Channel_Disable ( DMA_HW, DMA_DW_CHANNEL );

}

The Component API automatically provides both the base hardware address (register access) and which channel to use. These it "knows" from your Creator design. It then calls the corresponding PDL function with those values.

You can, if you want, call Cy_DMA_Channel_Disable() directly, but you have to provide both parameters yourself. Either way works. This makes the entire PDL useful with or without PSoC Creator. PSoC Creator makes it easier to use.

DMA_1_ChannelDisable is not documented in the Component datasheet. Why?

We made a specific decision to not duplicate the documentation. We want a single source of truth. So for any function that simply redirects to the PDL, there is no information in the Component datasheet. What the function does, how it works, any interactions... those are in the PDL API reference. If we change something and need to update the documentation, it changes in one place and one place only. A couple of Component API functions, like _Start(), are unique to the Component. They do not exist in the PDL API. So they are documented in the Component datasheet.

In all other cases, the Component API call is precisely the same as the PDL function, except that it provides some parameters automatically (like the base hardware address).

I hope this helps explain things. It's a really elegant design, but elegance can sometimes be confusing

Jim

0 Likes

Hello Jim-san,

It's clear now!

Thank you for sending your gracious response so promptly.

Best regards,

0 Likes