LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 04:51 AM   #1
Vinter
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Aptosid
Posts: 145

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 06:13 AM.
 
Old 08-01-2007, 02:00 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,590

Rep: Reputation: 187Reputation: 187
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 09:41 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration