why I can't receive char from serial port?

1.I start serial port service by “devc-8250 &”
2.setup parameter for port
if ( ( fd = open ( “/dev/ser1”, O_RDWR) ) != -1 )
{
struct termios termios_p;
tcgetattr( fd, &termios_p );
cfsetispeed( &termios_p, 4800);
cfsetospeed( &termios_p, 4800);
tcsetattr( fd, TCSADRAIN, &termios_p );
flag |= CS8 | CREAD ;
flag &= ~CSTOPB;
flag &= ~PARENB;
termios_p.c_cflag = flag;
tcsetattr( fd, TCSADRAIN, &termios_p );
}
3.read(fd,buffer,size);

but I receive nothing,“read” is blocked,in fact,even if I use “cat /dev/ser”,I can receive nothing,why?

What’s connected to the serial port?
Is it sending anytihing?
Is your cable okay?
You could try ‘qtalk -b4800 -m/dev/ser1’ to communicate.

Martin.

the cable is ok,I can receive on windows,I try “qtalk” and receive nothing

who can give me any suggestion?

Maybe a handshaking problem?

Can you post the output of ‘stty < /dev/ser1’?

Rick…

my IBM notebook(type is T41) can not be supported by devc-ser8250,who knows how to do?

I have experienced problems with serial ports and Pentium 4 computers, both on QNX4 anx QNX6. Something with interrupts and serial port seems to be broken. This is the workaround that helped me on several of those boards:

periodically (e.g. 1 per second) disable interrupts on serial chip and instantly reenable them
e.g. outp(base+1, 0); outp(base+1, 0xf)

Could be that you need to configure the I/O address and the IRQ of the serial port with devc-ser8250 ?
Sometimes it is not enough just to write devc-ser8250 &.

I had several problems with it in the past. In the next link there are some
comments about how to configure the I/O address and IRQ if you need it.

openqnx.com/PNphpBB2-viewtopic-t1903-.html

Anyway, try first with qtalk to communicate with the device.

I hope it helps

on my IBM notebook there’s no serial port,I have to buy one special extend device made by IBM that has several port(like rs232),who have used before under qnx?

More than likely it won’t work under qnx then - unless you have the specs to write your own driver. Do you know how it connects (from an internal point of view?) Where do the serial ports show up, address/irq wise in windows? Do you need a special driver in windows for it?

Rick…

in windows,no driver is needed,the address is 3f8,irq is 4.