[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RS485 lock up



Hi all,
 
I'm having some trouble with RS-485 mode on ttyS3 - enabling 485 mode,
then writing a lot of data to the port causes a lock-up of the board.
This seems to happen on both the MCM and the devboard lx with serial.c
v1.40.

In the real world we do not push the port this hard, but once in a while
we see locked-up products, so think this may be the cause.
 
Disabling fast timers seems to resolve the problem, however the data
rate drops significantly ... is there a newer version of serial.c which
I can use with the SDKs for the MCM and devboard lx?
 
The code below demonstrates the issue.
 
thanks,
 
Chris
 
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <sys/ioctl.h>
#include <asm/types.h>
#include <asm/rs485.h>
 
void rs485_on(int fd)
{
  struct rs485_control rs485data;
  int rv;
  memset(&rs485data,0,sizeof(rs485data));
  rs485data.rts_on_send=0;
  rs485data.rts_after_sent=1;
  rs485data.delay_rts_before_send=0;
  rs485data.enabled=1;
  rv=ioctl(fd, TIOCSERSETRS485, &rs485data);
}
 
int main()
{
  int fd = open("/dev/ttyS3", O_RDWR | O_NOCTTY ); 
  int x = 0;
  rs485_on(fd);
 
  while (1)
  {
    printf("write %d\n", x++);
    write(fd,"\x9A\x00",2);
  }
}
 
-- 
Chris Poole 
Row Seven Ltd 
http://www.rowseven.com <http://www.rowseven.com/>  

Tel: +44 (0)20 7354 0999 
Fax: +44 (0)20 7354 3999 
Vid: +44 (0)20 7226 9568