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.

MSP432P401R: POSIX over TI-RTOS: UART status function needed

Part Number: MSP432P401R

Hi,

I use back channel UART for terminal communication in simple command interpreter.

Using SimpleLink SDK (3.30.0.13) , POSIX with TI-RTOS.

My basic  routine looks like:

    char cmd;
    int status;

   status = UART_read( h_uart, &cmd, sizeof(cmd));   // blocks and returns only when char has arrived!!

Problem:

UART_read(..)  blocks and only return, when a character has arrived!

In am looking for a function that gives me information, if a new character in UART has still arrived. 

Otherwise I can perform something else.

So  I am looking for something like this dummy code

if (UART_IsNewChar() == true)

   status = UART_read( h_uart, &cmd, sizeof(cmd));

else

  DoSomethingElse();

 

Any idea how to solve this  issue?

  • Hi DJ-NG,

    Let me see if I have an example for this.

  • Dennis,

    did you find something that helps ?

    What would help too would be a function like

    status = UART_read( h_uart, &cmd, sizeof(cmd));   // blocks and returns only when char has arrived!!

    that returns by a given timeout time, when no char /string has arrived,

     

  • DJ-NG said:
    In am looking for a function that gives me information, if a new character in UART has still arrived. 

    Do the UART_CMD_ISAVAILABLE and UART_CMD_GETRXCOUNT command codes in the UART_control command and status codes help?

  • Chester,

    this sound like I was looking for!

    I'll give you feedback if it helped.

  • Problem is solved! Thanks for giving me the right hint!

    I implemented it in this way:

    // Check if a new charater has arrived via UART
    // Function return:
    // true:    A new character has arrived and might be read  by UART_read(...);
    // false:   No new character

    bool UART_IsNewRXChar(UART_handle hUART)
    {

        bool bRet=false;

        int_fast16_t ret;

        ret = UART_control(hUART, UART_CMD_ISAVAILABLE, &bRet);

        if (ret != 0)

            while(1);   // Error, no  success (debug only)

        return bRet;

    }

    So I can use it like

    ......

    while (!quit)

    {

    char rcv;

    if (UART_IsNewRXChar(hUART) == true)

        {
        UART_read(hUART, &rcv, sizeof(rcv));

       switch(rcv)

       {

         case 'A': do_this(); break;

         case 'B': do_that(); break; 

       }  // switch

        }   // if

    else

     ... doSomethingBetter();

     

**Attention** This is a public forum