Thank you for your answer. When adding DMA function to the project, the result is different from what I expected.
I hope to trigger the ADC-ETC function within 1S, and then turn on the DMA transfer. In the DMA setting, I set up two channels to complete the transfer of ADC1 and ADC2 data respectively. When the conversion of ADC1 and ADC2 is completed, the DMA request is triggered.
This is my DMA code setting
void ADC1_TransferCreateHandleEDMA(void)
{
EDMA_PrepareTransfer(&ADC1_transferConfig,
(void *)0x403B0028,
sizeof(g_vusADC1ConvertedValue[0]),
g_vusADC1ConvertedValue,
sizeof(g_vusADC1ConvertedValue[0]),
sizeof(g_vusADC1ConvertedValue[0]),
6,
kEDMA_MemoryToMemory);
EDMA_SubmitTransfer(&g_ADC1EdmaHandle, &ADC1_transferConfig);
EDMA_StartTransfer(&g_ADC1EdmaHandle);
}
void ADC2_TransferCreateHandleEDMA(void)
{
EDMA_PrepareTransfer(&ADC2_transferConfig,
(void *)0x403B00C8,
sizeof(g_vusADC2ConvertedValue[0]),
g_vusADC2ConvertedValue,
sizeof(g_vusADC2ConvertedValue[0]),
sizeof(g_vusADC2ConvertedValue[0]),
4,
kEDMA_MemoryToMemory);
EDMA_SubmitTransfer(&g_ADC2EdmaHandle, &ADC2_transferConfig);
EDMA_StartTransfer(&g_ADC2EdmaHandle);
}
void ADC1_EDMACallback(edma_handle_t *handle, void *userData, bool transferDone, uint32_t tcds)
{
ADC1_TransferCreateHandleEDMA();
g_Transfr_flag |= 0X01;
}
void ADC2_EDMACallback(edma_handle_t *handle, void *userData, bool transferDone, uint32_t tcds)
{
ADC2_TransferCreateHandleEDMA();
g_Transfr_flag |= 0X02;
}
void DMA_Configuration()
{
edma_config_t config;
ADC_EnableDMA(ADC1, true);
/* Init DMAMUX */
DMAMUX_Init(DMAMUX);
/* Set channel for ADC1 */
DMAMUX_SetSource(DMAMUX, ADC1_CHANNEL0_DMA_CHANNEL, kDmaRequestMuxADC1);
DMAMUX_EnableChannel(DMAMUX, ADC1_CHANNEL0_DMA_CHANNEL);
/* Init the EDMA module */
EDMA_GetDefaultConfig(&config);
EDMA_Init(DMA0, &config);
EDMA_CreateHandle(&g_ADC1EdmaHandle, DMA0, ADC1_CHANNEL0_DMA_CHANNEL);
EDMA_SetCallback(&g_ADC1EdmaHandle, ADC1_EDMACallback, NULL);
ADC1_TransferCreateHandleEDMA();
ADC_EnableDMA(ADC2, true);
DMAMUX_SetSource(DMAMUX, ADC2_CHANNEL0_DMA_CHANNEL, kDmaRequestMuxADC2);
DMAMUX_EnableChannel(DMAMUX, ADC2_CHANNEL0_DMA_CHANNEL);
EDMA_CreateHandle(&g_ADC2EdmaHandle, DMA0, ADC2_CHANNEL0_DMA_CHANNEL);
EDMA_SetCallback(&g_ADC2EdmaHandle, ADC2_EDMACallback, NULL);
ADC2_TransferCreateHandleEDMA();
}
What I want is the result in the red box of the picture. Two DMA requests are triggered within 1S, but sometimes only one DMA is triggered. can you help me?
