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.

Issues on new EK-TM4C1294XL launchpad with ROM_UARTConfigSetExpClk() and ROM_SysCtlClockGet()

Other Parts Discussed in Thread: EK-TM4C1294XL

Hi all.

Probably this is a question for TI stuff, but I think probably the asnwer will be interesting ofr many people.

I am starting to work with the new EK-TM4C1294XL launchpad, trying to port some code from a Tiva TM4C123GXL and I have found some issues with the new libraries (Tivaware 2.1) and silicon (which is a XM4C).

The one about the library, is that the function ROM_SysCtlClockGet() does not exist anymore for this silicon. However the function SysCtlClockGet() is callable. Why?

On the other hand, I have also found that if I call ROM_UARTConfigSetExpClk for setting up the Uart ports, when I try to write on that port, the program get stuck in the line:

    //
    // Wait until space is available.
    //
    while(HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF)
    {
    }


of the function UARTCharPut.

Instead of that, if the uart com port is set with SysCtlClockGet(), everything works fine.

Has this been noticed before?

Thank you

  • Hello PAk,

    On TM4C129 the function pair of SysCtlClockSet and SysCtlClockGet are now replaced by SysCtlClockFreqSet which returns the System Clock. The SysCtlClockGet may be returning a value which is making UART work but is not necessarily correct.

    Could you send the working and not-working code snipper for ROM_UARYConfigSetExpClk and perhaps also try using the return value of the SysCtlClockFreqSet?

    What is the System Clock Frequency you are using for TM4C123 and TM4C129. A code snippet of the same will be useful

    Regards

    Amit

  • Amit Ashara said:

    Could you send the working and not-working code snipper for ROM_UARYConfigSetExpClk and perhaps also try using the return value of the SysCtlClockFreqSet?

    What is the System Clock Frequency you are using for TM4C123 and TM4C129. A code snippet of the same will be useful

    Regards

    Amit

    Thank you Amit. Here is a code snippet. Actually, nothing fancy. 

    As you can see, the only difference is the call for 

    MAP_UARTConfigSetExpClk instead of
    ROM_UARTConfigSetExpClk .

    #include <stdint.h>
    #include <stdbool.h>
    
    
    #include <stdio.h>
    
    
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "inc/hw_uart.h"
    
    #include "driverlib/gpio.h"
    #include "drivers/pinout.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"
    #include "driverlib/uart.h"
    
    #include "driverlib/rom_map.h"
    
    
    
    
    
    
    //*****************************************************************************
    //
    // System clock rate in Hz.
    //
    //*****************************************************************************
    uint32_t g_ui32SysClock;
    
    //*****************************************************************************
    //
    // The error routine that is called if the driver library encounters an error.
    //
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
        {
        }
    #endif
    
    //*****************************************************************************
    //
    // Configure the UART and its pins.  This must be called before UARTprintf().
    //
    //*****************************************************************************
    void ConfigureUART(void)
        {
        //
        // Enable the GPIO Peripheral used by the UART.
        //
        ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA);
    
        //
        // Enable UART0
        //
        ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_UART0);
    
        //
        // Configure GPIO Pins for UART mode.
        //
        ROM_GPIOPinConfigure (GPIO_PA0_U0RX);
        ROM_GPIOPinConfigure (GPIO_PA1_U0TX);
        ROM_GPIOPinTypeUART (GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        //
        // Initialize the UART for console I/O.
        //
        UARTStdioConfig(0, 115200, g_ui32SysClock);
        }
    
    void Setup_COM_port(void)
        {
    
    
        //For UART7
        ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOC);
    
        ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_UART7);
    
        ROM_GPIOPinConfigure (GPIO_PC4_U7RX);
        ROM_GPIOPinConfigure (GPIO_PC5_U7TX);
    
        ROM_GPIOPinTypeUART (GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
    
        //ROM_UARTConfigSetExpClk (UART7_BASE, g_ui32SysClock, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));   - NON_working
        MAP_UARTConfigSetExpClk(UART7_BASE, g_ui32SysClock, 115200,(UART_CONFIG_WLEN_8 |UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
    
    
       
        }
    
    
    void Message_INI_COMaux_UART7()
        {
        
        ROM_UARTCharPut (UART7_BASE, 'U');
        ROM_UARTCharPut (UART7_BASE, 'T');
        ROM_UARTCharPut (UART7_BASE, 'X');
        ROM_UARTCharPut (UART7_BASE, '7');
        ROM_UARTCharPut (UART7_BASE, '\r');
        ROM_UARTCharPut (UART7_BASE, '\n');
        }
    
    
    
    //*****************************************************************************
    //
    // Print "Hello World!" to the UART on the Intelligent UART Module.
    //
    //*****************************************************************************
    int main(void)
        {
        //
        // Run from the PLL at 120 MHz.
        //
        g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
    
    
        //
        // Initialize the UART.
        //
        ConfigureUART();
        
        Setup_COM_port();
    
                
        //
        // Hello!
        //
        UARTprintf("Uart0_TX \n");
    
        Message_INI_COMaux_UART7();
    
    
    
        SysCtlDelay(g_ui32SysClock / 10 / 3);
    
    
        //
        // We are finished.  Hang around .
        //
        while (1)
    	{
    	//Do nothing
    	}
        }
    

  • Hello PAk,

    So when the MAP_ is used, the result is different from ROM_ API call. Is that right? And it works fine when MAP_ is used and hangs if ROM_ is used?

    Also what are the compile time defines you are passing to the Compiler, e.g. PART_IS_TM4C129??

    Regards

    Amit

  • Amit Ashara said:

    So when the MAP_ is used, the result is different from ROM_ API call. Is that right? And it works fine when MAP_ is used and hangs if ROM_ is used?

    Exactly.

    Amit Ashara said:
    Also what are the compile time defines you are passing to the Compiler, e.g. PART_IS_TM4C129??

  • Hello PAk,

    Thanks for the data. Can you check the register SYSCTL.DID0 (0x400FE000). If this register reads 0x100A0000 then I would need to look further why. But if the register reads 0x100A0001 then the TARGET_IS_TM4C129_RA0 should be changed to TARGET_IS_TM4C129_RA1. Even after it does not work let me know and I will check.

    Regards

    Amit

  • The register value is 

    SYSCTL_DID0 0x100A0001 Device Identification 0 [Memory Mapped]

    You were right after changing the define it works.

    Which version of the chip is TARGET_IS_TM4C129_RA0 for then?

    Thank you very much Amit.

  • Hello PAk,

    RA0 is for test version. I was surprised as I have been using the ROM version of the UART and it never gave a problem

    Glad it solved the problem

    Regards

    Amit

  • Thank you Amit.

    Actually it felt quite wrong to see the RA0 option, but I thought the XM4C chip was indeed the test version.

    One last question, what Target option is the required to port our designs to Tivaware 2.1 for a TM4C1236HPM?

    Regards

  • Hello PAk,

    Do check the SYSCTL.DID0 register here as well. if it shows 18050101 then use TARGET_IS_TM4C123_RB1

    Also do take care that some functions between TM4C123 and TM4C129 are not compatible like SysCtlClockSer.

    Regards

    Amit

  • Thank you Amit.

    I think this post will help some people since it is all clear now.

    Regards.

  • Hello Amit,

    I have checked the revision of chip as 0x100A0000.

    I would like to use ROM functions with XM4C129x and GCC 4.8.1.

    I can't find preprocessor "TARGET_IS_TM4C129_RA0 or RA1" in the TivaWare_C_Series-2.0 library.

    Is the preprocessor only for CCS?

  • Hello Kyoman,

    On TIVAWare 2.0 release it is called as TARGET_IS_SNOWFLAKE_RA0. However from 2.1 release onwards we are using TARGET_IS_TM4C129_RA0. I would suggest you to download 2.1 version of the TIVAWare as all upgrades for future products will have this nomencalure

    Regarda

    Amit

  • Thanks for yours advice.

    I will try to migration from 2.0 to 2.1(2.1.0.12573).

    Regards

     

    Kyoman

  • Hello Amit,

    I had successfully migrated from 2.0 to 2.1.

    I have built project with the preprocessor "TARGET_IS_TM4C129_RA0" to use ROM function. and got the executable binary without compling error.

    But, Unfortunately It is not working. Are there another check points other than chip revision?

    Regards

    kyoman

  • Hi Kyoman,

        You can compare preprocessor symbols and other project settings of a working example program to your work and see, what is different.

    -kel

  • kyoman shim said:

    I had successfully migrated from 2.0 to 2.1.

    I have built project with the preprocessor "TARGET_IS_TM4C129_RA0" to use ROM function. and got the executable binary without compling error.

    But, Unfortunately It is not working. Are there another check points other than chip revision?

    As Markel has told you check out the predefined symbols. However, if your running your code on a TM4C Launchpad, you should use TARGET_IS_TM4C129_RA1

    Regards

  • Hello Kyoman,

    Can you be more precise on what exactly is not working, even though compilation is clean?

    A code post for reference would be useful.

    Regards

    Amit

  • Hello Kei,

    Thanks for your advice.

    I found that there are bugs in my test code and fixed it.

    Now, It works fine.

    Regards

    Kyoman