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.

TM4C1294XL Uart3/Uart4 Not Working

Other Parts Discussed in Thread: TM4C1294NCPDT, EK-TM4C1294XL

Hello,

In TM4C1294XL Board, Uart0 is working fine through the debug interface. But, if I try the same codes through UART3 or UART4, Transmission is fine but the Receive Interrupt Is not generated. Please help!!!

My Code is Shown Below:

#define PART_TM4C1294NCPDT
#define BaudRate 9600
#define GPSDataBufferSize 128


#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"

uint32_t g_ui32SysClock;

uint8_t  receive_data[GPSDataBufferSize];
uint8_t data_pointer=0;

void UARTIntHandler(void)
{
    uint32_t ui32Status;
    uint8_t temp;

    // Get the interrrupt status.
    ui32Status = ROM_UARTIntStatus(UART3_BASE, true);

    // Clear the asserted interrupts.
    ROM_UARTIntClear(UART3_BASE, ui32Status);

    // Loop while there are characters in the receive FIFO.
    while (ROM_UARTCharsAvail(UART3_BASE))
    {
    	temp=ROM_UARTCharGet(UART3_BASE);
        receive_data[ data_pointer]=temp;
        data_pointer++;
    }
    //End of UART Handler -------------------------
}

void Uart3_send(char *send_string)
{
    uint8_t temp;

    for(temp=0;send_string[temp] !=0;temp++)
    {
        UARTCharPut(UART3_BASE,send_string[temp]);
    }
}

int main(void)
{
     // Set the clocking to run directly from the crystal at 120MHz.
     g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                              SYSCTL_OSC_MAIN |
                                              SYSCTL_USE_PLL |
                                              SYSCTL_CFG_VCO_480), 120000000);

    // Enable the peripherals used by this example.
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
    // Configure the UART for baudrate, 8-N-1 operation.
    UARTConfigSetExpClk(UART3_BASE, g_ui32SysClock, BaudRate,
	               (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
	                UART_CONFIG_PAR_NONE));
    UARTEnable(UART3_BASE);
    // Enable the UART interrupt.
    IntEnable(INT_UART3);
    UARTFIFOLevelSet(UART3_BASE, UART_FIFO_TX7_8, UART_FIFO_RX1_8);
    UARTFIFOEnable(UART3_BASE);
    UARTIntEnable(UART3_BASE,UART_INT_RX);
    IntPrioritySet(INT_UART3,0X80);
    

    Uart3_send("Test String....\r\n");
    // Loop forever
    for( ; ; )
    {
        Sleep();
    }
}

void Sleep(void)
{
   SysCtlSleep();
}

My startup_ccs.c file is also attached herewith:

#include <stdint.h>
#include "inc/hw_nvic.h"
#include "inc/hw_types.h"

//*****************************************************************************
//
// Forward declaration of the default fault handlers.
//
//*****************************************************************************
void ResetISR(void);
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);

//*****************************************************************************
//
// External declaration for the reset handler that is to be called when the
// processor is started
//
//*****************************************************************************
extern void _c_int00(void);

//*****************************************************************************
//
// Linker variable that marks the top of the stack.
//
//*****************************************************************************
extern uint32_t __STACK_TOP;

//
// External declaration for the interrupt handler used by the application.
//
//*****************************************************************************
extern void WatchdogIntHandler(void);
//Add other interrupts here...
extern void UARTIntHandler(void);

//*****************************************************************************
//
// The vector table.  Note that the proper constructs must be placed on this to
// ensure that it ends up at physical address 0x0000.0000 or at the start of
// the program if located at a start address other than 0.
//
//*****************************************************************************
#pragma DATA_SECTION(g_pfnVectors, ".intvecs")
void (* const g_pfnVectors[])(void) =
{
    (void (*)(void))((uint32_t)&__STACK_TOP),
                                            // The initial stack pointer
    ResetISR,                               // The reset handler
    NmiSR,                                  // The NMI handler
    FaultISR,                               // The hard fault handler
    IntDefaultHandler,                      // The MPU fault handler
    IntDefaultHandler,                      // The bus fault handler
    IntDefaultHandler,                      // The usage fault handler
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // SVCall handler
    IntDefaultHandler,                      // Debug monitor handler
    0,                                      // Reserved
    IntDefaultHandler,                      // The PendSV handler
    IntDefaultHandler,                      // The SysTick handler
    IntDefaultHandler,                      // GPIO Port A
    IntDefaultHandler,                      // GPIO Port B
    IntDefaultHandler,                      // GPIO Port C
    IntDefaultHandler,                      // GPIO Port D
    IntDefaultHandler,                      // GPIO Port E
    IntDefaultHandler,                      // UART0 Rx and Tx
    IntDefaultHandler,                      // UART1 Rx and Tx
    IntDefaultHandler,                      // SSI0 Rx and Tx
    IntDefaultHandler,                      // I2C0 Master and Slave
    IntDefaultHandler,                      // PWM Fault
    IntDefaultHandler,                      // PWM Generator 0
    IntDefaultHandler,                      // PWM Generator 1
    IntDefaultHandler,                      // PWM Generator 2
    IntDefaultHandler,                      // Quadrature Encoder 0
    IntDefaultHandler,                      // ADC Sequence 0
    IntDefaultHandler,                      // ADC Sequence 1
    IntDefaultHandler,                      // ADC Sequence 2
    IntDefaultHandler,                      // ADC Sequence 3
    WatchdogIntHandler,                      // Watchdog timer
    IntDefaultHandler,                      // Timer 0 subtimer A
    IntDefaultHandler,                      // Timer 0 subtimer B
    IntDefaultHandler,                      // Timer 1 subtimer A
    IntDefaultHandler,                      // Timer 1 subtimer B
    IntDefaultHandler,                      // Timer 2 subtimer A
    IntDefaultHandler,                      // Timer 2 subtimer B
    IntDefaultHandler,                      // Analog Comparator 0
    IntDefaultHandler,                      // Analog Comparator 1
    IntDefaultHandler,                      // Analog Comparator 2
    IntDefaultHandler,                      // System Control (PLL, OSC, BO)
    IntDefaultHandler,                      // FLASH Control
    IntDefaultHandler,                      // GPIO Port F
    IntDefaultHandler,                      // GPIO Port G
    IntDefaultHandler,                      // GPIO Port H
    IntDefaultHandler,                      // UART2 Rx and Tx
    IntDefaultHandler,                      // SSI1 Rx and Tx
    IntDefaultHandler,                      // Timer 3 subtimer A
    IntDefaultHandler,                      // Timer 3 subtimer B
    IntDefaultHandler,                      // I2C1 Master and Slave
    IntDefaultHandler,                      // Quadrature Encoder 1
    IntDefaultHandler,                      // CAN0
    IntDefaultHandler,                      // CAN1
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // Hibernate
    IntDefaultHandler,                      // USB0
    IntDefaultHandler,                      // PWM Generator 3
    IntDefaultHandler,                      // uDMA Software Transfer
    IntDefaultHandler,                      // uDMA Error
    IntDefaultHandler,                      // ADC1 Sequence 0
    IntDefaultHandler,                      // ADC1 Sequence 1
    IntDefaultHandler,                      // ADC1 Sequence 2
    IntDefaultHandler,                      // ADC1 Sequence 3
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // GPIO Port J
    IntDefaultHandler,                      // GPIO Port K
    IntDefaultHandler,                      // GPIO Port L
    IntDefaultHandler,                      // SSI2 Rx and Tx
    IntDefaultHandler,                      // SSI3 Rx and Tx
    UARTIntHandler,                         // UART3 Rx and Tx
    IntDefaultHandler,                      // UART4 Rx and Tx
    IntDefaultHandler,                      // UART5 Rx and Tx
    IntDefaultHandler,                      // UART6 Rx and Tx
    IntDefaultHandler,                      // UART7 Rx and Tx
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // I2C2 Master and Slave
    IntDefaultHandler,                      // I2C3 Master and Slave
    IntDefaultHandler,                      // Timer 4 subtimer A
    IntDefaultHandler,                      // Timer 4 subtimer B
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // Timer 5 subtimer A
    IntDefaultHandler,                      // Timer 5 subtimer B
    IntDefaultHandler,                      // Wide Timer 0 subtimer A
    IntDefaultHandler,                      // Wide Timer 0 subtimer B
    IntDefaultHandler,                      // Wide Timer 1 subtimer A
    IntDefaultHandler,                      // Wide Timer 1 subtimer B
    IntDefaultHandler,                      // Wide Timer 2 subtimer A
    IntDefaultHandler,                      // Wide Timer 2 subtimer B
    IntDefaultHandler,                      // Wide Timer 3 subtimer A
    IntDefaultHandler,                      // Wide Timer 3 subtimer B
    IntDefaultHandler,                      // Wide Timer 4 subtimer A
    IntDefaultHandler,                      // Wide Timer 4 subtimer B
    IntDefaultHandler,                      // Wide Timer 5 subtimer A
    IntDefaultHandler,                      // Wide Timer 5 subtimer B
    IntDefaultHandler,                      // FPU
    IntDefaultHandler,                      // PECI 0
    IntDefaultHandler,                      // LPC 0
    IntDefaultHandler,                      // I2C4 Master and Slave
    IntDefaultHandler,                      // I2C5 Master and Slave
    IntDefaultHandler,                      // GPIO Port M
    IntDefaultHandler,                      // GPIO Port N
    IntDefaultHandler,                      // Quadrature Encoder 2
    IntDefaultHandler,                      // Fan 0
    0,                                      // Reserved
    IntDefaultHandler,                      // GPIO Port P (Summary or P0)
    IntDefaultHandler,                      // GPIO Port P1
    IntDefaultHandler,                      // GPIO Port P2
    IntDefaultHandler,                      // GPIO Port P3
    IntDefaultHandler,                      // GPIO Port P4
    IntDefaultHandler,                      // GPIO Port P5
    IntDefaultHandler,                      // GPIO Port P6
    IntDefaultHandler,                      // GPIO Port P7
    IntDefaultHandler,                      // GPIO Port Q (Summary or Q0)
    IntDefaultHandler,                      // GPIO Port Q1
    IntDefaultHandler,                      // GPIO Port Q2
    IntDefaultHandler,                      // GPIO Port Q3
    IntDefaultHandler,                      // GPIO Port Q4
    IntDefaultHandler,                      // GPIO Port Q5
    IntDefaultHandler,                      // GPIO Port Q6
    IntDefaultHandler,                      // GPIO Port Q7
    IntDefaultHandler,                      // GPIO Port R
    IntDefaultHandler,                      // GPIO Port S
    IntDefaultHandler,                      // PWM 1 Generator 0
    IntDefaultHandler,                      // PWM 1 Generator 1
    IntDefaultHandler,                      // PWM 1 Generator 2
    IntDefaultHandler,                      // PWM 1 Generator 3
    IntDefaultHandler                       // PWM 1 Fault
};

//*****************************************************************************
//
// This is the code that gets called when the processor first starts execution
// following a reset event.  Only the absolutely necessary set is performed,
// after which the application supplied entry() routine is called.  Any fancy
// actions (such as making decisions based on the reset cause register, and
// resetting the bits in that register) are left solely in the hands of the
// application.
//
//*****************************************************************************
void
ResetISR(void)
{
    //
    // Jump to the CCS C initialization routine.  This will enable the
    // floating-point unit as well, so that does not need to be done here.
    //
    __asm("    .global _c_int00\n"
          "    b.w     _c_int00");
}

//*****************************************************************************
//
// This is the code that gets called when the processor receives a NMI.  This
// simply enters an infinite loop, preserving the system state for examination
// by a debugger.
//
//*****************************************************************************
static void
NmiSR(void)
{
    //
    // Enter an infinite loop.
    //
    while(1)
    {
    }
}

//*****************************************************************************
//
// This is the code that gets called when the processor receives a fault
// interrupt.  This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
FaultISR(void)
{
    //
    // Enter an infinite loop.
    //
    while(1)
    {
    }
}

//*****************************************************************************
//
// This is the code that gets called when the processor receives an unexpected
// interrupt.  This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
IntDefaultHandler(void)
{
    //
    // Go into an infinite loop.
    //
    while(1)
    {
    }
}

Thanks in Advance.

Regards,

