我想用AD启动后,转换完后,DMA就把转换完的值就直接传送到数组,不用进入中断,一直调试部成功!AD和DMA配置程序如下:
uint32_t pui32ADCValue[8]={0,0,0,0,0,0,0,0};
uint8_t pui8DMAControlTable[1024] __attribute__ ((aligned(1024)));
void ADC_Init(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3|GPIO_PIN_2);
ADCHardwareOversampleConfigure(ADC0_BASE,2);
// ADCIntEnable(ADC0_BASE,2);
// IntEnable(INT_ADC0SS2);
//ADCͨµÀ0ÅäÖÃ
ADCSequenceConfigure(ADC0_BASE, 2, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 2, 0, ADC_CTL_CH0);
ADCSequenceEnable(ADC0_BASE, 2);
ADCIntClear(ADC0_BASE, 2);
ADCSequenceConfigure(ADC0_BASE, 2, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 2, 1, ADC_CTL_CH1 | ADC_CTL_IE|ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 2);
ADCIntClear(ADC0_BASE, 2);
ADCSequenceDMAEnable(ADC0_BASE, 2);
ADC0_DMA_Init();
ADCProcessorTrigger(ADC0_BASE, 2);
}
void ADC0_DMA_Init(void)
{
// Enable the uDMA controller.
SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
uDMAEnable();
// Set the base for the channel control table.
uDMAControlBaseSet(&pui8DMAControlTable[0]);
uDMAChannelAttributeDisable(UDMA_CHANNEL_ADC0, UDMA_ATTR_ALL);
uDMAChannelAttributeEnable(UDMA_CHANNEL_ADC0, UDMA_ATTR_USEBURST);
//Sets the control parameters for a uDMA channel control structure.
uDMAChannelControlSet(UDMA_CHANNEL_ADC0 | UDMA_PRI_SELECT,UDMA_SIZE_16 | UDMA_SRC_INC_NONE |UDMA_SIZE_16 | UDMA_ARB_8 | UDMA_NEXT_USEBURST);
uDMAChannelTransferSet(UDMA_CHANNEL_ADC0 | UDMA_PRI_SELECT,UDMA_MODE_PER_SCATTER_GATHER, (void *)(ADC0_BASE + ADC_SSFIFO), pui32ADCValue,sizeof(pui32ADCValue));
uDMAChannelEnable(UDMA_CHANNEL_ADC0);
//Requests a uDMA channel to start a transfer
//uDMAChannelRequest(UDMA_CHANNEL_ADC0);
}
wade hong:
楼主说的“调试不成功”具体是什么?
可以把ADC ,DMA分两部分调试,先调试ADC,看采样是否正常,再进行下一步。
wade hong:
楼主说的“调试不成功”具体是什么?
可以把ADC ,DMA分两部分调试,先调试ADC,看采样是否正常,再进行下一步。