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.

CC2640 UART Read Return Mode - UART_RETURN_NEWLINE

Other Parts Discussed in Thread: CC2640

In the current release of the stack for CC2640 it is mentioned in UARTCC26XX.h (distributed with the TI RTOS) that for read/write data mode UART_DATA_TEXT is not supported.  I have noticed that even with read data mode = UART_DATA_BINARY that the Read Return Mode only triggers a callback function when the RX buffer is full, but doesn't seem to decode the newline character in the RX buffer and trigger the callback if the Read Return Mode is set to UART_RETURN_NEWLINE (unless the buffer fills).

So it would appear because there is no support for UART_DATA_TEXT there is also no support for UART_RETURN_NEWLINE.  I just want to confirm that is correct.

Kind Regards,

Marc

  • Hi Marc,

    You are entirely correct - the text mode is not supported. Newline in this context is a TEXT concept, because for binary transfers \n has no special meaning.

    You can get the UART driver to return after a 32-bit period of serial bus inactivity by calling UARTCC26XX_control(hUart, UARTCC26XX_RETURN_PARTIAL_ENABLE, NULL);

    You are then responsible for initiating a new read immediately. This method is perhaps best suited for callback mode in order to start a new read as fast as possible (keeping in mind the UART fifo is 16 bytes deep only) and not blocking mode. Keep in mind that the callback is issued in Hwi context, so you shouldn't do lots of stuff there, like waiting, pending, trying to send stuff via RF.

    Anyway, let's say you are doing some kind of terminal emulator for some reason, then each key stroke would most likely trigger a callback. In any case, you callback could implement a line parser from the received buffer into a local buffer.

    Best regards,
    Aslak
  • Thanks for confirming Aslak.
    -Marc