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.

UART3 TM4C123 PROBLEM

Other Parts Discussed in Thread: EK-TM4C123GXL, TM4C123FH6PM, CCSTUDIO

Hi Ti community,

first thanks for advices that helped me to designed my custom board.

I used TIVA EK-TM4C123GXL as debugger, with CCS V5.4, and in custom board I used TM4C123FH6PMI.

I programmed some code like Blinker and channel 0 uart. all of them work very well.

now I tried to use uart3 in port C PIN6 and 7. but it doesn't work, it doesn't send anything. I wrote simple code exactly like channel 0 but it doesn't work.

this is my first codes with TI microcontrollers excuse me if my questions are so amateur.

channel 0 working code:

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
int main(void) {
	SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
			(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
					UART_CONFIG_PAR_NONE));

	UARTEnable(UART0_BASE);

	while (1)
	{
		UARTCharPut(UART0_BASE, 'H');
		UARTCharPut(UART0_BASE, 'i');
		SysCtlDelay(2000000);
	}
}

and this is channel 3 non working code:

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
int main(void) {
	SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
	GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);

	UARTConfigSetExpClk(UART3_BASE, SysCtlClockGet(), 115200,
			(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
					UART_CONFIG_PAR_NONE));

	UARTEnable(UART3_BASE);

	while (1) 
	{
		UARTCharPut(UART3_BASE, 'H');
		UARTCharPut(UART3_BASE, 'i');
		SysCtlDelay(2000000);
	}
}

I should say I checked connections very well and all connection are ok.

  • Hello Siyavashi,

    If you check the data sheet, the PCTL for UART0 is configured by default. However for other UARTs the GPIOPinConfigure function needs to be called with the define for UART3 Pins

    GPIOPinConfigure(GPIO_PC6_U3RX);
    GPIOPinConfigure(GPIO_PC7_U3TX);

    Regards
    Amit
  • Poster here - and all others - should beware of this unwanted/unsuspected, UART0, "gotcha."

    Some here have been bit critical of employing, "Specially handled/treated" MCU pins as, "Code Examples." Few would have the awareness to "dig deeper" - and deviate - from what's presented as an "example." At the minimum - if & when such pins are chosen w/in examples - a warning should attach notifying (hapless) new users of the "extra efforts" required to harness any "Non-Special, MCU pin."

    Poster should be commended for thanking others - rather rare - and builds good karma throughout this hallowed ground...
  • Hi Amit,

    Really thanks for reply, I used this define it has error, I checked it again but errors occured again:

    this is the error: #20 identifier "GPIO_PC6_U3RX" is undefined

    I do every things that told in Launchpad workshop video.

    1:I added this directory to include search pad "${PROJECT_ROOT}/../../../../" 

    2.also "${PROJECT_ROOT}/../../../../driverlib/ccs/Debug/driverlib.lib" to include library files

    thanks.

  • Hello Siyavash

    Can you please paste the compilation log from CCS for this mainc?

    Regards
    Amit
  • Hi Amit i didn't understand what is compilation log exactly but ithink this is compilation log:


    **** Build of configuration Debug for project GSM_Server ****

    "C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
    'Building file: ../main.c'
    'Invoking: ARM Compiler'
    "C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path="C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --include_path="C:/ti/TivaWare_C_Series-1.1/" -g --diag_warning=225 --display_error_number --diag_wrap=off --preproc_with_compile --preproc_dependency="main.pp" "../main.c"
    "../main.c", line 17: error #20: identifier "GPIO_PC6_U3RX" is undefined
    "../main.c", line 18: error #20: identifier "GPIO_PC7_U3TX" is undefined

    >> Compilation failure
    2 errors detected in the compilation of "../main.c".
    gmake: *** [main.obj] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    also I attached project screen shot here:

  • Hello Siyavash,

    Please change the TivaWare version. You are using 1.1 which may not have the defines at all. The latest version to download and install is 2.1.71

    Regards
    Amit
  • Another option would be to include the setup in the examples and note they are redundant for special cases but necessary in general.

    Robert
  • Hello Amit thank you for fast replays ,

    I tried new project with new setting, I don't know the way that I used for changing TivaWare is it correct or not but I have same problem again:

    this is results:


    **** Build of configuration Debug for project testTivaWare2-1 ****

    "C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
    'Building file: ../main.c'
    'Invoking: ARM Compiler'
    "C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path="C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --include_path="C:/ti/TivaWare_C_Series-2.1.1.71/" -g --diag_warning=225 --display_error_number --diag_wrap=off --preproc_with_compile --preproc_dependency="main.pp" "../main.c"
    "../main.c", line 17: error #20: identifier "GPIO_PC6_U3RX" is undefined
    "../main.c", line 18: error #20: identifier "GPIO_PC7_U3TX" is undefined

    >> Compilation failure
    2 errors detected in the compilation of "../main.c".
    gmake: *** [main.obj] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    and this is screen shot:

    all the best,

    Siyavash

  • Hello Siyavash,

    The define for TARGET_IS_TM4C123_RB1 and PART_TM4C123FH6PM is missing as well.

    Regards,
    Amit
  • could you explain what I should to do exactly?
    excuse me I am beginner.
  • Hello Amit,

    Could you explain what I should to do exactly?

    excuse me I am beginner.

    best regards.

  • Hello Siyavash

    In CCS right click the project, go to "Show Build Settings". The go to Build -> ARM Compiler -> Advanced Options -> Predefined Symbols. Add the two defines in the box for pre define name

    Regards
    Amit
  • Hello Amit,
    I am wonder working with CCStudio is so hard for beginner like me. I worked with atmel studio, KEIL, Atmel Studio and … before but working with CCStudio is really hard for me. Maybe because I don’t work with ECLIPS before.
    I added “GPIO_PC6_U3RX” and “GPIO_PC7_U3TX” but now I have 6 new errors. 
    This is compilation log:

    **** Build of configuration Debug for project testTivaWare2-1 ****

    "C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
    'Building target: testTivaWare2-1.out'
    'Invoking: ARM Linker'
    "C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --define=GPIO_PC6_U3RX --define=GPIO_PC7_U3TX --diag_warning=225 --display_error_number --diag_wrap=off -z -m"testTivaWare2-1.map" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/lib" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="testTivaWare2-1_linkInfo.xml" --rom_model -o "testTivaWare2-1.out" "./tm4c123fh6pm_startup_ccs.obj" "./main.obj" "../tm4c123fh6pm.cmd" -l"libc.a" -l"C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib"
    <Linking>
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<gpio.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<interrupt.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files

    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<sysctl.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    >> Compilation failure
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<uart.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<cpu.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    warning #10210-D: creating ".stack" section with default size of 0x800; use the -stack option to change the default size
    error #10010: errors encountered during linking; "testTivaWare2-1.out" not built
    gmake: *** [testTivaWare2-1.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****
  • Hello Siyavash

    You have put the wrong defines. I asked to put the define for PART_TM4C123FH6PM and TARGET_IS_TM4C123_RB1.

    Also it would be simpler if you can import an existing example like hello and use that as a reference for developing the code. That way all environment issues shall be taken care of.

    Regards
    Amit
  • Hello Amit,

    I correct it, I attached what I did:

     

    as you see in the picture it has 6 errors.


    **** Build of configuration Debug for project testTivaWare2-1 ****

    "C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
    'Building target: testTivaWare2-1.out'
    'Invoking: ARM Linker'
    "C:/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --define=PART_TM4C123FH6PM --define=TARGET_IS_TM4C123_RB1 --diag_warning=225 --display_error_number --diag_wrap=off -z -m"testTivaWare2-1.map" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/lib" -i"C:/ti/ccsv5/tools/compiler/arm_5.1.1/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="testTivaWare2-1_linkInfo.xml" --rom_model -o "testTivaWare2-1.out" "./tm4c123fh6pm_startup_ccs.obj" "./main.obj" "../tm4c123fh6pm.cmd" -l"libc.a" -l"C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib"
    <Linking>
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<gpio.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files

    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<interrupt.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    >> Compilation failure
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<sysctl.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<uart.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    error #16004-D: file "C:/ti/TivaWare_C_Series-2.1.1.71/examples/boards/ek-tm4c123gxl/testTivaWare2-1/../../../../driverlib/ccs/Debug/driverlib.lib<cpu.obj>" has a Tag_PCS_config attribute value of "1" that is different than one previously seen ("0"); combining incompatible files
    warning #10210-D: creating ".stack" section with default size of 0x800; use the -stack option to change the default size
    error #10010: errors encountered during linking; "testTivaWare2-1.out" not built
    gmake: *** [testTivaWare2-1.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    about import when I tried import an exaple of TIvaWare2.1 this error occurred:

  • Hi Robert,

    Our plea lands somewhere (surely not here) and you/I are in agreement...
  • Hello Amit,

    my problem solved with this way:

    I changed TivaWare version and I used version 2.0.1 instead of v2.1 and I did what you said and now the program work correctly, I don't know why I can't work with V2.1 .

    Really thanks for replays, I think TI has best community and this is the reason that I migrate from other ARMs to TI ARM,

    best regards,

    Siyavash.

  • Hello Siyavash

    I did see some paths in the TivaWare installation (when you pasted compile logs) that will not be there if correctly installed. Also do note that 2.0.1 is more buggy that 2.1.1.

    Regards
    Amit