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-TM4C1294XL: Software to UART uDMA transfere

Part Number: EK-TM4C1294XL

Hi Foks,

I want to redesign my solution to send and receive packages trough UART between two TM4C devices. Belonging that I have two questions:

  1. the CPUs datasheet only use term "channel number", but some API functions from the periphery driver library expect defines that contains a name of a periphery, like: #define UDMA_CHANNEL_UART0TX    9 Which is confused my. These defines doesn't contain UART 3 or 7. How can I imagine a uDMA channel? For me, a channel has two end, from the API functions, it seems that these constants declare the end A, while the 5 possibilities the end B.
  2. How can I perform uDMA receive for arbitrary number of bytes from an UART periphery, where I don't know the exact size of the next package?

Regards,

Norbert

  • Hello Norbert,

    For question 1, you should refer to Section 9.2.1 Channel Assignments of the device datasheet. In this section, Table 9-1 lists all uDMA channel assignments. UART3 is on Channels 16 & 17 for RX/TX respectively and UART7 is on Channels 20 & 21 for RX/TX respectively.

    Then within the udma.h header file in the driverlib folder, you will find the following defines:

    #define UDMA_CH16_UART3RX           0x00020010
    #define UDMA_CH17_UART3TX           0x00020011
    
    and
    
    #define UDMA_CH20_UART7RX           0x00020014
    #define UDMA_CH21_UART7TX           0x00020015
    

    Which you can use for your code, so the defines are there, you just have to dig a little deeper.

    I hope seeing the combination of the table on 9.1 and now seeing more #define's will clear up by the driver library contains the peripheral name as well.

    As far as question 2 goes, that seems to be a bit of strange request on the surface, but perhaps you have more details to offer? If the MCU doesn't know how many bytes to receive, then my question would be, how should it know when to stop? What is your plan for indicating to the MCU that the RX should be over with? Would there be a packet size transferred at some point during the message? An 'end of receive' byte/sequence being sent?

  • Hi Ralph,

    thank you for the reply of the first question, now it is clear for me.
    About the second one:
    I wanted to implement a vanilla Modbus RTU stack. As the standards say, there is no "pdu size" field, so now I have to compute the expected size during receiving the PDU.
    That was the point that I wanted to replace by DMA transfer somehow, without knowing the exact size of the incoming request

    Regards,
    Norbert
  • Is it true that, "No clear, "Termination character/byte" appears w/in "Modbus?"

    Should that, "prove the case" - might you, "Append (add) such a terminating char. to the packet" - prior to its transmission?      This assumes that you, "Have the capability to "do such" - which may not prove the case.
    Your receive-side would be programmed - first to recognize - then react to - the "presence" of this unique "terminating char."

    You write,  "have to compute the "expected size" during receive" - yet it is "unclear" as to  "How (any) such "expectation" is to be known and/or created!

  • Hello Norbert,

    As cb1 stated, if there really is no packet size or terminating character/characteristics, then you will need to implement one or the other yourself. Which method you ultimately decide to use is up to you, but you definitely need some way for the MCU to know when to stop receiving. I can't think of any implementation where you can get away without that basic knowledge.