LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-31-2007, 03:51 AM   #1
Vinter
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Aptosid
Posts: 148

Rep: Reputation: 19
Speed of direct serial port access


Hi,

as described in LF365 (I2C vs Linux) I just built up a sensor interface on a SUSE 8.2 laptop and a Debian Testing Desktop.
Everything is working fine, there is only one problem: speed.
Considering the theoretical capabilities of the sensors, a clock speed of 100kHz, around 40kbps data, the actual values of 8bps data on the lap and 40bps data on the Desktop aren't quite stunning...
I tried increasing baud rate with setserial, stty and mgetty; also, I tried modifying the divisor, but none would help. Using mgetty or stty, /proc/tty/driver/serial would cat 115200 baud vs. original 9600, but still no change.
Has anyone got an idea on how to increase the speed of direct access via ioctl? I did not write the code, and I trust LF to be professional enough, but in order to be complete, here is the raise of clock as an example:

int arg=TIOCM_RTS;
ioctl(fd, TIOCMBIS, &arg);

Thank you in advance for any suggestions.
David,
running lynx, so don't blame me for any formatting errors

Ed: Kernels are 2.4.20 (SUSE) and 2.6.12-1 (Debian).
Ed: Just tried to modify the baud rate inside the program with information from the manpages... can anyone tell me if this code is correct? (Re-Ed: Effect even shows in /proc - but not in RL )
struct termios attr;
tcgetattr(fd,&attr);
tcsetospeed(&attr,B115200);
tcsetattr(fd,TCSANOW,&attr);
Where fd is my open terminal.

Last edited by Vinter; 07-31-2007 at 05:13 AM.
 
Old 08-01-2007, 01:00 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Your bottleneck will be the system resource that is running at 100%. The fact that you get 2 different speeds on 2 different CPUs may mean that the CPU cannot process the data as fast as the sensors can generate the data or the serial port transmit it. Use top to check if CPU usage approaches 100%.

------------------
Steve Stites
 
  


Reply

Tags
clock, ioctl, rate, serial, speed



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
How to use stty to set serial port speed Cara25 Linux - Newbie 1 06-18-2006 12:46 AM
serial port direct pin programming Lotharster Programming 5 04-08-2006 08:23 AM
speed/specs for ttyS0 or some other standard serial port? BigDawg Programming 3 01-23-2004 11:47 AM
Serial Port Access stweaver Linux - Newbie 3 09-14-2003 01:21 AM
Serial Port Access gblydenburgh Linux - General 3 08-21-2001 07:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:29 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