Girish.

  • Hello Girish.

    Please search the forum post with the keyword "uart5_rxinterrupt.zip"

    It is 9 posts from this one.

    Regards
    Amit
  • Dear Amit,
    Was it for the same controller or some other? The search does not yield any results except the present post. If I just give uart5 all other forum questions pop up, but in the present forum too, I don't find the post you refer to. Kindly share the link of the post...
    Regards,
    Girish.
  • Hello Girish,

    Search your own post. Anyways, I have attached the project I used again along with the instructions

    I modified my EK-TM4C1294XL connected launchpad, to connect the UART5 pins to the ICDI com port by removing the resistors R6 and R7 and then wiring PC6 to RXD and PC7 to TXD (on X1 connector). Then  I used a COM port to write bytes and echo them back to the COM port under interrupt control. It works.

    8738.UART5_RxInterrupt.zip

    Regards

    Amit

  • Hello Amit,
    I am thoroughly confused. I am not able get the output, though I changed 3 pieces of my USB?Uart Converter from Three different manufacturers. But none of this works. I am really going crazy!!!
    Girish.
  • Hello Girish,

    Did you use the project I attached with the modifications suggested for EK-TM4C1294XL?

    Regards
    Amit
  • Hello amit,
    Now I have shorted PC6 and PC7 using a jumper. No other USB/UART Interface is on board. I am just sending a sting through Uart Tx pin and still the Receive interrupt is not triggering. What do I do Now?
    Girish.
  • Yes Amit, I am using your code itself...
  • Hello Girish

    Please attach a snapshot of your board with the connections.

    Regards
    Amit
  • Dear Amit,

    Here is the snapshot:

    Girish.

  • Hello Girish,

    Please read my instructions provided earlier

    "I modified my EK-TM4C1294XL connected launchpad, to connect the UART5 pins to the ICDI com port by removing the resistors R6 and R7 and then wiring PC6 to RXD and PC7 to TXD (on X1 connector). Then I used a COM port to write bytes and echo them back to the COM port under interrupt control. It works."

    Regards
    Amit
  • Dea Amit,

    The point I wish to make here is that , this present application what I am designing is a high precision GPS distance gauge and for this we are inputting the DGPS data through one of the Uarts and further analysing the data as per our requirement. The reason for my choice of TM4C1294 is its 8 uarts, High speed 120Mhz and an independent FPU. The reason why I shorted TX and Rx of the UART is that, if at all; there is some voltage level differences in the High/low state definitions between the UART/USB modules and the device, this shorting of the Tx and Rx pins should match the level requirements of the device and this should work. If this only does not trigger the receive interrupt, how can we expect the stellaris ICDI Driver  to match the levels?  In case, even if this is possible and the echo program does work with ICDI Com, Please tell me, my requirement is about 3000 units of this proposed deigned units. You do not supply the Stellaris ICDI Drivers and so, even in case the ICDI com does work, what purpose does it serve? it only proves the point in academic interests. If the Uarts themselves does not work, why should I go for this? I even got two more launch pads today and tried in those too.... The code does not work. If I cannot have an uart that communicates with its peripherals, and only speaks to the ICDI driver, of what purpose is the same for my application? Please do suggest some methods that can  reduce my development time. Dear friend, I am running out of my development schedules and I cannot project troubleshooting the uart as a reason for the delay in delivering my design. Please understand my situation and help me out of the same.

    Regards,

    Girish.

  • Hello Girish,

    In the sample project, i wanted to prove beyond reason of doubt that there is no issue in UART5 receive interrupts. The code you had sent was not working on my machine as I could not import it, so I ended up creating a project for you that you could use to verify that your board is working as expected. To do so we baseline a known board with the program and then move it to the custom board.

    What ever be your project, I will try to get your code ported over on Monday/

    Regards
    Amit
  • Hello Amit,

    Sorry, I was a little bit overly frustrated yesterday. I sincerely appreciate your efforts and attached herewith is the code you had sent, that's programmed to the board and connected through ICDI. But Still there is no output.

    Regards,

    Girish.

  • Hello Girish,

    There is a R6 and R7 resistor just next to where the 3.3V connection is made. Remove them and connect PC6 to the pin marked RXD and PC7 to ping marked TXD. Then use a COM port with the ICDI (and not the USB to UART converter).

    Regards
    Amit
  • Dear Amit,
    Please refer to Sheet 6/6 of schematic in Tiva™ C Series TM4C1294 Connected LaunchPad Evaluation Kit EK-TM4C1294XL User's Guide. Here R6 connects VCP_RXD and TARGET_TXD/2.5D, also R7 connects VCP_TXD and TARGET_RXD/2.5D. Instead of removing R6 and R7, I have removed the jumpers JP4 and JP5 (Pins 1 and 2) given in Sheet 2/6. This isolates the ICDI from the PA0 and PA1 of the Controller IC U1 TM4C1294NCPDT. Now from TARGET_RXD/6.1D, I have connected a jumper toX8.9 of Booster Pack1. Also TARGET_TXD/6.1D is connected to X8.15 of Booster Pack-1. This is nothing but connecting these points to RXD and TXD after removing R6 and R7 isin't it? This is just a simpler way.

    Regards,
    Girish.
  • Hello Girish

    Yes, that would work as well, (I had a board with the modifications). And still the project I sent to you does not work with the ICDI COM port?

    I am at a loss here. Let me try your code on Monday.

    Regards
    Amit
  • Dear Amit,
    No Probs... Carry on with your Weekend. Lets continue on Monday. Have a great weekend.
    Bye.
    Girish.
  • Hello Girish

    I had to manually port over the code and I found the following issues in your code

    1. The GPIO pins for UART5 are not configured. They are still set for UART3.
    2. You are using Sleep Mode. In sleep mode if the clock to the peripheral needs to be used then SysCtlPeripheralSleepEnable needs to be used
    3. The interrupt handler for UART5 is not being called because it seems that it is mapped to the wrong interrupt vector location.

    Regards
    Amit
  • Dear Amit,

    My dear friend,Forget all those code that were sent in half confused state. My code is working now as per requirement. It has started working just now and the reason for that!!! My Code compiler studio's workspace was corrupted. Compiler was not compiling properly. Today, in the Code compiler studio forum, Mr. Gautam Iyer suggested that I change my workspace. please refer the link: 

    After this, I rewrote the whole thing from the scratch and it is working fine. Attached herewith is the final working project:

    5822.Uart5.zip

    I heartily appreciate the herculean effort you had to undertake in resolving an issue, the reasons for which were just  unimaginable. Thanks again for staying rock solid in extending technical support to your users.

    Warm Regards,

    Girish.

  • Hello Girish,

    Good that it is working for you. However as I noted in my last post, the code has structural flaws, that you must consider

    Regards
    Amit
  • Hello Amit,

    May I know exactly those structural flaws that you are referring to?

    Regards,

    Girish

  • Hello Girsih,

    I mentioned it in my post

    "2. You are using Sleep Mode. In sleep mode if the clock to the peripheral needs to be used then SysCtlPeripheralSleepEnable needs to be used"

    Regards
    Amit
  • Dear Amit,
    Thanks for your suggestions. Firstly,Regarding the pin output and uart3 and uart5 configurations, please check, in the final code and if there are any issues, kindly let me know about the same.
    2. As far as the SysCtlSleep( ); is concerned, The Peripheral Driver Library user Guide in section 27.2.2.48 on page 516 clearly says, that if the device is put to sleep without SysCtlPeripheralSleepEnable(); command, all Peripherals remain active and the function places the processor into sleep mode. All Peripherals can awake the processor in this state. Hence, I have not set any peripheral sleep enable, before the sleep command.

    Regards,
    Girish.
  • Hello Girish,

    That is because Auto Clock gating bit in RSCLKCFG is clear. You will not be getting any benefit in terms of current consumption reduction if you go to Sleep mode with ACG bit as 0.

    Regards
    Amit
  • Hello Amit,
    This is a bit tricky!!! please tell me if ACG bit is 0 and the processor goes to sleep, the power consumed by the processor must be reduced . Why will sleeping the processor not lead to reduced power consumption?

    Regards,
    Girish.
  • Hello Girish,

    Please read the data sheet System Control module chapter....

    Regards
    Amit