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

RS 485 with Fast Timer API ???

Hi there,

i have to communicate over 2 wire RS 485. I use the 485 implementation 
and it is working fine. But i need to have to set the RTS line high 
about 2 ms before sending and set it low  2 ms after sending.
I enabled the fast timer with xconfig and used "make kernel" and tried 
my program again. But then before anything is sent i got this kernel panic:

Unable to handle kernel access at virtual address 04000000
Oops: 0000
IRP: c005f3f6 SRP: c0061b98 DCCR: 00000480 USP: 9ffff49c MOF: 00000000
 r0: c082ded4  r1: 04000000   r2: 000000a0  r3: c0111f80
 r4: 00000002  r5: 0000000c   r6: 00000000  r7: 00000003
 r8: b0000098  r9: 0400000c  r10: 0400000c r11: 00000000
r12: 00000000 r13: 00000004 oR10: 0400000c
R_MMU_CAUSE: 0400100e
Process swapper (pid: 0, stackpage=c0110000)

Stack from 9ffff49c:
       0008c3d5 08c0b501 092b4800 09342400 09344800 08e07800 08e17400 
       00000000 00000000 00000000 0886f400 00000000 27100000 00000000 
       cd000000 009ffff4 0008c3f5 01000201 ffffffff ffffffff 09560d01 
Call Trace: [<d7ad0000>]
Stack from c0111dec:
       c00083b8 c0111f2c c005f7da c005f93e 00000000 00000000 04000000 
       c00e3970 00000000 c0111ee8 c005fa10 c0111ee8 c082a010 c00083b8 
       b0000098 00000003 00000000 0000000c 00000002 c0111f80 c0111ee8 
Call Trace: [<c00083b8>] [<c005f7da>] [<c005f93e>] [<c005fa10>] 
[<c00083b8>] [<c0062c56>] [<c0067050>]
       [<c000e020>] [<c000e0a0>] [<c0062a50>] [<c005f5fa>] [<c0061b98>] 
[<c005f3f6>] [<c006046a>] [<c005e8b4>]
       [<c005fb0a>] [<c005e8b4>] [<c005e8be>] [<c005e908>] [<c005e8be>] 
[<c005e906>] [<c000407a>]
Code: 48 d5 6c ca 6a 96 00 92 4a d5 6a aa (69) bb e8 bb 6a c7 48 d5 ec 
cb 62 96
Kernel panic: Aiee, killing interrupt handler!

Does anybody know why i get this panic if i only want to send something 
over 485 (9600 Baud)?

My Send code is like that:

  rs485_write io485;
  io485.outc_size = size;
  io485.outc = data;
  ioctl(fd, TIOCSERWRRS485, &io485);

My Init code is like that:

  rs485_control ctrl485;
  struct termios termioAttr;

  fd = open ("/dev/ttyS3", O_RDWR);
  if (fd == -1)
    cout << "Error opening device \n";
  // Enabling RS 485 mode of the serial driver
  memset(&ctrl485, 0, sizeof(ctrl485));
  ctrl485.rts_on_send = 0;
  ctrl485.rts_after_sent = 1;
  ctrl485.delay_rts_before_send = 0;
  ctrl485.enabled = 1;
  ioctl(fd, TIOCSERSETRS485, &ctrl485);
  if (tcgetattr(fd, &termioAttr) == -1)
    throw TLSOSI2BaseException("Kann termioAttr nicht auslesen");
  if (cfsetispeed(&termioAttr, (speed_t) B9600) == -1)
    throw TLSOSI2BaseException("Kann Input Baudrate nicht setzen");
  if (cfsetospeed(&termioAttr, (speed_t) B9600) == -1)
    throw TLSOSI2BaseException("Kann Output Baudrate nicht setzen");
  // Databits = 8
  termioAttr.c_cflag &= ~CSIZE;
  termioAttr.c_cflag |= CS8;
  // StopBits = 1
  termioAttr.c_cflag &= ~CSTOPB;
  // Parity
  termioAttr.c_iflag |= INPCK;
  termioAttr.c_cflag |= PARENB;
  termioAttr.c_cflag &= ~PARODD;
  if (tcsetattr(fd, TCSANOW, &termioAttr) == -1)
    throw TLSOSI2BaseException("Kann termioAttr nicht setzen");

I'm glad about every hint. If the implementation is not comlete for fast 
timer API ans 485 then i have to write my own driver but i have not so 
much time.

Best regards