ADC with GPDMA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC with GPDMA

500 Views
lpcware
NXP Employee
NXP Employee
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
      :
Labels (1)
0 Kudos
2 Replies

431 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ojima on Wed Jan 11 17:24:13 MST 2012
Sorry, I didn't care delay time for available from post.
So, I did other topic as same thing. That mean I did multipost.
I want to merge this topic to "lpc1788 ADC burst" topic.

I've changed the sample source and got a result I expect.
I will show changing point at "lpc1788 ADC burst" topic.

OJIMA
0 Kudos

431 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ojima on Tue Jan 10 23:28:49 MST 2012
Sorry, There is a typo at result


original
s_dataBuf[0] 0xC7007850
s_dataBuf[1] 0x07007850
:
s_dataBuf[15] 0x07003C20
s_dataBuf[16] 0x77007840
:

fixed
s_dataBuf[0] 0xC7007850
s_dataBuf[1] 0x07007850
:
s_dataBuf[15] 0x07003C20
s_dataBuf[16] 0x87007840
:


OJIMA
0 Kudos