From: kees Schoenmakers <k.schoenmakers@sigmae.nl>
To: linux-serial@vger.kernel.orglinux-serial@vger.kernel.org
Subject: recent kernels [i.e. 3.10.12] shows serial driver problem
Date: Mon, 30 Sep 2013 08:23:57 +0200 [thread overview]
Message-ID: <11144439.5yyClnqeWI@sepc002> (raw)
[-- Attachment #1: Type: text/plain, Size: 877 bytes --]
Hello Friends,
I recently jumped from kernel 3.5.0 to 3.10.12
With the later kernel a modem application does no longer work.
I created a small test program which gives more information, it is attached as
t.c.
The test program measures time between writing data to (/dev/ttyS0 1200 baud)
and the moment the TIOCSERGETLSR call returns TIOCSER_TEMT.
With 3.5.0 this is as expected about 248 mS, with the newer kernel 3.10.12
it is about 19.5 mS which is plain wrong.
For a long time I had set the port parameters with setserial to uart 8250 and
that worked until now (3.5.0 still does work)
I found that changing the portsettings with setserial "uart 16550A" the port
works as expected.
Is it no longer possible to change those settings with
setserial??
I am willing and able to do more tests if needed.
best regards
Kees
PS CC me please, as I am not on the list,
[-- Attachment #2: TESTS_3.5.0 --]
[-- Type: text/plain, Size: 313 bytes --]
kees@SEPC002:~/projekten/hart_master$ ./a.out
mark 1 offset = 0.008000 ms
mark 2 offset = 247.808000 ms
kees@SEPC002:~/projekten/hart_master$ ./a.out
mark 1 offset = 0.008000 ms
mark 2 offset = 248.330000 ms
kees@SEPC002:~/projekten/hart_master$ ./a.out
mark 1 offset = 0.008000 ms
mark 2 offset = 247.706000 ms
[-- Attachment #3: TESTS_3.10.12 --]
[-- Type: text/plain, Size: 308 bytes --]
kees@SEPC002:~/projekten/hart_master$ ./a.out
mark 1 offset = 0.008000 ms
mark 2 offset = 19.641000 ms
kees@SEPC002:~/projekten/hart_master$ ./a.out
mark 1 offset = 0.008000 ms
mark 2 offset = 19.588000 ms
kees@SEPC002:~/projekten/hart_master$ ./a.out
mark 1 offset = 0.007000 ms
mark 2 offset = 19.532000 ms
[-- Attachment #4: t.c --]
[-- Type: text/x-csrc, Size: 1883 bytes --]
/* this test program demonstrates the problem with Linux-3.10.12
* (I tested 3.10.2 also, had the problem too)
* It shows the time between writing and signalling TX empty
* for standard serial port (/dev/ttyS0) (8250)
*
*
* With older kernels (at least 3.5.0) it works as expected
*
* writing 26 chars at 1200 baud to the PORT should take some 216 mS
* with the newer kernels it takes only 19mS
*
*/
#include <i386-linux-gnu/sys/time.h>
#include <stdio.h>
#include <termio.h>
#include <fcntl.h>
#include <stdlib.h>
struct termios tio;
char teststring[]="abcdefghijklmnopqrstuvwxyz";
int main (int argc, char **argv)
{
int fdn = -1;
int parm = 0;
struct timeval t1, t2;
double spendtime;
if((fdn = open ("/dev/ttyS0", O_RDWR)) < 0){
fprintf(stderr,"Can open port \n");
exit(-1);
}
tcgetattr(fdn, &tio);
tio.c_cflag = CS8 | PARODD | B1200 | PARENB | CREAD | CLOCAL; // parity, baudrate
tio.c_iflag = IGNBRK | INPCK;
tio.c_lflag = 0;
tio.c_oflag = 0;
tio.c_cc[VMIN] = 1; // no input buffering
tio.c_cc[VTIME] = 0;
tcsetattr(fdn, TCSANOW, &tio);
// set start time
gettimeofday((struct timeval*)&t1, NULL);
// write some data (216mS)
write(fdn, &teststring, sizeof(teststring));
// get first interval, internal kernel handling
gettimeofday((struct timeval*)&t2, NULL);
spendtime = (t2.tv_sec - t1.tv_sec) * 1000.0;
spendtime += (t2.tv_usec - t1.tv_usec) / 1000.0;
printf("mark 1 offset = %lf ms \n", spendtime);
// check TX_EMT
while(!parm)
ioctl(fdn, TIOCSERGETLSR, &parm);
// get second interval, all data should be written
gettimeofday((struct timeval*)&t2, NULL);
spendtime = (t2.tv_sec - t1.tv_sec) * 1000.0;
spendtime += (t2.tv_usec - t1.tv_usec) / 1000.0;
printf("mark 2 offset = %lf ms \n", spendtime);
return(0);
}
reply other threads:[~2013-09-30 6:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11144439.5yyClnqeWI@sepc002 \
--to=k.schoenmakers@sigmae.nl \
--cc=linux-serial@vger.kernel.orglinux-serial \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.