LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-23-2006, 07:23 PM   #1
areftaidi
LQ Newbie
 
Registered: Dec 2005
Posts: 11

Rep: Reputation: 0
Real-time close loop control needs serial port communication


I am porting a closed loop control system to Redhat kernel version 2.4. This software is heavily real-time and equally relies on RS485 communication through the serial port of the PC which has to be available when needed. What is the best way to ensure that the Serial line driver will have the processor when it needs it? Would it be better to have a separate process for TX and one for RX, or a single process with two threads? Would a lightweight process do?
 
Old 01-23-2006, 07:35 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,697

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Are you running a real time kernel?
 
Old 01-23-2006, 08:24 PM   #3
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
What kind of precision (timewise) are you looking for? A real-time kernel is probably to your advantage.
 
Old 01-23-2006, 08:57 PM   #4
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
There are some different types of RS485 transceivers available for the PC. If you are using the type that requires the PC software to switch between RX and TX modes then timing is more critical, its usually done with raising or lowering the RTS line.
Is this the type you're using?
I've found for moderate baud rates that linux is fast enough to send a message on the RS232->RS485 converter, quickly switch to RX mode and receive the response without missing the first few bytes. If that's the only issue then you should be fine. Writing a custom serial driver would be the next step if timing can't be met.
 
Old 01-24-2006, 02:43 PM   #5
areftaidi
LQ Newbie
 
Registered: Dec 2005
Posts: 11

Original Poster
Rep: Reputation: 0
No I am not currently using real-time kernel, or I don't believe I am. It is Red Hat 9.0 with 2.4 Kernel. Before starting the porting I did some research into the subject and quickly learned I would eventually have to use real-time kernel instead of the normal one. But thought I could do a great deal of preliminary work before switching kernel. I believe I would need static priority for my processes. The control processes themselves are quite time critical and the same questions apply to them as well. Would I need real-time kernel to have static priority? Is it better to go real-time now? Is it easy to switch to real-time kernel later?

The response time currently required is in the order of 30ms. We would soon need to monitor digital inputs every 10ms.

The RS484 adaptor I use automatically switches between input and output mode through hardware so fortunately no software intervention required. This means that as soon as the RS485 Master writes to the port, the slave RS485 adapter(s) will switch to input mode automatically and the RX thread/process will receive the message.
 
Old 01-24-2006, 04:37 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
If you need a guaranteed response time, you need the real-time kernel.
 
Old 01-25-2006, 06:30 PM   #7
areftaidi
LQ Newbie
 
Registered: Dec 2005
Posts: 11

Original Poster
Rep: Reputation: 0
Hi All,

Many thanks for your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial port communication.. brianbek Linux - Software 2 01-23-2006 12:43 PM
serial port communication prems Linux - Newbie 1 04-17-2005 02:31 AM
communication with serial port vidyaraj Linux - Hardware 0 03-09-2004 08:32 PM
serial port communication vidyaraj Linux - Software 6 03-02-2004 06:46 PM
communication via serial port perdesiz Linux - Software 0 11-13-2003 06:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration