ttyS3 and ttyS2 dont work together

hi all, i am using sbc6300x from embest, with linux 2.6-24, the kit has one com port for debug and 3 com ports for serial connection as ttyS1,ttyS2 and ttyS3.

i can use ttyS3 for connecting to pc via Rs232 but unable to use other ports.

any idea is appreciated for solving this problem. thnks

--------------------------------------- Posted through

formatting link

Reply to
askaliaar
Loading thread data ...

Have you contacted the vendor? Seems like they would have the answer ready for you!

Reply to
Don Y

By all means talk to the vendor first.

There may be some conflict with a shared interrupt, or the order of initialization. Have you tried initializing only ttyS2, for example, when you try using that port?

-f

Reply to
cassiope

Are you sure there are even real /dev entries for each of those devices? Are there getty's running on them? Do you have the right ioctl's in place? etc.

(i.e., there's way too much information missing, here, to comment -- unless you happen to have the same device in front of you and have been through similar experiences. The vendor is your support group. Use him/it. If he can't answer your questions, then find another product and another vendor!!)

Reply to
Don Y

com

and

thanks all, i have talked to the vendor about the subject, they sayed that have tested the kits. anyway i checked and saw that ttyS1 and ttyS3 can be used together.

so i used ttyS3 as Rs232 connection with pc and ttyS1 for connecting with another device that is working well. i used ONE signal handler for both tty as below:

static void COM_signal_handler(int sig, siginfo_t *info, void *data) { //some code here. }

void open_ttyS1(void) { struct termios newtio; struct sigaction saio;

fd_s1 = open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NONBLOCK);

saio.sa_flags = SA_SIGINFO; saio.sa_sigaction = COM_signal_handler; saio.sa_flags = SA_SIGINFO; saio.sa_restorer = NULL; sigaction(SIGIO, &saio, NULL); fcntl(fd_s1, F_SETOWN, getpid());

fcntl(fd_s1, F_SETFL, FASYNC);

newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; // newtio.c_cflag &= ~CRTSCTS;

newtio.c_iflag = IGNPAR | ICRNL; newtio.c_oflag = 0;

newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);

newtio.c_cc[VMIN] = 10; newtio.c_cc[VTIME] = 0; tcflush(fd_s1, TCIFLUSH); tcsetattr(fd_s1, TCSANOW, &newtio); }

void open_ttyS3(void) { struct termios newtio; struct sigaction saio;

fd_s3 = open("/dev/ttyS3", O_RDWR | O_NOCTTY | O_NONBLOCK);

saio.sa_flags = SA_SIGINFO; saio.sa_sigaction = COM_signal_handler; saio.sa_flags = SA_SIGINFO; saio.sa_restorer = NULL; sigaction(SIGIO, &saio, NULL); fcntl(fd_s3, F_SETOWN, getpid());

fcntl(fd_s3, F_SETFL, FASYNC);

newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; // newtio.c_cflag &= ~CRTSCTS;

newtio.c_iflag = IGNPAR | ICRNL; newtio.c_oflag = 0;

newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);

newtio.c_cc[VMIN] = 10; newtio.c_cc[VTIME] = 0; tcflush(fd_s3, TCIFLUSH); tcsetattr(fd_s3, TCSANOW, &newtio); }

The man pages for sigaction says that with above opening of ports, i must get the device file descriptor when signal occures and i can get it as info->sa_fd in signal handler then with inspect of it, i can know which of ttys has sent the data. but always the above field is filled with zero. thanks & best regards

--------------------------------------- Posted through

formatting link

Reply to
askaliaar

IIRC, you have to use fcntl(fd, F_SETSIG, ...) in order for si_fd to be filled in.

Reply to
Nobody

it

with

Dear, hi, i used fnctl(fd_s1, F_SETSIG, getpid()) in place of fcntl(fd_s2, F_SETOWN, getpid()). but i were not able to get file descriptor of signal sender.

best regards.

--------------------------------------- Posted through

formatting link

Reply to
askaliaar

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.