How to use DMA for HSADC

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

How to use DMA for HSADC

623 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by iCiepie on Wed Sep 03 14:08:52 MST 2014
Hey,
i wonder how to use DMA for the HSADC. Is there any example code? The one from LPCOpen uses interrupt.
Is there nobody who already programmed it?
Thank you.
Labels (1)
0 Kudos
Reply
2 Replies

506 Views
lpcware
NXP Employee
NXP Employee
0 Kudos
Reply

506 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by iCiepie on Sun Sep 07 06:13:05 MST 2014
hey,
I am still trying to implement DMA for to HSADC of the LPC4370. Interrupt mode is already running, but i only get 25MSample.
Someone could help me please? At the moment I've got this code:

void DMA_Init()

{

NVIC_DisableIRQ(ADCHS_IRQn);

/* Initialize GPDMA controller */
Chip_GPDMA_Init(LPC_GPDMA);
/* Setting GPDMA interrupt */
NVIC_DisableIRQ(DMA_IRQn);
NVIC_SetPriority(DMA_IRQn, ((0x01 << 3) | 0x01));
NVIC_EnableIRQ(DMA_IRQn);

/* Get the free channel for DMA transfer */

dmaChannelNum = 7;

Chip_GPDMA_Transfer(LPC_GPDMA, dmaChannelNum,

&(LPC_ADCHS->FIFO_OUTPUT[0]),

  (uint32_t) &dataValue+4*DMACOUNT,

  GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA,

  ((2UL)));
DMACOUNT++;

/* Waiting for reading ADC value completed */

//while (channelTC == 0) {}







/* Disable interrupts, release DMA channel */

Chip_GPDMA_Stop(LPC_GPDMA, dmaChannelNum);
NVIC_DisableIRQ(DMA_IRQn);


}


void DMA_IRQHandler(void)

{

if (Chip_GPDMA_Interrupt(LPC_GPDMA, dmaChannelNum) == SUCCESS) {
uint8_t TDivider2[30] = "Success DMA \r\n";///
Chip_UART_SendBlocking(LPC_USART2, TDivider2, sizeof(TDivider2));
}

else {
uint8_t TDivider[30] = "Error DMA \r\n";///
Chip_UART_SendBlocking(LPC_USART2, TDivider, sizeof(TDivider));

/* Process error here */

}

}
0 Kudos
Reply