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.
Kalyan,
You can see how to set up a callback in this E2E post(UART Callback on TI-RTOS). This is an altered version of the uartecho TI driver example and shows how to send a byte and then provide a means to have the system receive the byte when it's available without blocking you from other activities.
That's all the examples that are available.
-Bob L.
Hello Bob,
Thank you for the reply.
I have already tried similar thing however i am not succeeded.
I am using tcp echo example to transmit data from ethernet to serial and serial to ethernet. ethernet to serial transmission happening properly and serial to ethernet transmission is not happening properly.
I am attaching the code please guide me to solve this.
void tcpworker(uint32_t arg0, uint32_t arg1)
{
int clientfd = (int)arg0;
int bytesRcvd;
// int bytesSent;
// char buffer[TCPPACKETSIZE];
UART_read(uart4, &buffer1, 1);
while(1)
{
while((bytesRcvd = recv(clientfd, buffer, TCPPACKETSIZE, 0)) > 0) // Ethernet 2 serial
{
// bytesSent = send(clientfd, buffer, bytesRcvd, 0);
UART_write(uart4, &buffer, bytesRcvd);
}
if(Rx_flag == 1)
{
send(clientfd, buffer1, 1, 0); // Serial 2 Ethernet
Rx_flag = 0;
}
}
close(clientfd);
}
/*********** tcp worker2 for Serial to Ethernet transmission ***********************/
//void Serial2Ethernet(uint32_t arg0, uint32_t arg1)
//{
// int clientfd = (int)arg0;
// if(UART_read(uart4, &buffer, 1) > 0)
// {
// send(clientfd, buffer, 1, 0);
// }
//
//// UART_readCancel(uart4);
//// UART_read(uart4, &buffer, 1);
//// if(Rx_flag == 1)
//// {
//// send(clientfd, buffer, 1, 0);
//// }
// close(clientfd);
//}
/************* uart read ready function ********************************/
void uart4_read_ready_fxn(UART_Handle uart4, void *buffer, size_t num)
{
// send(clientfd_Rx, buffer1, 1, 0);
Rx_flag = 1;
// UART_readCancel(uart4);
}
Hi Bob,
First of all thanks for responding.
Here Ethernet to serial is working perfectly.
However serial to ethernet transmission happening only when I try to send some data from Ethernet(then only I am able to receive the data, which I previously try to send from uart, in Ethernet side).
Here problem is we don't have any ISR function to execute directly whenever I am sending data from serial port.
Should I use two threads like I commented in the program or any other idea.
Thank you
Regards
Kalyan.
Kalyan,
Here's some feedback from one of our Ethernet experts:
Looks like he is reading the UART in the tcpworker task. This means only when tcpworker task is invoked will the UART_read work.
UART_read should be in another task or a handler function. The data received should be sent to the tcpworker task using mechanisms like Queue and mailbox (global variables is a bad idea).
-Bob L.
**Attention** This is a public forum