This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EK-TM4C129EXL: Adding step to ADC sample sequence with udma ping_pong

Part Number: EK-TM4C129EXL

Hi,

I am trying to add a new step to sample another channel within a uDMA ping pong code derived from the TIVAware udma_ping_pong.c example.

My code is working properly for one channel and one step. When I try to add another channel by making the changes bellow the board keeps resetting (code halts on top of void ResetISR(void) in tm4c129encdt_startup_css_gcc.c). Here are the changes

- Configured one more ADC pin ( I want to use PE3 and PE0 with ADC0)

Fullscreen
1
2
// Enable the GPIO pin for ADC0 Channel 0 (PE3) and Channel 3 (PE0)
MAP_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3| GPIO_PIN_0);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

- Added the next step with ADCSequenceSTepConfigure(ADC0_BASE,0,0,ADC_CTL_CH0);

Fullscreen
1
2
3
4
5
6
// Enable sample sequence 0 with a processor signal trigger.
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
// Configure step 0 on sequence 0 to sample CH0 (PE3->Accel)
ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0);
// Configure step 1 on sequence 0 to sample CH3 (PE0->Current)
ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH3 | ADC_CTL_END | ADC_CTL_IE);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

-  Changed, for both Primary and Alternative channels, the size of the data transfer UDMA_SIZE_16 to UDMA_SIZE_32 and UDMA_DST_INC_16 to UDMA_DST_INC_32, because I now transfer two samples each time

Fullscreen
1
2
3
4
5
6
// Configure the ctrl param for the prim ctrl struct for chan ADC0
uDMAChannelControlSet(UDMA_CHANNEL_ADC0 | UDMA_PRI_SELECT, UDMA_SIZE_32 |
UDMA_SRC_INC_NONE | UDMA_DST_INC_32 | UDMA_ARB_1);
// Configure the ctrl param for the alt ctrl struct for chan ADC0
uDMAChannelControlSet(UDMA_CHANNEL_ADC0 | UDMA_ALT_SELECT, UDMA_SIZE_32 |
UDMA_SRC_INC_NONE | UDMA_DST_INC_32 | UDMA_ARB_1);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 I would like to know if I am missing anything, I suspect my uDMA transfer setup to not be correct 

  • Each DMA transfer is still 16 bits, so you should keep the UDMA_SIZE_16 and UDMA_DST_INC_16.

    Instead, change the final argument to MAP_uDMAChannelTransferSet to double the transfer count.