static void DEMO_EDMAInit(void){
edma_config_t userConfig;
DMAMUX_Init(DEMO_DMAMUX_BASE);
DMAMUX_SetSource(DEMO_DMAMUX_BASE, DEMO_DMA_CHANNEL, DEMO_DMA_SOURCE);
DMAMUX_EnableChannel(DEMO_DMAMUX_BASE, DEMO_DMA_CHANNEL);
DMAMUX_SetSource(DEMO_DMAMUX_BASE, DEMO_DMA_CHANNEL_for_ADC2, DEMO_DMA_SOURCE_for_ADC2);
DMAMUX_EnableChannel(DEMO_DMAMUX_BASE, DEMO_DMA_CHANNEL_for_ADC2);
EDMA_GetDefaultConfig(&userConfig);
userConfig.enableContinuousLinkMode = true;
userConfig.enableDebugMode = true;
EDMA_Init(DEMO_DMA_BASE, &userConfig);
EDMA_CreateHandle(&g_EDMA_Handle, DEMO_DMA_BASE, DEMO_DMA_CHANNEL);
EDMA_CreateHandle(&g_EDMA_Handle_for_ADC2, DEMO_DMA_BASE, DEMO_DMA_CHANNEL_for_ADC2);
EDMA_PrepareTransfer(&g_transferConfig, (void *)&(DEMO_LPADC_BASE->RESFIFO), 2U, ANALOG_INPUT_STATUS, sizeof(ANALOG_INPUT_STATUS[0]),
2U * 1U, (BUFF_LENGTH - 6U) * 2U, kEDMA_PeripheralToMemory);
EDMA_PrepareTransfer(&g_transferConfig_for_ADC2, (void *)&(LPADC2->RESFIFO), 2U, ANALOG_INPUT_STATUS1, sizeof(ANALOG_INPUT_STATUS1[0]),
(2U * 1U), (6U * 2U), kEDMA_PeripheralToMemory);
EDMA_TcdSetTransferConfig(&s_emdaTcd[0], &g_transferConfig, &s_emdaTcd[0]);
EDMA_TcdSetTransferConfig(&s_emdaTcd[1], &g_transferConfig_for_ADC2, &s_emdaTcd[1]);
EDMA_InstallTCD(DEMO_DMA_BASE, DEMO_DMA_CHANNEL, &s_emdaTcd[0]);
EDMA_InstallTCD(DEMO_DMA_BASE, DEMO_DMA_CHANNEL_for_ADC2, &s_emdaTcd[1]);
EDMA_StartTransfer(&g_EDMA_Handle);
EDMA_StartTransfer(&g_EDMA_Handle_for_ADC2);
}
Hello @burhanhagi,
Sorry for taking a while to get back to you. In order to support you better, can you provide me what happens when you cannot read (is the data received wrong, occurs a hard fault error, the DMA present an error)?
Also, the issue could be a channel priority error in the DMA, with the propose of try a pinpoint, can you change the priority of each DMA channel that you are currently using?
If you need more information about this error, you can consult the chapter 6.3.3 called "Fault reporting and handling" in the RM
BR
Habib.