Hi,

Please can you help me with special RS-232 communication.
I want to use Linux to communicate with EIB bus thru RS-232.
I have some message n bytes long, and I tried to send with read(),
write() and CTS RTS functions.

But I have only 130ms to send this message. If this message
is more than 9 bytes long, timeout appear and otherside resets.
Can I use  another access to serial port for faster communication ?

Only four lines (TxD, RxD, CTS, RTS) are used as follows:

-set RTS and wait for CTS to come up
-send n, receive byte
-clear RTS and wait for CTS to come down

-set RTS and wait for CTS to come up
-send 1.byte, receive byte
-clear RTS and wait for CTS to come down

...

-set RTS and wait for CTS to come up
-send n.byte, receive byte
-clear RTS and wait for CTS to come down

Thanks for any kind of information,

Pavel Kucera
Mathematics and Physics Faculty
Charles University

This is function, which send 1 byte from message:

int exchangeBYTE(unsigned char *in, unsigned char *out) {

 int odpoved,odpovedw;
 unsigned long int timeout;

 printf("    Exchange ... ");    // RTS and CTS down
 setRTS(1);

 timeout=0;
 while(!getCTS() && ((timeout) < WAIT_FOR_CTS)) timeout++;
 if (!getCTS()) {
  printf("\nTimeout to wait for CTS up!\n");
  setRTS(0);
  usleep(10000);
  return -1;
 } else  printf("CTS&RTS down ... ");

 odpovedw=0; odpoved=0;   // exchange byte
 timeout=0;
 while ((odpovedw<1 || odpoved<1) && ((timeout) < WAIT_FOR_READ)) {
  if (odpovedw < 1) odpovedw = write(portfd,out,1);
  if (odpoved < 1) odpoved = read(portfd,in,1);
  timeout++;
 };
 if (odpovedw < 1) {
  printf("\nTimeout to write byte!\n");
  setRTS(0);
  return -2;
 };
 if (odpoved < 1) {
  printf("\nTimeout to read byte!\n");
  setRTS(0);
  return -2;
 } else printf("read: %x, send %x ... ",*in,*out);

 setRTS(0);     // RTS and CTS up
 timeout=0;
 while(getCTS() && ((timeout) < WAIT_FOR_CTS)) timeout++;
 if (getCTS()) {
  printf("\nTimeout to wait for CTS down!\n");
  setRTS(0);
  return -3;
 } else  printf("CTS&RTS up.\n");

 return 0;
};







-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [EMAIL PROTECTED]

Reply via email to