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.

TM4C123G UART1 flow control

Other Parts Discussed in Thread: TM4C123GH6PGE

Hi,

It seems that UART1 offers hardware flow control RTS/CTS, but this is not supported in the Driver Library (2.1.0). Is this right? Is it safe to assume it defaults to "flow control off"?

Thanks

Richard

  • Hello Richard

    By default the flow control is disabled and has to be enabled using the driverlib calls in uart.c/.h file e.g. below

    UARTFlowControlSet (amongst others).

    You would need to ensure that the GPIO's for RTS and CTS are configured as UART pins.

    Regards

    Amit

  • Appears there's more usable detail for you w/in MCU manual - UART Chapter - specifically "Modem Handshaking Control, Signaling, and Flow Control."  One paragraph describes, "Software Flow Control" - using Modem Status Interrupts. 

    I'm unsure if much of this needed detail made it into the API - description seems sufficient to get you going - and then famed, "trial & error" aka "crash & burn" should get you (almost) on the Air!

  • Thanks for replies both.

    Amit, the UARTFlowControlSet() is only defined for the TM4C129. From rom.h (v2.1.0.12573)....

    #if defined(TARGET_IS_TM4C129_RA0) ||                                         \
        defined(TARGET_IS_TM4C129_RA1)
    #define ROM_UARTFlowControlGet                                                \
            ((uint32_t (*)(uint32_t ui32Base))ROM_UARTTABLE[43])
    #endif

    Richard

  • Hello Richard,

    is it mandatory to use the rom function? Because i checked up on both, the datasheets of TM4C123GH6PGE and TM4C123GE6PM and in both datasheets it states that, hardware-wise, the UART1 is capable of using Flow Control. Sadly you didn't state which exact Mikrocontroller you are using.

    Also in the Driver Library the setup function seems perfectly available for the TM4C123x - Devices. Here is the quote from uart.c from the Driver Library 2.1.0.12573:

    //*****************************************************************************
    //
    //! Sets the UART hardware flow control mode to be used.
    //!
    //! \param ui32Base is the base address of the UART port.
    //! \param ui32Mode indicates the flow control modes to be used.  This
    //! parameter is a logical OR combination of values \b UART_FLOWCONTROL_TX and
    //! \b UART_FLOWCONTROL_RX to enable hardware transmit (CTS) and receive (RTS)
    //! flow control or \b UART_FLOWCONTROL_NONE to disable hardware flow control.
    //!
    //! This function configures the required hardware flow control modes.  If
    //! \e ui32Mode contains flag \b UART_FLOWCONTROL_TX, data is only transmitted
    //! if the incoming CTS signal is asserted.  If \e ui32Mode contains flag
    //! \b UART_FLOWCONTROL_RX, the RTS output is controlled by the hardware and is
    //! asserted only when there is space available in the receive FIFO.  If no
    //! hardware flow control is required, \b UART_FLOWCONTROL_NONE should be
    //! passed.
    //!
    //! \note The availability of hardware flow control varies with the Tiva
    //! part and UART in use.  Please consult the datasheet for the part you are
    //! using to determine whether this support is available.
    //!
    //! \return None.
    //
    //*****************************************************************************
    void
    UARTFlowControlSet(uint32_t ui32Base, uint32_t ui32Mode)
    {
        //
        // Check the arguments.
        //
        ASSERT(_UARTBaseValid(ui32Base));
        ASSERT((ui32Mode & ~(UART_FLOWCONTROL_TX | UART_FLOWCONTROL_RX)) == 0);
    
        //
        // Set the flow control mode as requested.
        //
        HWREG(ui32Base + UART_O_CTL) = ((HWREG(ui32Base + UART_O_CTL) &
                                         ~(UART_FLOWCONTROL_TX |
                                           UART_FLOWCONTROL_RX)) | ui32Mode);
    }

    If it is mandatory to use the ROM-Function, just write the few registers with ROM-Access. CTS and RTS Enable-Bits should be available on the UARTCTL-register.


    Sincerely,

    Michel

     

  • Thanks for this Michel. I only use the ROM libraries because I have never been able to make the linker find the software libraries! I have #include "driverlib/uart.h" in this file, and I can see uart.c in the library, but I always get

      undefined          first referenced
      symbol                in file     
     ---------          ----------------

    UARTFlowControlSet ./initialise.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "spitfire_dmi.out" not built

    I have tried adding the driverlib path to the linker in project properties too. Some help here would be appreciated!

    Richard

  • Hey Richard,

    well to be completely honest, i have had my share of the pre-compiled library myself. I'm working with Keil MDK and haven't found a way to make the .lib pre-compiled library work. Even though i can choose the .c files to be included in the linker, it just doesn't seem to work. The linker doesn't even seem to include the files or the compiler just ignores them.

    That's why i keep myself an 'include.h' file where i include all necessary .h files from the non-compiled library.

    The non-compiled TivaWare Library Files are to be found in the same folder you can find the pre-compiled libraries for the IDEs. Just use those. If you add the path to these files to your project settings, everything should work just fine.

    EDIT: I want to apologize, i didn't seem to quite understand what the library file actually is. If you include the .lib in your project and select the files to be included per the File Options, everything should work with the .h files included. That way, you won't have to explicitly add all the .c Files to your Project, the .lib will take care of that. Just give me a message if you need help with the setup.

    Sincerely,

     

    Michel

  • Hi Michel,

    I'm using CCS and I find the (Eclipse) Project Properties far from easy to understand or change (I don't think I'm the only one either!).

    I can find ..driverlib\css\debug\driverlib.lib, but I don't understand how to include it in my project.

    Sorry if I'm just being stupid!

    Richard

  • Ah - I just discovered if I change the "Runtime Support Library" setting from "Automatic", to the explicit path to driverlib.lib it works!

    Wow thanks for all your help Michel - much appreciated.

    Best regards

    Richard

  • *cough* Well there's a reason i'm stuck with Keil for now..

    You don't have to set the explicit path though, you can also right-click on the Project Window and "Add Files" to find your .lib.

    That way, you can even see it in your Project and it should include it automatically even without the explicit path in your project settings.

    Sincerely,

     

    Michel

  • So it does! Well I never knew that after all this time programming Tivas. Ha!

    Cheers Michel