LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Speed of direct serial port access (https://www.linuxquestions.org/questions/linux-hardware-18/speed-of-direct-serial-port-access-573598/)

Vinter 07-31-2007 03:51 AM

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.

jailbait 08-01-2007 01:00 PM

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


All times are GMT -5. The time now is 11:59 PM.