lpcware

lpc1788 ADC burst

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ojima on Wed Jan 11 02:39:35 MST 2012
hello,

Please tell me that how to get the ADC burst result via GPDMA transfer.

I'm programing to get ADC result on burst mode with IAR Kickstart Kit.

I've set the parameter as follows and run the program,
then I got the result that is not my expected.

I need somebody's help.

[source] (using CMSIS "lpc177x.lpc178x.cmsis_.driver.library.zip")

---- set ADC ---
  // Set the P0.13 pin as an analog input.
  PINSEL_ConfigPin(0, 13, 3);
  PINSEL_SetInBufMode(0, 13, DISABLE); // to assert bit7(analog mode)

  // set the sampling rate
  ADC_Init(LPC_ADC, 400000);

  // disable interruption
  ADC_IntConfig(LPC_ADC, ADC_ADINTEN7, DISABLE);
  // enable ch#7
  ADC_ChannelCmd(LPC_ADC, ADC_CHANNEL_7, ENABLE);
  // enable interruption
  ADC_IntConfig(LPC_ADC, ADC_ADINTEN7, ENABLE);
  // disable interruption(NVIC) make sure
  NVIC_DisableIRQ(ADC_IRQn);

--- start DMA transfer ---

  // channel 1
  GPDMACfg.ChannelNum = 1;
  // Source memory - unused
  GPDMACfg.SrcMemAddr = 0;
  // Destination memory
  GPDMACfg.DstMemAddr = (uint32_t) s_buf;
  // 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);


[result]
s_buf[0] : 0x87007840 <-- DONE bit is 1
s_buf[1] : 0x07007840 <-- DONE bit is 0
s_buf[2] : 0x07007840 <-- DONE bit is 0
                  :
s_buf[15]: 0x07003C20 <-- DONE bit is 0
s_buf[16]: 0x87007850 <-- DONE bit is 1
s_buf[17]: 0x07007850 <-- DONE bit is 0


--- my expected ---                
s_buf[0] : 0x87007840 <-- DONE bit is 1
s_buf[1] : 0x87007850 <-- DONE bit is 1
                  :

Outcomes