Hi I am trying to read a buffer of 1024 from the adc. It is configured in burst mode and full speed conversion of 2Msps.
I have tried triggering the DMA from ADC conversions and from a Timer. It is working but not propperly.
Doesn't mind what I use to trigger but the DMA seems running at more or less 10 MHz. In the results I can see one result with the flag valid followed by 3 or 4 invalid. I can't understand why when theorically only triggers DMA when the data is valid. Doesn't mind if I use a small timer, the DMA is working at 10 MHz. This is the configuration of the DMA:
/* Enable DMA controller and use driver provided DMA table for
current descriptors */
LPC_DMA->CTRL = 1;
LPC_DMA->SRAMBASE = (uint32_t)Chip_DMA_Table;
/* Use ADC sequencer A interrupt for DMA trigger */
LPC_DMATRIGMUX->DMA_ITRIG_PINMUX[0] = 0;
/* Setup channel 0 for the following configuration:
Hardware trigger on high edge */
LPC_DMA->ENABLESET0 = (1 << 0);
LPC_DMA->INTENSET0 = (1 << 0);
LPC_DMA->CFG0 = (1 << 1) | (1 << 4) | (0 << 5);
/* Setup transfer descriptor common to all DMA descriptors for this buffer.
The transfer will reload the next descriptor in the list when done and
generate a single DMA interrupt at the completion of the list. */
//dmaDesc[0].xfercfg = (1 << 0) | (1 << 1) | (2 << 8) | (0 << 12) | (1 << 14) | ((1024 - 1) << 16) | (1 << 4);
dmaDesc[0].xfercfg = (1 << 0) | (1 << 1) | (2 << 8) | (0 << 12) | (1 << 14) | ((1024 - 1) << 16) | (1 << 4);
dmaDesc[0].source = ((uint32_t) (&LPC_ADC->SEQA_GDAT));
dmaDesc[0].dest = ((uint32_t) (&adcBuff[(1024-1)]));
//dmaDesc[0].next = ((uint32_t) (&dmaDesc[0]));
dmaDesc[0].next = 0;
/* Setup full buffer dewscriptor list */
/* Setup transfer descriptor and validate it */
DMA_CHDESC_T *pDesc = (DMA_CHDESC_T *) LPC_DMA->SRAMBASE;
pDesc[0] = *&dmaDesc[0];
//Chip_DMA_SetValidChannel(LPC_DMA, DMA_CH0);
LPC_DMA->SETVALID0 = (1 << 0);
/* Setup data transfer */
LPC_DMA->XFERCFG0 = dmaDesc[0].xfercfg;
Hi Serigo,
I was wondering if you can describe exactly procedure of your application and upload the whole demo, then I can run it on my board on my site.
I'm looking forward to your reply.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------