MPC5746C ADC&EDMA

cancel
Showing results for 
Search instead for 
Did you mean: 

MPC5746C ADC&EDMA

338 Views
ke_liang
Contributor I

Hello!

         I have a trouble to use ADC0,I want use ADC0 to sample and convert ,and used EDMA to transfer ADC0 channel 52 result.  I used PIT timer channel 2 to trigger ADC0 channel 52,ADC0 channel 52 I used inject mode . when I usd ADC0 end of convert interrupt,it is right,adc Interrupt periodic trigger. But when I used EDMA it only trigger once. Below code is ADC EDMA Init code. ADC 0 Init at another place. 

void Drv_AdcInit(void)
{
#ifdef CP_ADC_CONVERT_BY_DMA
adcEdmaTestDestAddr = (uint32_t *)malloc(sizeof(uint32_t));
EDMA_DRV_ConfigSingleBlockTransfer(EDMA_CHN1_NUMBER,
EDMA_TRANSFER_MEM2MEM,
0xffe001d0,
adcEdmaTestDestAddr,
EDMA_TRANSFER_SIZE_4B,
1);
ADC_DRV_EnableDma(INST_ADCONV1);
ADC_DRV_EnableChannelDma(INST_ADCONV1,ADC0_CHANNEL);

#else
ADC_DRV_EnableInterrupts(INST_ADCONV1,ADC_FLAG_INJECTED_EOC);
ADC_DRV_EnableChannelInterrupt(INST_ADCONV1,ADC0_CHANNEL);
INT_SYS_InstallHandler(ADC0_EOC_IRQn,ADC_EOC_IRQHandler,NULL);
INT_SYS_SetPriority(ADC0_EOC_IRQn, 7);
#endif
ADC_DRV_EnableChannel(INST_ADCONV1,ADC_CONV_CHAIN_INJECTED,ADC0_CHANNEL);

EDMA_DRV_StartChannel(EDMA_CHN1_NUMBER);

}

And below code is EDMA channel 1 callback.

void cpAdcEdma(void)
{
adcEdmaTest++;
adcEdmaTestValue = ((uint16_t)(*adcEdmaTestDestAddr & 65535));
*adcEdmaTestDestAddr = NULL;
}

My problem is when I set a breakpoint into EDMA callback. It just enter once, so I need help. 

 

Tks!

0 Kudos
2 Replies

164 Views
ke_liang
Contributor I

I see the Error Status Register (DMA_ES) in S32 IDE memory window, the value is 0x80000102.  Correspond to the figure below.

MPC5746c1.png

MPC5746C2.png

MPC5746C3.png

But I dont how to do.

0 Kudos

164 Views
ke_liang
Contributor I

Below code is EDMA config code.

edma_channel_config_t dmaController1Chn1_Config = {
.channelPriority = EDMA_CHN_DEFAULT_PRIORITY,
.virtChnConfig = EDMA_CHN1_NUMBER,
.source = EDMA_REQ_ADC_0_MUX0,
.callback = cpAdcEdma,
.callbackParam = NULL,
.enableTrigger = false
};
const edma_channel_config_t * const edmaChnConfigArray[] = {
&dmaController1Chn0_Config,
&dmaController1Chn1_Config
};

const edma_user_config_t dmaController1_InitConfig0 = {
.chnArbitration = EDMA_ARBITRATION_FIXED_PRIORITY,
.groupArbitration = EDMA_ARBITRATION_FIXED_PRIORITY,
.groupPriority = EDMA_GRP0_PRIO_LOW_GRP1_PRIO_HIGH,
.haltOnError = false
};

0 Kudos