Discussion Locked

Regarding Serial Communication

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

greetings,
How to communicate with the serial port? (Without interacting with the drivers).
Give some idea about linux serial console.

7 replies

by lo

Humm ...

Top of my head says you don't want to do that. If you deal with the serial port and do not use drivers, you will have to write all of the code (error and functionality) that the drivers do to deal with the serial port, such as: Did we get all characters within needed timing? Did we get parity errors? Did we get the desired number of stop bits? Did we get buffer overrun?, etc.

These functions need to be done one way or another, that is why the drivers were written. It reduces the applicaton code to (give me the next character, next line, set the speed to , etc.). Much preferable to all applications (modem, fax, pc-pc communication, etc.) from having to write the same code. This is true for and computer hardwareand software, not just Linux or Windows.

If the existing driver is too slow or has other performance issues, I would suggest you write (or have someone write) a specific driver to resolve the issues. The real benefit of this is that if you use standard serial driver commands and functions, if/when you move to another piece of hardware/software, you will probably only need to modify the driver to resolve and serial i/o issues.

By rewritning the serial driver with a newwork knowledgale version, you could create a network connection rather than serial and the application would not know the difference.

If you create a driver (as a driver or as part of your application), you will need to disable any drivers the OS uses for the serial port or you will get conflicts, overwrites, false signals, etc.

by wls

Alter the ports permissions under /dev the way you want them to be, use setserial and stty to put the serial port in the mode(s) you want, then treat the device like a file.

This discussion is closed to new replies.