2169209_en-US

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

2169209_en-US

2169209_en-US

[iMXRT1064 DMA/XBAR] Trigger DMA from GPIO rising edge

Hi,

I'm using iMXRT1064.


I'm trying to trigger a DMA channel to start transfer after GPIO rising edge, without any CPU involvement.

The only approach I found is to route GPIO signal through XBAR, and set DMA channel source to XBAR Request #{0,1,2,3}, but unfortunately the DMA channel does not start.

For sanity, I changed DMA source to DMA Always On, and channel started on enable - so issue is not incorrect DMA channel configuration.

I attached minimal MXUXpresso project that tries to do the above:

CLOCK_EnableClock(kCLOCK_Dma);
CLOCK_EnableClock(kCLOCK_Iomuxc);
CLOCK_EnableClock(kCLOCK_Xbar1);

---

DMAMUX_SetSource(DMAMUX, 0, (uint8_t)kDmaRequestMuxXBAR1Request0);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_15_XBAR1_IN25, 0U);
XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarIn25, kXBARA1_OutputDmaChMuxReq30);

----
AT_NONCACHEABLE_SECTION_ALIGN(
    static edma_tcd_t _test_tcd[1],
    sizeof(edma_tcd_t)
);
AT_NONCACHEABLE_SECTION_ALIGN(
    static uint32_t _test_dest,
    sizeof(uint32_t)
);
AT_NONCACHEABLE_SECTION_ALIGN(
    static uint32_t _test_source,
    sizeof(uint32_t)
);

static
void
_dma_callback(
    struct _edma_handle *handle,
    void *userData,
    bool transferDone,
    uint32_t tcds
) {
    PRINTF("DMA callback called!\n");
}

----

EDMA_DisableChannelRequest(BOARD_DMA0_CH0_Handle.base, BOARD_DMA0_CH0_Handle.channel);

_test_source = 12345;
_test_dest = 0;

xbara_control_config_t config;
config.activeEdge = kXBARA_EdgeRising;
config.requestType = kXBARA_RequestDMAEnable;

XBARA_SetOutputSignalConfig(XBARA1, kXBARA1_OutputDmaChMuxReq30, &config);

edma_transfer_config_t transfer_config;
EDMA_PrepareTransferConfig(
    &transfer_config,
    (void *)&_test_source,
    sizeof(uint32_t),
    sizeof(uint32_t),
    (void *)&_test_dest,
    sizeof(uint32_t),
    sizeof(uint32_t),
    sizeof(uint32_t),
    sizeof(uint32_t)
);
EDMA_TcdReset(_test_tcd);
EDMA_TcdSetTransferConfig(_test_tcd, &transfer_config, NULL);
EDMA_TcdEnableInterrupts(_test_tcd, kEDMA_MajorInterruptEnable);

EDMA_SetCallback(&BOARD_DMA0_CH0_Handle, _dma_callback, NULL);

EDMA_InstallTCD(BOARD_DMA0_CH0_Handle.base, BOARD_DMA0_CH0_Handle.channel, _test_tcd);
EDMA_EnableChannelRequest(BOARD_DMA0_CH0_Handle.base, BOARD_DMA0_CH0_Handle.channel);


I would appreciate any help in solving this.

i.MXRT 106xRe: [iMXRT1064 DMA/XBAR] Trigger DMA from GPIO rising edge

I have found the issue - this is a bug in Config Tools code generation.

XBAR clock is enabled at `pin_mux.c`, but afterwards gets disabled at `clock_config.c` - so after initializations XBAR clock remains disabled.

Enabling it solves the issue.

Tags (1)
No ratings
Version history
Last update:
‎11-20-2025 12:57 PM
Updated by: