UART Transparency Over TCP


I am tring to write a code to transport all UART data arrives from my controller to remote server using TCPclient application.
After searching this forum i have found that i need to use FCM in order to do so but havent found any sample for doing this.
Can any one assist with sample code to perform this complex action ?


You need to break the problem down into its constituent parts:

  1. Receiving data using FCM - it really makes no difference to this process what will happen to the data subsequently;
  2. Sending data over TCP - it really makes no difference to this process where the data might happen to have come from.

Individually, neither of these is complex - and there are samples to illustrate them.


this method requires handling a limited size buffer and i need a mechanism to switch the incoming data to go directly to the UART and in the opposite directions .


wip_write is the only function that allows to send data and it uses a buffer , therefore i would i be able to manage not loosing the received data on UART and in the same time handle the socket connection?
the only example that i see is the tcp client/server which both of them sends buffer between IP address and not hanles data exchange…


A “buffer” is simply a temporary store - which is precisely what you require!

You need a temporary store to hold data from the UART while it awaits transmission over TCP/IP.

Probably the best type of buffer would be a Circular Buffer - also known as a Ring Buffer.

This is a very widely used technique - you should be able to find a description in a decent programming textbook, on Wikipedia, or with a little googling…

There’s a useful book list here: