Hello -
So we have been fighting with getting our UART read requests to process UART_RETURN_NEWLINE correctly. We see the \n in binary.
After searching the example code from TI. Everything seems to be being done in binary mode.
*** this is from CC13xx EasyLink "Sample Code"
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);
-------------------------------
However when we set (in our code) to:
writeDataMode = UART_DATA_BINARY;
readDataMode = UART_DATA_TEXT;
readReturnMode = UART_RETURN_NEWLINE;
readMode = UART_MODE_CALLBACK;
it doesn't flush when reading when getting the /n.
Every code set (AtTerm.c, uartecho.c, etc.) it's always being set to UART_DATA_BINARY.
Do you have a code example of this working ? on a CC13xx chipset? I was thinking that we missed a setting, etc. But nothing seems to be working.
In uart.c the default readReturnMode is UART_RETURN_NEWLINE... so it "should" work.
/* Default UART parameters structure */
const UART_Params UART_defaultParams = {
UART_MODE_BLOCKING, /* readMode */
UART_MODE_BLOCKING, /* writeMode */
UART_WAIT_FOREVER, /* readTimeout */
UART_WAIT_FOREVER, /* writeTimeout */
NULL, /* readCallback */
NULL, /* writeCallback */
UART_RETURN_NEWLINE, /* readReturnMode */
UART_DATA_TEXT, /* readDataMode */
UART_DATA_TEXT, /* writeDataMode */
UART_ECHO_ON, /* readEcho */
#if defined(MSP430WARE)
9600, /* baudRate */
#else
115200, /* baudRate */
#endif
UART_LEN_8, /* dataLength */
UART_STOP_ONE, /* stopBits */
UART_PAR_NONE, /* parityType */
NULL /* custom */
};
We have spent "hours" trying to resolve this.
*********** ALSO *******************
In the sample EasyLink Code it appeaers he is using binary data, and parsing it for a return character in code? Do we think NEWLINE isn't working? Possibly.
----------- From rfEasylinkTxRx.c --------------
Void echoFxn(UArg arg0, UArg arg1)
{
char input;
uint8_t charIndex;
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {
System_abort("Error opening the UART");
}
/* Loop forever echoing */
charIndex = 0;
uart_usage();
while (1) {
UART_read(uart, &input, 1);
/* Skip the line feed that appears after an enter as the first character of new line */
if (input == (char)CHAR_LINEFEED)
charIndex--;
if ((input == (char)CHAR_LINE_END_1) | (input == (char)CHAR_LINE_END_2)) // (charIndex < UART_SERIAL_LINE_SIZE))
{
uart_s.lineSize = charIndex;
/* Parse the input into command and arguments */
uart_get_command_and_arguments();
/* Process the commands recived */
/* If command_process returns 1, then process txTaskFunction */
if(command_process())
Semaphore_post(semaphore_txTask);
/* Print the response of the command processing */
UART_write(uart, uart_s.response, uart_s.responseMsgLen);
input = (char)CHAR_LINEFEED;
UART_write(uart, &input, 1);
/* reset index to zero to point to begining of the line */
charIndex = 0;
}
else
{
/* Store the input character */
uart_s.inputLine[charIndex++] = input;
}
}
}