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.
Tool/software: TI-RTOS
TI-RTOS: v2.01.00.03
CCS: v6.0.1.0040
Hello,
I am working on project in which dont Know the Recived Data Length. I intialize Uart Parameter as Below.
Void com0TaskFxn(UArg arg0, UArg arg1) { char rxBuffer[256], txBuffer[256]; int ret, i; UART_Handle handle = NULL; UART_Params params; UART_Params_init(¶ms); params.baudRate = usr_s.uart[STRUCT_INDEX_COM0].baud_rate; // baud rate is configure By user. params.dataLength = UART_LEN_8; params.parityType = UART_PAR_NONE; params.stopBits = UART_STOP_ONE; params.writeDataMode = UART_DATA_BINARY; params.readDataMode = UART_DATA_BINARY; params.writeMode = UART_MODE_CALLBACK; params.writeCallback = (UART_Callback)(&com0WriteCompleteCallbackFunction); params.readReturnMode = UART_RETURN_FULL; params.readEcho = UART_ECHO_OFF; params.readTimeout = ? handle = UART_open(STRUCT_INDEX_COM0, ¶ms); if (!handle) { System_printf("COM 0 UART did not open"); } else { System_printf("COM 0 UART_initialised\n"); } /* Clear store buffer */ rxBuffer[0] = 0; while(1) { if(!GPIO_read(FACTORY_RESET_AND_UART_CONFIG_MODE_SWITCH)) { uart0_mode = UART0_MODE_UIMANAGER; goto com0_re_initialise_position; } ret = UART_read(handle, &rxBuffer, 250); if(ret > 0) { /* Add null pointer to buffer for string sending */ rxBuffer[ret + 1] = 0; if(sys_state.tcpServer1_is_active == true) { Mailbox_post(mboxCom0Rx4S1, rxBuffer, TCP_SERVER_TASK_MAIN_LOOP_DELAY_IN_MS + 5);//500); } } if(Mailbox_pend(mboxCom0Tx, txBuffer, BIOS_NO_WAIT)) { ret = UART_write(handle, &(txBuffer[1]), (int)txBuffer[0]); } } }
As per TI User Manual:
The receive timeout interrupt is asserted when the receive FIFO is not empty, and no further data is received over a 32-bit period when the HSE bit is clear or over a 64-bit period when the HSE bit is set.
The receive timeout interrupt is cleared either when the FIFO becomes empty through reading all the data (or by reading the holding register), or when a 1 is written to the corresponding bit in the UARTICR register.
My question is
<1> read Timeout is the timeout is in "milliseconds" or in "seconds".
<2> read Timeout is for 1 Byte or for whole 250 Bytes.
<3> As In my code baud rate is not fix, In that case What should be read Timeout?
<4> In case of No data to read, After How much time UART_READ() return 0.
Hi Alan,
Thanks For Reply.
In my code i dont know how many Bytes i have to read so i have to use readTimeout. And I use both UART_read() & UART_write In same while loop I cant set readTimeout to 0 and set UART_read() in Blocking Mode.But the problem is i dont know when readTimeout Clock is trigger?
suppose In case i given 250 Bytes In UART_read() , And I am getting 240 Bytes only. so readTimeout Clock Trigger after 240 Bytes or when I call the UART_read() ?
As per TI User Manual:
The receive timeout interrupt is asserted when the receive FIFO is not empty, and no further data is received over a 32-bit period when the HSE bit is clear or over a 64-bit period when the HSE bit is set.
The receive timeout interrupt is cleared either when the FIFO becomes empty through reading all the data (or by reading the holding register), or when a 1 is written to the corresponding bit in the UARTICR register.
so, As i understand the readTimeout Clock is start only After i received 240 Bytes. so i have to calculate only the time required for reading 1 Byte only. For 9600 Baud Rate It requires 1 ms Approx. so I have to set
params.readTimeout = 1
Is this Right?
Hi Alan,
As per your Last Reply:
The 'readTimeout' parameter that the UART driver uses IS NOT RELATED TO the receive timeout interrupt provided by the UART peripheral (the interrupt described in the TI User Manual you reference).
But As per TI User Manual:
The receive timeout interrupt is asserted when the receive FIFO is not empty, and no further data is received over a 32-bit period when the HSE bit is clear or over a 64-bit period when the HSE bit is set.
So, what its meaning?