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.

TM4C129ENCPDT: Adding Definitions to expand µDMA Channel Assignments

Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: EK-TM4C129EXL,

We're trying to do uDMA with both UARTs 6 and 7.

We took the example program C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c129exl\udma_demo\udma_demo.c and modified it to use UARTS 6 and 7.

But it won't compile because UDMA_CHANNEL_UART6RX and UDMA_CHANNEL_UART6TX do not exist. Same for UART7 as well.

driverlib/udma.h offers the following UDMA channel defines for UARTs:

#define UDMA_CHANNEL_UART0RX    8
#define UDMA_CHANNEL_UART0TX    9
#define UDMA_CHANNEL_UART1RX    22
#define UDMA_CHANNEL_UART1TX    23

Why are there only defines for UARTS 0 and 1, and not the other UARTs? The datasheet shows all the UARTs are accessible to uDMA and the errata does not indicate otherwise.

  • There are 31 uDMA channels, but each channel can have one of nine "peripheral" assignments. For support of legacy software, those peripherals that use "peripheral 0" of the uDMA channel can be addressed simply with the defines you have shown above. UART6 and UART7 use "peripheral 2". To use the uDMA on these peripherals you must call uDMAChannelAssign(). For example:

      uDMAChannelAssign(UDMA_CH10_UART6RX);

    But I have not really answered your question. I can only speculate why they did not include a definition such as:

    #define UDMA_CHANNEL_UART6RX    10

    I suspect that doing so would fail to highlight that this channel definition cannot be correctly used without first assigning channel 10 to UART6RX. You can certainly add such definitions to your code to increase the readability.

  • That makes sense. Thank you
  • Bob,

    Your post here will surely prove of value to others - seeking such (special) µDMA insight.      Requesting poster is skilled - neither he/she - nor any w/in my small tech firm - had such knowledge.

    To,  "Speed, Ease & Enhance"  - all future  "Search & Finds" of your excellent  µDMA advice - would not a more descriptive  "Forum TAG" prove useful?

    The "tag" which "auto-attached" specified,  "ONLY a single MCU Part Number"  -  which proves "FAR too limiting"  (many/most TM4Cs could employ your method - could they not?)  and more importantly - a "Part Number ONLY tag"  provides  NO/ZERO,  "thoughtful description of the post's central intent."      (thus forcing - most likely - unwanted time/effort upon some hapless T.I. "Tag Organizer" and/or his/her "Bot")

    In this particular case - might,  "Adding Definitions to expand µDMA Channel Assignments"   far better serve forum users?

    Do note that (some) here  (friend Robert & myself, certain others)  often strive to create "more meaningful post tags" - so that (even post authors) - raise the odds of  "Finding such posts - downsteam..."     (long after they've "passed" from "front page" - drifting then into forum oblivion...)

  • Let the record show that this thread's "Title" was changed to better reflect the thread's content.      In addition - at least the (post above) employs a properly descriptive "Tag" as opposed to the,  "MCU Part Number - alone" - which unduly restricts & offers little (i.e. NO) insight into thread's theme/major content...

    Thanks to vendor's Bob (likely suspect) or nameless other - for accepting a suggestion aimed - for the benefit of  "many."

  • Turns out you do not need to add definitions. They are already there, but not obvious.

    These definitions:

    //*****************************************************************************
    //
    // Channel numbers to be passed to API functions that require a channel number
    // ID.  These are for secondary peripheral assignments.
    //
    //*****************************************************************************
    #define UDMA_SEC_CHANNEL_UART2RX_0                                            \
                                    0
    #define UDMA_SEC_CHANNEL_UART2TX_1                                            \
                                    1
    #define UDMA_SEC_CHANNEL_TMR3A  2
    #define UDMA_SEC_CHANNEL_TMR3B  3
    #define UDMA_SEC_CHANNEL_TMR2A_4                                              \
                                    4
    #define UDMA_SEC_CHANNEL_TMR2B_5                                              \
                                    5
    #define UDMA_SEC_CHANNEL_TMR2A_6                                              \
                                    6
    #define UDMA_SEC_CHANNEL_TMR2B_7                                              \
                                    7
    #define UDMA_SEC_CHANNEL_UART1RX                                              \
                                    8
    #define UDMA_SEC_CHANNEL_UART1TX                                              \
                                    9
    #define UDMA_SEC_CHANNEL_SSI1RX 10
    #define UDMA_SEC_CHANNEL_SSI1TX 11
    #define UDMA_SEC_CHANNEL_UART2RX_12                                           \
                                    12
    #define UDMA_SEC_CHANNEL_UART2TX_13                                           \
                                    13
    #define UDMA_SEC_CHANNEL_TMR2A_14                                             \
                                    14
    #define UDMA_SEC_CHANNEL_TMR2B_15                                             \
                                    15
    #define UDMA_SEC_CHANNEL_TMR1A  18
    #define UDMA_SEC_CHANNEL_TMR1B  19
    #define UDMA_SEC_CHANNEL_EPI0RX 20
    #define UDMA_SEC_CHANNEL_EPI0TX 21
    #define UDMA_SEC_CHANNEL_ADC10  24
    #define UDMA_SEC_CHANNEL_ADC11  25
    #define UDMA_SEC_CHANNEL_ADC12  26
    #define UDMA_SEC_CHANNEL_ADC13  27
    #define UDMA_SEC_CHANNEL_SW     30
    

    Are for backwards compatibility. Below them are definitions like this:

    //*****************************************************************************
    //
    // Values that can be passed to uDMAChannelAssign() to select peripheral
    // mapping for each channel.  The channels named RESERVED may be assigned
    // to a peripheral in future parts.
    //
    //*****************************************************************************
    //
    // Channel 0
    //
    #define UDMA_CH0_USB0EP1RX          0x00000000
    #define UDMA_CH0_UART2RX            0x00010000
    #define UDMA_CH0_RESERVED2          0x00020000
    #define UDMA_CH0_TIMER4A            0x00030000
    #define UDMA_CH0_RESERVED4          0x00040000
    #define UDMA_CH0_RESERVED5          0x00050000
    #define UDMA_CH0_I2C0RX             0x00060000
    #define UDMA_CH0_RESERVED7          0x00070000
    #define UDMA_CH0_RESERVED8          0x00080000
    
    //
    // Channel 1
    //
    #define UDMA_CH1_USB0EP1TX          0x00000001
    #define UDMA_CH1_UART2TX            0x00010001
    #define UDMA_CH1_RESERVED2          0x00020001
    #define UDMA_CH1_TIMER4B            0x00030001
    #define UDMA_CH1_RESERVED4          0x00040001
    #define UDMA_CH1_RESERVED5          0x00050001
    #define UDMA_CH1_I2C0TX             0x00060001
    #define UDMA_CH1_RESERVED7          0x00070001
    #define UDMA_CH1_RESERVED8          0x00080001
    
    //
    // Channel 2
    //
    

    and so on through Channel 31.

    These definitions have both the "row" and "column" embedded in them and can be passed to the various uDMA APIs, though it is necessary to make the additional uDMAChannelAssign() call first, when using these.

    Each API contains code like this:

        //
        // In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
        // passed as the ui32ChannelNum parameter, extract just the channel number
        // from this parameter.
        //
        ui32ChannelNum &= 0x1f;
    

    To split that single definition into its row and column components. (I'm speaking of the row and column of Table 9-1 in the TM4C129ENCPDT device datasheet.)

    Therefore it is not necessary to add any more definitions. However it would be nice if the documentation could state the above more explicitly.

  • Thanks twelve12pm,

    That is an excellent suggestion. I see in the TivaWare library source that the upper bits of the channel number are cleared allowing the uDMAChannelAssign definitions to be used.

        ui32ChannelNum &= 0x1f;