Hi, I'm using Stellaris Launchpad. My project using ADC0-SS3 to capture internal temp sensor continuously with uDMA ping pong mode. The ADC0 is triggered by Timer 0.
I have a problem that the ADC interrupt handler triggered only once, then the uDMA channel is disabled.
This is my code for the interrupt handler:
void adcInterruptHandler(void)
{
uint32_t mode;
ADCIntClear(ADC0_BASE, 3);
//
// Check if the ping-pong buffer A is full.
//
mode = uDMAChannelModeGet(UDMA_CHANNEL_ADC3 | UDMA_PRI_SELECT);
if (mode == UDMA_MODE_STOP) {
//
// Data was received complete into buffer A. So the controller is transfer
// using buffer B. We should reset the channel for a new transfer.
//
bufferATransferCounter++;
uDMAChannelTransferSet(UDMA_CHANNEL_ADC3 | UDMA_PRI_SELECT,
UDMA_MODE_PINGPONG,
(void *) (ADC0_BASE + ADC_O_SSFIFO3),
bufferA,
BUFFER_SIZE);
}
mode = uDMAChannelModeGet(UDMA_CHANNEL_ADC3 | UDMA_ALT_SELECT);
if (mode == UDMA_MODE_STOP) {
//
// Data was received complete into buffer B. So the controller is transfer
// using buffer A. We should reset the channel for a new transfer.
//
bufferBTransferCounter++;
uDMAChannelTransferSet(UDMA_CHANNEL_ADC3 | UDMA_ALT_SELECT,
UDMA_MODE_PINGPONG,
(void *) (ADC0_BASE + ADC_O_SSFIFO3),
bufferB,
BUFFER_SIZE);
}
// Toggle the Pin
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2,
(uint8_t) (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2)) ^ ((1 << 2)) );
//uDMAChannelEnable(UDMA_CHANNEL_ADC3);
}
If I uncommented the last line of the code (uDMAChannelEnable(UDMA_CHANNEL_ADC3);), the interrupt handler will trigger continuously but it's not that I expected. Both channel PRI and ALT are in stop mode, from what I understand, it should be only one.