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.

CCS/TM4C123GH6PM: uDMA operation with the ADC

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

Tool/software: Code Composer Studio

I am using the µDMA operation with the ADC (only using one analog input). I want to clarify how the µDMA operation with the ADC works. From what I understand, the chosen µDMA channel sends a request signal to the ADC module for the sequence it has just sampled, then those values are stored in a buffer, and finally transferred to the designated address. Is this the correct breakdown of the operation?

Follow-up questions:

  • The arbitration/transfer size of the µDMA can vary from 1 to 1024, considering that the sample sequencers of the ADC can only sample a certain number at a time (e.g. 8 at a time for sample sequencer 0), how do we select the appropriate arbitration size?
  • Storing information in the buffer and then transferring to the designated address I assume would take some time, does this process lead to lost data/conversions as the ADC continues to sample data? In other words, do we have to consider the time that the µDMA has to do its job and provide some sort of delay before the next set of sampled sequence takes place?
  • When using the µDMA with the ADC, the ADC interrupt occurs after the number of samples that we've specified has been completed (number of transfers) as opposed to after every sampled sequence (e.g. every 8 samples for sample sequencer 0) correct? The program then knows which function/routine to jump to by specifying the address of the function/routine in the ADC0 interrupt routine spot in file tm4c123gh6pm_startup_ccs.c.

  • Hello Muhammad,

    First of all, I would like to check if you have downloaded the latest TivaWare? We released Version 2.2.0.295 a couple weeks ago: http://www.ti.com/tool/SW-TM4C

    Included in this version is an ADC w/ uDMA in Ping-Pong mode example for the EK-TM4C123GXL LaunchPad! If you are are asking a lot of these questions to write your own code from scratch, have a look at it, you may have almost everything you need there already! Plus the code is well commented.

    Now then onto your questions:

    Muhammad Rezuna said:
    From what I understand, the chosen µDMA channel sends a request signal to the ADC module for the sequence it has just sampled, then those values are stored in a buffer, and finally transferred to the designated address. Is this the correct breakdown of the operation?

    Not quite, the ADC makes the request, not the uDMA channel. See this from the datasheet:

    The ADC module provides a request signal from each sample sequencer to the associated dedicated channel of the μDMA controller. The ADC does not support single transfer requests. A burst transfer request is asserted when the interrupt bit for the sample sequence is set (IE bit in the ADCSSCTLn register is set).

    Based on that request, then the uDMA channel informs the uDMA controller who can assign the bus to allow the transfer to the designated address to occur.

    Muhammad Rezuna said:
    The arbitration/transfer size of the µDMA can vary from 1 to 1024, considering that the sample sequencers of the ADC can only sample a certain number at a time (e.g. 8 at a time for sample sequencer 0), how do we select the appropriate arbitration size?

    You will want to match the size based on the ADC samples. In the example we have put together, we are using Step 0 and Sequence 0 only so there is only one sample and the Arbitration size is set to 1.

    Muhammad Rezuna said:
    Storing information in the buffer and then transferring to the designated address I assume would take some time, does this process lead to lost data/conversions as the ADC continues to sample data? In other words, do we have to consider the time that the µDMA has to do its job and provide some sort of delay before the next set of sampled sequence takes place?

    The uDMA runs in the background and will be quick enough that the ADC needs no delays if the uDMA is setup right. This is where the power of Ping-Pong mode is shown. By using two buffers in Ping-Pong mode, you only need to service the ADC interrupt when one buffer is full to swap buffers and then can continue chugging on.

    Muhammad Rezuna said:
    When using the µDMA with the ADC, the ADC interrupt occurs after the number of samples that we've specified has been completed (number of transfers) as opposed to after every sampled sequence (e.g. every 8 samples for sample sequencer 0) correct? The program then knows which function/routine to jump to by specifying the address of the function/routine in the ADC0 interrupt routine spot in file tm4c123gh6pm_startup_ccs.c.

    Yes.