Really high IRQ values???
I decided to place this question in the newbie section as it's probably a no-brainer.
I have attached a serial PCI card to my RHEL4 linux machine and the IRQ assigned to it is 209. Which seems rather high. The IO is 0x2440. Is this right? I thought interrupts only went so far. Also it's not in the IRQ table in /proc/interrupts. dmesg | grep tty gives this: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A ttyS4 at I/O 0x2440 (irq = 209) is a 16550A The new device is ttyS4. I need it to talk to an old allen bradley box but it's not working. How do I know if it's "installed" correctly? Have tried assigning a lower IRQ and IO with 'setserial' which has produced erroneous results. Please help. -Scrawny |
Let me start off by saying that I know very little about this.
I have a Davis Vantage Pro II weather station plugged into com1 and it just worked. I communicate with it using C++ programs that I have written. What are you using to communicate with your A-B box? To troubleshoot, can you unplug whatever you have hooked to com1 and try your A-B box there? |
Hi! I use some C code to open and read the port. It's falling over at a read statement:
status = read(iodevfdes,&c,1); According to the 'read' function in unistd.h '-1' is 'errors'. Here's the code: */ /* ** openpd open protocol handler device port ** */ #define IOSECS 8 /* seconds to wait for IO completion */ #include "/u/t35/include/global.h" #include "/u/t35/include/config.h" #include <sys/ioctl.h> #include <stdio.h> #include <signal.h> #include <fcntl.h> #include <termio.h> #include <unistd.h> /* ** global variables describing the device */ extern char *iodevname; /* device name (see configure) */ extern uint iodevioctl; /* required ioctl parameters (see configure) */ extern int iodevfdes; /* device file descriptor */ extern char evstr[]; void onint(); openpd() { extern void exit(); struct termio iob; /* * open the device as indicated in the config table * and setup the file descriptor */ if ((iodevfdes=open(iodevname,O_RDWR|O_NONBLOCK)) == BAD_OPEN) { sprintf(&evstr[0],"AMGR: Openpd : can't open %s\n",iodevname); frrlog(&evstr[0]); exit(-1); } sprintf(&evstr[0],"AMGR: Openpd: iodevname <%s>\n",iodevname); frrlog(&evstr[0]); sprintf(&evstr[0],"AMGR: Openpd: iodevioctl <%ld>\n",iodevioctl) ; frrlog(&evstr[0]); sprintf(&evstr[0],"AMGR: Openpd: iodevfdes <%ld>\n",iodevfdes); frrlog(&evstr[0]); /* * set up the opened port for RAW i/o */ if (ioctl(iodevfdes,TCGETA,&iob) == ERROR) { sprintf(&evstr[0],"AMGR: Openpd: can't ioctl %s\n",iodevname); frrlog(&evstr[0]); exit(-1); } iob.c_cflag = iodevioctl; /* tty control word */ iob.c_iflag &= ~IGNPAR; /* ignore parity errors */ iob.c_iflag &= ~INPCK; /* disable parity check */ iob.c_iflag &= ~BRKINT; /* ignore line breaks */ iob.c_iflag &= ~ISTRIP; /* don't strip bit 8 */ iob.c_oflag &= ~OPOST; /* no post process on o/p*/ iob.c_lflag = 0 ; iob.c_cc[4] = (char)1; /* MIN number of characters */ iob.c_cc[5] = (char)50; /* Time out .3 secs */ if (ioctl(iodevfdes,TCSETA,&iob) == ERROR) { sprintf(&evstr[0],"AMGR: Openpd: can't ioctl %s", iodevname); frrlog(&evstr[0]); exit(-1); } (void)ioctl(iodevfdes,TCFLSH,0); } /*********************************************************************** * * getcpd - gets a character from the handler's protocol device * **********************************************************************/ getcpd() { extern int status; char c; long time(); uint alarm(); #define DLEN 120 static char dbuf[DLEN]; static char *dp = &dbuf[0]; static char *dop; static int dcnt; char df, dc; try_again: (void)signal(SIGALRM,onint); /* set alarm signal for trap by onint*/ (void)alarm(IOSECS); status = read(iodevfdes,&c,1); (void)alarm(0); (void)signal(SIGALRM,SIG_IGN); if (status == -1) { sprintf(&evstr[0],"AMGR: Getcpd (amgr): -1 status\n"); frrlog(&evstr[0]); return (IO_TIMEOUT); } else if (status == 0) { sprintf(&evstr[0],"AMGR: Getcpd (amgr): 0 status\n"); frrlog(&evstr[0]); sleep(1); goto try_again; } else { return (c & 0377); } } |
I'm not clear whether your program is making it to this line:
Code:
if (status == -1) Quote:
|
Hmmmm... interesting point. The code does get to that point. I have inserted a couple of debug statements and the code:
Code:
sprintf(&evstr[0],"AMGR: Getcpd (amgr): -1 status\n"); I keep thinking it might be the hardware... Would the BAUD rate or the error checking or the XON/XOFF have anything to do with it? |
Could be the hardware. As I stated above I'm no expert, but ...
My serial device does not send data unless I send it a command. If the port is opened O_NONBLOCK, reading from it without sending a command (no data available) returns "-1". If I open and read from it without the O_NONBLOCK flag it returns "0" Seems to me you need to either remove the O_NONBLOCK from the open statement or change the code in the getcpd function to something like Code:
while ( x < 60 ) // a counter for how long you wait for data |
All times are GMT -5. The time now is 09:43 PM. |