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.

i am facing problem in tiva series uart receive interrupt

Other Parts Discussed in Thread: TM4C1231H6PM, TM4C123GH6PM

Hi,

I test uart on tiva series launchpad and later we are using tm4c1231h6pm for our development. I am facing problem in uart1 . If i configure the uart 0 with out interrupt i can able to transmit the data. but if i configure the uart 0 as interrupt method i cant able to transmit the data as well i am not getting receive interrupt also.

case 1: configured as interrupt ( but transmit and receive interrupt is not happening)

Uart_init()

// Enable  UART1
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
    
    // Enable PortC
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    
    // Configure the pin multiplexing
    ROM_GPIOPinConfigure(GPIO_PC4_U1RX);
    ROM_GPIOPinConfigure(GPIO_PC5_U1TX);
    
    // Configure the type of the pins for UART Tx/Rx
    ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5);
    
    clck=ROM_SysCtlClockGet();
    ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 9600,
        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
    // Init the console
    //UARTStdioInit(0);
    UARTFIFODisable(UART1_BASE);
    // Enable the UART1 interrupt handler
    ROM_IntEnable(INT_UART1);
    ROM_UARTIntEnable(UART1_BASE, UART_INT_RX|UART_INT_RT );

if i configure like this i cant able to transmit and receive interrupt is not happening.

---------------------------------------------------------------------------------------------------------------------------------------------------

case 2: without interrupt method ( transmit happening).

below code is configured without interrupt method, by this method i can able to transmit.

// Enable  UART1
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
    
    // Enable PortC
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    
    // Configure the pin multiplexing
    ROM_GPIOPinConfigure(GPIO_PC4_U1RX);
    ROM_GPIOPinConfigure(GPIO_PC5_U1TX);
    
    // Configure the type of the pins for UART Tx/Rx
    ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5);
    
    clck=ROM_SysCtlClockGet();
    ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 9600,
        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
    // Init the console

plz help me on resolveing this issue.

case 1 is working in evaluation board launchpad, but its not happening in my development board ( tm4c1231h6pm).

