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.

CC3200MOD: Configuring EOT interrupt on UART port

Part Number: CC3200MOD


Hi,

I am using CC3200MOD. I tried to enable EOT interrupt on UARTA1.

I configured UART interrupt as following:

//
// Set TX interrupt mode as End Of Transmission
//
UARTTxIntModeSet(UARTA1_BASE, UART_TXINT_MODE_EOT);

//
// Set maskable interrupt flag for Receive, transmit, & receive timeout
//
UARTIntEnable(UARTA1_BASE, UART_INT_RX | UART_INT_RT | UART_INT_EOT);

I am not able to get interrupt status as UART_INT_EOT. Instead am getting as UART_INT_TX.

Even I wanted to confirm whether Flow control can be implemented on UARTA0 and UARTA1 simultaneously?

  • Hi,

    That is weird. Interrupt mask UART_INT_EOT is not described peripheral driver library documentation, but I still expect, that is should work. According SWRU367 it sounds reasonable. Are sure that is called UART_INT_TX interrupt inside your interrupt handler?

    Please share this code:
    - all your UART1 settings (enable peripheral, interrupt settings, etc.)
    - part of your interrupt handler where you determine type of interrupt and you clear interrupt flags
    - how you send characters from you other code (where you start transmitting, that mean fill FIFO, etc.)

    Jan
  • Hi,

    It is defined in uart.h file

    //*****************************************************************************
    //
    // Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear
    // as the ulIntFlags parameter, and returned from UARTIntStatus.
    //
    //*****************************************************************************
    #define UART_INT_DMATX          0x20000     // DMA Tx Done interrupt Mask
    #define UART_INT_DMARX          0x10000     // DMA Rx Done interrupt Mask
    #define UART_INT_EOT            0x800       // End of transfer interrupt Mask
    #define UART_INT_OE             0x400       // Overrun Error Interrupt Mask
    #define UART_INT_BE             0x200       // Break Error Interrupt Mask
    #define UART_INT_PE             0x100       // Parity Error Interrupt Mask
    #define UART_INT_FE             0x080       // Framing Error Interrupt Mask
    #define UART_INT_RT             0x040       // Receive Timeout Interrupt Mask
    #define UART_INT_TX             0x020       // Transmit Interrupt Mask
    #define UART_INT_RX             0x010       // Receive Interrupt Mask
    #define UART_INT_CTS            0x002       // CTS Modem Interrupt Mask

  • Hi,

    Yes I know that, but this not that important. Much important is that EOTIM interrupt mask is defined in UARTIM at www.ti.com/.../swru367. Please share you code, than we will continue.

    Jan

  • Hi,

    1. UART1 settings:

    Ser1_Config(ST_SER_CONFIG *lpstSerConfig)
    {
    //
    // Disable the Serial port
    //
    UARTDisable(UARTA1_BASE);
    
    //
    // Configure the UART for desired baudrate, parity, data length and stop bit
    //
    
    ldSys_Clk = PRCMPeripheralClockGet(PRCM_UARTA1); 
    UARTConfigSetExpClk (UARTA1_BASE, ldSys_Clk, mdwBaudRate[lpstSerConfig->Baud],
    (
        mdwDataLength[lpstSerConfig->Data_Length] |
        mdwStopBit[lpstSerConfig->Stop_Bits] |
        mdwParity[lpstSerConfig->Parity]
    ));
    
    // Configure the FIFO level trigger
    // FIFO Rx level is configured to generate interrupt when 2 bytes are received
    // FIFO Tx level is configured to generate interrupt when 14 bytes are transmitted
    UARTFIFOLevelSet(UARTA1_BASE, UART_FIFO_TX1_8, UART_FIFO_RX7_8);
    
    //
    // Set TX interrupt mode as End Of Transmission
    //
    UARTTxIntModeSet(UARTA1_BASE, UART_TXINT_MODE_EOT);
    
    //
    // Set maskable interrupt flag for Receive, transmit, & receive timeout
    //
    UARTIntEnable(UARTA1_BASE, UART_INT_RX | UART_INT_RT | UART_INT_EOT);
    
    //
    // Enable UART
    //
    UARTEnable(UARTA1_BASE);
    
    //
    // Register Interrupt handler
    //
    #if defined(USE_TIRTOS) || defined(USE_FREERTOS) || defined(SL_PLATFORM_MULTI_THREADED)
        	// USE_TIRTOS: if app uses TI-RTOS (either networking/non-networking)
        	// USE_FREERTOS: if app uses Free-RTOS (either networking/non-networking)
        	// SL_PLATFORM_MULTI_THREADED: if app uses any OS + networking(simplelink)
        	osi_InterruptRegister(INT_UARTA1, UARTA1_IRQ_HANDLER, INT_PRIORITY_LVL_1);
    
    #else
        	IntPrioritySet(INT_UARTA1, INT_PRIORITY_LVL_1);
        	UARTIntRegister(UARTA1_BASE, UARTA1_IRQ_HANDLER);
    #endif
    }

    2. interrupt handler:

    //
    // Read Masked interrupt flags
    //
    ldwFlag = UARTIntStatus(UARTA1_BASE, true);
    
    //
    // Clear the masked interrupt flags
    //
    UARTIntClear(UARTA1_BASE, ldwFlag);
    
    //
    // Transmit routine
    //
    if (ldwFlag & UART_INT_EOT)
    {
      ... Code
    }
    
    if(ldwFlag & UART_INT_TX)
    {
      ... Code
    }

    Here I  got the code paused at breakpoint in UART_INT_TX routine.

    3. sending characters

    I copy data from buffer using 

    //
    // Send data to Ser1 port
    //
    UARTCharPutNonBlocking(UARTA1_BASE, Read_Buff(&stSer1.Trans_Buff));

    where Read_Buff function Reads single byte from the buffer

  • Hi,

    Sorry I could not get into interrupt handler for UART_INT_TX when enabled EOT using
    UARTIntEnable(UARTA1_BASE, UART_INT_RX | UART_INT_RT | UART_INT_EOT);

    I tested the code again to find that my code doesnt enter interrupt handler for EOT.
  • Hi,

    I don't know why your EOT is not triggered. Your code looks properly. Maybe it have something to do with FIFO because EOT flag is triggered when FIFO is empty. How many characters you set into FIFO at beginning of your transmission?

    For example I use this code with my UART:

    UART init:

    #define SERIAL_BAUD_RATE  460800
    #define SERIAL_UART       UARTA0_BASE
    #define SERIAL_PERIPH     PRCM_UARTA0
    #define SERIAL_HANDLER    INT_UARTA0
    #define SERIAL_TX_PIN     PIN_55
    #define SERIAL_RX_PIN     PIN_57
    
    void serialInit(void) {
      MAP_PRCMPeripheralClkEnable(SERIAL_PERIPH, PRCM_RUN_MODE_CLK);
      MAP_PinTypeUART(SERIAL_TX_PIN, PIN_MODE_3);
      MAP_PinTypeUART(SERIAL_RX_PIN, PIN_MODE_3);
      MAP_UARTConfigSetExpClk(SERIAL_UART,
                              MAP_PRCMPeripheralClockGet(SERIAL_PERIPH),
                              SERIAL_BAUD_RATE,
                              (UART_CONFIG_WLEN_8   |
                               UART_CONFIG_STOP_ONE |
                               UART_CONFIG_PAR_NONE));
      osi_InterruptRegister(SERIAL_HANDLER, UARTIntHandler, INT_PRIORITY_LVL_4);
      MAP_UARTIntEnable(SERIAL_UART, (UART_INT_TX | UART_INT_RX | UART_INT_RT ));
    }

    UART interrupt:

    static void UARTIntHandler() {
      unsigned int status = MAP_UARTIntStatus(SERIAL_UART, true);
      MAP_UARTIntClear(SERIAL_UART, status);
    
      if (status & UART_INT_TX) {
        // TX with FIFO
        while ((MAP_UARTSpaceAvail(SERIAL_UART)) && (cmdTxToSendLen > 0)) {
          MAP_UARTCharPutNonBlocking(SERIAL_UART, cmdEngRespBuffer[cmdTxPos++]);
          cmdTxToSendLen--;
        }
        // end of TX
        if (cmdTxToSendLen == 0) return;
      }
    
      if (cmdTxToSendLen > 0) return;
    // read and decode characters from RX FIFO if ((status & UART_INT_RX) || (status & UART_INT_RT)) {
    UARTReadFifo();
      osi_SyncObjSignalFromISR(&uartIrqSignal);
    } }

    Send and global variables:

    // global variables
    static int    cmdTxPos;
    static int    cmdTxToSendLen;
    unsigned char cmdEngRespBuffer[CMD_ENG_RESP_SIZE];
    
    // send code (123B)
    cmdTxToSendLen = 123;
    cmdTxPos       = 0;
    
    while ((MAP_UARTSpaceAvail(SERIAL_UART)) && (cmdTxToSendLen > 0)) {
      MAP_UARTCharPutNonBlocking(SERIAL_UART, cmdEngRespBuffer[cmdTxPos++]);
      cmdTxToSendLen--;
    }
    
    // wait will TX cycle is done...
    osi_SyncObjWait(&uartIrqSignal, OSI_WAIT_FOREVER);

    Jan

  • Hi Jan,

    Thanks for your support.

    Basically I am just testing the serial port. The length of the data to be sent is not fixed. The project I am working on is sort of serial-wifi so data length cannot be fixed.

    Right now I am trying to send 256 bytes of data. For first transmission I am sending 16 bytes i.e. filling the FIFO.

    -Tanvi

  • Hi Tanvi,

    Although I was not able help you with this EOT interrupt, do you need more assistance or we can close it?

    I think it would be better use different way than using EOT interrupt, which is not working in your case. But if you want still use EOT interrupt, I suppose that guys from TI will be able look on it after new year.

    Jan
  • Hi Jan,

    Thanks a lot.

    I think I will go with TX interrupt in EOT mode which was working fine and providing interrupt flag INT_TX.

    Thanks

    Tanvi