PSOC6 HAL DMA Chaining MODUS

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

cross mob
shepdog87
Level 3
Level 3
25 sign-ins 10 questions asked 10 replies posted

I am using the MODUS IDE because my PSOC 62 kit / is not available in PSOC Creator.

I am trying to chain 2 DMA components together using the HAL driver.

My first DMA component triggers off a digital input pins rising edge, and that works as expected.

The second DMA component should trigger when the first DMA completes, but when I setup the source, I get an error.

Based on the documentation, I can't figure out what I am doing wrong.

Error Code is the following: Module: 0x100 Code: 0xD01 Type: 0x02

Code:

cyhal_source_t mem_trigger_src;

rslt = cyhal_dma_enable_output(&dma_ch[0], CYHAL_DMA_OUTPUT_TRIGGER_ALL_ELEMENTS, &mem_trigger_src);
if(rslt != CY_RSLT_SUCCESS)
{
    printf("Error! [%d] {%s: %d}\r\n", rslt, __FILE__, __LINE__);
}

result_dec.raw = cyhal_dma_connect_digital(&dma_ch[1], mem_trigger_src, CYHAL_DMA_INPUT_TRIGGER_SINGLE_BURST);
if(result_dec.raw != CY_RSLT_SUCCESS)
{
    printf("Error! [%d : %d : %d] {%s: %d}\r\n", result_dec.module, 
        result_dec.code, result_dec.type , __FILE__, __LINE__);
}

So, the call to create create the output on ch[0] works, but when I try to link that output into ch[1], I get the error.

This is very similar to how I configured ch[0] with a digital input pin, but it worked as expected.

0 Likes
1 Solution
shepdog87
Level 3
Level 3
25 sign-ins 10 questions asked 10 replies posted

Hello,

I finally got it working with the HAL method. The item that was configured incorrectly was the DMA channel for the memory to memory transfer. I configured it as CYHAL_DMA_DIRECTION_MEM2MEM, but it needed to be CYHAL_DMA_DIRECTION_PERIPH2MEM.

I am not sure why that is, but everything is working.

View solution in original post

0 Likes
4 Replies
YuZh
Moderator
Moderator
Moderator
100 replies posted 10 likes received 50 sign-ins

Hi:

According to your code, you want to link DMA complete signal to next DMA to trigger. That means you want to use hardware trigger mode. Right?

Datawire can be used for that function.  DMAC can not do that. So strongly recommended MODUS GUI will be a better choice for DMA configuration. 

 

zhichao

0 Likes
shepdog87
Level 3
Level 3
25 sign-ins 10 questions asked 10 replies posted

Hello,

Does the HAL provide functions for a hardware trigger? Attached is a picture of how I have it working in PSOC Creator for a different PSOC 61 series project. Can you please show me screenshots of how I would setup the green section in the MODUS GUI? I haven't found an example project of DMA chaining in the MODUS tool.

 

shepdog87_1-1675254001669.png

 

0 Likes

Hi,

I configured 2x DMA Channels in the MODUS GUI. I then added input and output signals.

For the DMA_CntToMem, I put the P5[0] as an input. For the output, I put the DMA_MemToMem Input.

It generated some code for configuring the trigger mux. I made sure to call this function after the pins were setup but before configuring and starting the DMA channels and component.

However, I am not getting a transfer from my timer counter address when the input signal has a rising edge. Is there anything else you can think of why it won't trigger?

cy_rslt_t init_cycfg_dma_triggers(void)
{
cy_rslt_t rslt;
rslt = Cy_TrigMux_Connect(
    TRIG_IN_MUX_0_HSIOM_TR_OUT10, 
    TRIG_OUT_MUX_0_PDMA0_TR_IN0, 
    false,  
    TRIGGER_TYPE_EDGE);

rslt |= Cy_TrigMux_Connect(
    TRIG_IN_MUX_0_PDMA0_TR_OUT0, 
    TRIG_OUT_MUX_0_PDMA0_TR_IN1, 
    false, 
    TRIGGER_TYPE_EDGE);
return rslt;
}
0 Likes
shepdog87
Level 3
Level 3
25 sign-ins 10 questions asked 10 replies posted

Hello,

I finally got it working with the HAL method. The item that was configured incorrectly was the DMA channel for the memory to memory transfer. I configured it as CYHAL_DMA_DIRECTION_MEM2MEM, but it needed to be CYHAL_DMA_DIRECTION_PERIPH2MEM.

I am not sure why that is, but everything is working.

0 Likes