Content originally posted in LPCWare by ojima on Tue Jan 10 23:25:10 MST 2012
Hello,
I'm trying to get ADC value continuity with IAR KickStart Kit for LPC1788.
I'm using GPDMA to store ADC values to SRAM.
I expect a behavior of ADC and GPDMA as follows,
____ ____
ADC DONE(AD0GDR) ___| |_________________| |__________________
____ ____
DMA Transfer _______| |_________________| |__________________
(burst size)
But, an actually behavior is as follows that is guessed by a result.
____ ____
ADC DONE(AD0GDR) ___| |_________________| |__________________
_________________________________________
DMA Transfer _______|
(burst size)
Please help me.
source code(using CMSIS library "lpc177x.lpc178x.cmsis_.driver.library.zip")
[ADC setting]
// Set the P0.13 pin as an analog input.
PINSEL_ConfigPin(0, 13, 3);
PINSEL_SetInBufMode(0, 13, DISABLE);
// Set the ADC sampling rate
ADC_Init(LPC_ADC, 400000);
// Disable interruption
ADC_IntConfig(LPC_ADC, ADC_ADINTEN7, DISABLE);
// CH#7 enable
ADC_ChannelCmd(LPC_ADC, ADC_CHANNEL_7, ENABLE);
// Enable interruption
ADC_IntConfig(LPC_ADC, ADC_ADINTEN7, ENABLE);
// Disable NIVC interruption
NVIC_DisableIRQ(ADC_IRQn);
[Start sampling]
// channel 1
GPDMACfg.ChannelNum = 1;
// Source memory - unused
GPDMACfg.SrcMemAddr = 0;
// Destination memory
GPDMACfg.DstMemAddr = (uint32_t) s_dataBuf;
// Transfer size
GPDMACfg.TransferSize = 1000;
// Transfer width - unused
GPDMACfg.TransferWidth = 0;
// Transfer type
GPDMACfg.TransferType = GPDMA_TRANSFERTYPE_P2M;
// Source connection
GPDMACfg.SrcConn = GPDMA_CONN_ADC;
// Destination connection - unused
GPDMACfg.DstConn = 0;
// Linker List Item - unused
GPDMACfg.DMALLI = 0;
GPDMA_Setup(&GPDMACfg);
// Enable GPDMA channel 1
GPDMA_ChannelCmd(1, ENABLE);
// Start ADC
ADC_BurstCmd(LPC_ADC, ENABLE);
[results]
s_dataBuf[0] 0xC7007850
s_dataBuf[1] 0x07007850
:
s_dataBuf[15] 0x07003C20
s_dataBuf[16] 0x77007840
: