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 http://www.EmbeddedRelated.com
ttyS3 and ttyS2 dont work together
Started by ●July 14, 2011
Reply by ●July 14, 20112011-07-14
On 7/14/2011 11:15 AM, askaliaar wrote:> 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.Have you contacted the vendor? Seems like they would have the answer ready for you!
Reply by ●July 15, 20112011-07-15
On Jul 14, 11:15=A0am, "askaliaar" <aliaar@n_o_s_p_a_m.processingworld.com> wrote:> 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 > > --------------------------------------- =A0 =A0 =A0 =A0 > Posted throughhttp://www.EmbeddedRelated.comBy 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 by ●July 15, 20112011-07-15
On 7/15/2011 9:45 AM, cassiope wrote:> On Jul 14, 11:15 am, "askaliaar" > <aliaar@n_o_s_p_a_m.processingworld.com> wrote: >> 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. > > 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?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 by ●July 16, 20112011-07-16
>On 7/15/2011 9:45 AM, cassiope wrote: >> On Jul 14, 11:15 am, "askaliaar" >> <aliaar@n_o_s_p_a_m.processingworld.com> wrote: >>> i am using sbc6300x from embest, with linux 2.6-24, the kit has onecom>>> port for debug and 3 com ports for serial connection as ttyS1,ttyS2and>>> 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. >> >> 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? > >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!!) >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 http://www.EmbeddedRelated.com
Reply by ●July 16, 20112011-07-16
On Fri, 15 Jul 2011 23:49:50 -0500, askaliaar wrote:> 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.IIRC, you have to use fcntl(fd, F_SETSIG, ...) in order for si_fd to be filled in.
Reply by ●July 18, 20112011-07-18
>On Fri, 15 Jul 2011 23:49:50 -0500, askaliaar wrote: > >> 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 getit>> 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 filledwith>> zero. > >IIRC, you have to use fcntl(fd, F_SETSIG, ...) in order for si_fd to be >filled in. > >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 http://www.EmbeddedRelated.com