thanks in advance.

  • Hello Mahendran,

    1. Are you sure that you have mapped the Interrupt Vector in startup_ccs.c for the UART1 and/or UART0 Interrupt Handler

    2. Also it is not clear as to how the UART TX and RX data are being related to the UART Interrupt Handler in the non working case.

    Regards

    Amit

  • hi amith,

    I am using keil compiler  i have mapped the interrupt vector in startup_rvmk.s file

    here is the code for it

    ;******************************************************************************
    ;
    ; Place code into the reset code section.
    ;
    ;******************************************************************************
            AREA    RESET, CODE, READONLY
            THUMB
            
            
            
        EXTERN UART1IntHandler    
    ;******************************************************************************
    ;
    ; The vector table.
    ;
    ;******************************************************************************
            EXPORT  __Vectors
    __Vectors
            DCD     StackMem + Stack            ; Top of Stack
            DCD     Reset_Handler               ; Reset Handler
            DCD     NmiSR                       ; NMI Handler
            DCD     FaultISR                    ; Hard Fault Handler
            DCD     IntDefaultHandler           ; The MPU fault handler
            DCD     IntDefaultHandler           ; The bus fault handler
            DCD     IntDefaultHandler           ; The usage fault handler
            DCD     0                           ; Reserved
            DCD     0                           ; Reserved
            DCD     0                           ; Reserved
            DCD     0                           ; Reserved
            DCD     IntDefaultHandler           ; SVCall handler
            DCD     IntDefaultHandler           ; Debug monitor handler
            DCD     0                           ; Reserved
            DCD     IntDefaultHandler           ; The PendSV handler
            DCD     IntDefaultHandler           ; The SysTick handler
            DCD     IntDefaultHandler           ; GPIO Port A
            DCD     IntDefaultHandler           ; GPIO Port B
            DCD     IntDefaultHandler           ; GPIO Port C
            DCD     IntDefaultHandler           ; GPIO Port D
            DCD     IntDefaultHandler           ; GPIO Port E
            DCD     IntDefaultHandler           ; UART0 Rx and Tx
            DCD     UART1IntHandler           ; UART1 Rx and Tx

     

    and

    my interrupt handler is

    void
    UARTIntHandler(void)
    {
        unsigned long ulStatus;
        // Get the interrrupt status.
        ulStatus = ROM_UARTIntStatus(UART1_BASE, true);
    
        // Clear the asserted interrupts.
        ROM_UARTIntClear(UART1_BASE, ulStatus);
    
        // Loop while there are characters in the receive FIFO.
        while(ROM_UARTCharsAvail(UART1_BASE))
        {
            // Read the next character from the UART and write it back to the UART.
            ROM_UARTCharPutNonBlocking(UART1_BASE,
                                       ROM_UARTCharGetNonBlocking(UART1_BASE));
            
            
            
        }
    }
    

     

    this worked in my evaluation board tiva launchpad, but same stuff is not working in tm4c1231h6pm . i dont know what is wrong.

  • Hi,

    mahendhran s said:
     EXTERN UART1IntHandler    

    mahendhran s said:
    DCD     UART1IntHandler           ; UART1 Rx and Tx

    mahendhran s said:
    void UARTIntHandler(void)

      You, forgot the "1" at void UARTIntHandler(void)

    -kel

  • Below code is for Configure UART0. In Interrupt mode.

    void Configure_UART(void)

    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0) ; // Enable UART0 peripheral
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA) ; // Enable PortA peripheral

    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);

    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1) ; // Configure Port A, Pins 0 & 1, for UART

    UARTClockSourceSet(UART0_BASE, UART_CLOCK_SYSTEM) ; // Set System Clock for UART

    /*Configure UART through Clock Rate, 115.2 KBaud, 8 data_bits, No_Parity, 1 Step Bit Operation.*/

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

    UARTFlowControlSet(UART0_BASE, UART_FLOWCONTROL_NONE) ; // Set UART flow control - NONE
    UARTFIFOEnable(UART0_BASE) ; // UART FIFO enable

    IntEnable(INT_UART0); // Interrupt Enable
    }

    after this you have to edit  line in Startup_css.c

    change default handler to you interrupt handler.eg.

    IntDefaultHandler, // GPIO Port E
    UARTIntHandler, // UART0 Rx and Tx
    IntDefaultHandler, // UART1 Rx and Tx

    then implemnt a function called 

    void
    UARTIntHandler(void)
    {

    -------

    -------

    ------
    }

  • hi,

    i am using keil compiler not CCS the startup file is different for keil and ccs. i am following keil startup_rvmk.s file. in that just mentioning Extern UartIIntHandler is sufficient right.

  • Hello Mahendhran

    Can you please share the schematic of the custom board you have since the code is working on LauncPad and not on your custom board?

    Regards

    Amit

  • mahendhran s said:
    n that just mentioning Extern UartIIntHandler is sufficient right.

    What do you mean sufficient? 

    As I have replied earlier, you are missing the "1". You, setup at your startup file Uart1IntHandler. But you don't have Uart1IntHandler at your main c file. You, have instead UartIntHandler. So, if a uart interrupt occur, there are no interrupt handler to handle your interrupt.

    See, how the interrupt handler is setup at uart_echo to get an idea.

    Do you have any compile errors?

    -kel

  • Hello,

    I see dots on your schematic drawing.  I have seen where this typically means the connection is not made.  Some tools will resolve this and know what was intended, but I have seen others in the past leave these unconnected.  Are you getting continuity on your nets on the board?  I.e. the transmit from your device is actually connected to your Rx of the MCU?  

    Is RXD_GSM the transmit from your other device connected to the MCU Rx pin?  These often get reversed as well and your labels may indicate that the reference is from the GSM device.  Worth double checking.

    -c

  • HI,

    Here it is the whole bundle of instructions needed to enable an UART interrupt:

    UARTIntEnable(UART0_BASE, UART_INT_TX | UART_INT_RX); // or whatever you need 
    IntEnable(INT_UART0);
    UARTEnable(UART0_BASE);
    IntMasterEnable();

    Seems you are missing some of them...

    Petrei

  • hi,

    my code is working in evaluation board, but its not working in tm4c1231h6pm( with custom board).  is there any difference between tm4c123glx and tm4c1231h6pm.

  • Hello Mahendhran,

    The part on your custom board does not have QEI, USB, PWM and only 1 CAN and has operating temp range of -40C to +85C.

    From UART perspective it is identical.

    Also I think if you can zip your Keil Project and send it across we can check what is happening?

    Regards

    Amit

  • hi amith,

    i figured out the issue the controller is going to FAUT ISR and i saw the fault report  seems to be bus error. This happening immediately when the uart5 is initialized as interrupt. Actually no problem in uart 1, were i have mention in the above query.

  • Hello,

    Bus fault typically happens when you have not enabled the clock to the peripheral and try to access it.  Be sure to enable the UART5 peripheral before accessing any of the registers.

    -c

  • UART0 - then UART1 - and now UART5!  Let the Krazy-making flow...

  • Hi,

    while configuring uart5 i am getting this bus error. plz find the attachement of the fault report.

  • Hello Mahedran

    A code post would be useful. However to check it yourself the following is something you may want to check

    1. The NVIC_FAULTADDR register. If it contains an address like 0x4XXXXXXX then it means that the Clock to the corresponding peripheral is not enabled

    2. Look up the Memory Map for this address 0x4XXXXXXX and check which peripheral it is corresponding to and then check if the SYSCTL PP and RCGC register-bit for the peripheral is set or not?

    Regards

    Amit

  • hi,plz find the code for the uart 5 configuration, while debugging when cursor reach the  ROM_IntEnable(INT_UART5); it goes to fault isr. i captured the falut report which i have sent in the previous post.

    void uart_int_5()

    {
    // Enable  UART5
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
        
        // Enable PortC
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        
        // Configure the pin multiplexing
        ROM_GPIOPinConfigure(GPIO_PE4_U5RX);
        ROM_GPIOPinConfigure(GPIO_PE5_U5TX);
        
        // Configure the type of the pins for UART Tx/Rx
        ROM_GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_4|GPIO_PIN_5);
        
        clck=ROM_SysCtlClockGet();
        ROM_UARTConfigSetExpClk(UART5_BASE, ROM_SysCtlClockGet(), 9600,
            (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
        
        UARTFIFODisable(UART5_BASE);
        // Enable the UART1 interrupt handler
        ROM_IntEnable(INT_UART5);   // while debugging when the cursor reach this place its going to fault isr  
        ROM_UARTIntEnable(UART5_BASE, UART_INT_RX|UART_INT_RT );
    }

  • Hello Mahendran,

    1. Can you replace ROM_IntEnable call with IntEnable call and check?

    2. Can you send the defines that you are using during compilation switch such as PART_TM4C123xxx and TARGET_IS_TM4C123_yyy?

    Regards

    Amit

  • hi amith,

    i will check by replacing intEnable.

    rvmdk PART_TM4C123GH6PM TARGET_IS_BLIZZARD_RB1

  • hi amith,

    i changed ROM_IntEnable to IntEnable the result is same. i am getting fault isr.

  • Hello Mahendran

    Can you please attach the full source code, or is the uart5_init code sufficient? I will check it on my side.

    Regards

    Amit

  • Hello Mahendran,

    I think the issue is that in the snapshot the IntEnable(UART5_BASE) is used instead of IntEnable(INT_UART5). Can you please correct the same?

    Regards

    Amit

  • void configure_uart5(void) //485
    {
        
        
            
        // Enable  UART5
            SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
            
            // Enable PortE
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        
            // Configure the pin multiplexing
            GPIOPinConfigure(GPIO_PE4_U5RX);
            GPIOPinConfigure(GPIO_PE5_U5TX);
            
            // Configure the type of the pins for UART Tx/Rx
            GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_4|GPIO_PIN_5);
            clck=SysCtlClockGet();
            
            UARTConfigSetExpClk(UART5_BASE, ROM_SysCtlClockGet(), 9600,
                (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
            UARTFIFODisable(UART5_BASE);
        //UARTFlowControlSet(UART5_BASE, UART_FLOWCONTROL_RX);
        UARTEnable(UART5_BASE);
        IntEnable(UART5_BASE);
        UARTIntEnable(UART5_BASE, UART_INT_RX );
        
    }

  • Hello Mahendran

    Please check my last post

    IntEnable(UART5_BASE);

    to be replaced by

    IntEnable(INT_UART5);

    Regards

    Amit

  • hi amith,

    thanks for pointing out the issue. i will check and let u know the result

  • hi amith,

    thanks the problem is resolved. uart 5