Re: Reading and Writing on same serial port



On Mon, 16 Jan 2006 15:40:42 -0000, Grant Edwards <grante@xxxxxxxx>
wrote:

>On 2006-01-16, emb in linux <haranath.t@xxxxxxxxx> wrote:
>
>> I have successfully communicated serial ports by running receive and
>> transmitting programs in different terminals.Now i need to read and
>> write data on same port.Here i am unable to do this.I am giving my
>> code.
>
>Care to tell us 1) what you think your code is supposed to do,
>and 2) what it actually does?

In addition, people who insists of using multiple tasks, processes or
threads (whatever they are called in each environment) to write to a
serial port have not considered what to do when there are multiple
pending write requests:

1) Do a byte by byte merge between each stream
2) Wait until the first transmission is completed, then send the next
frame
3) If a low priority thread has started transmission and a high
priority thread becomes active, send all the high priority bytes and
then continue with the low priority thread final bytes.
4) etc.

Also what to do with the received frame:

1) The next ready thread will get the next byte
2) Do a round robin between all ready threads
3) Based on the received byte, forward to a specific thread
4) Copy the received byte to all threads
5) etc.

The simplest thing would be to create a separate thread that owns the
port and implement any multiple access rule in that thread.

Paul

.



Relevant Pages

  • Serial Port not Working
    ... I m using linux-2.4.27 to build for arm architecture. ... Then my both serial ports were working properly. ... Information contained in this electronic mail transmission is confidential ... and intended to be sent only to the stated recipient of the transmission. ...
    (Debian-User)
  • Re: serial ports/app freezing
    ... When you're using serial ports over TS, there's more latency in transmission, which some applications might not tolerate too well. ...
    (microsoft.public.windows.terminal_services)