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

RS485 success!



Johan, Jonas:

I want to thank both of you for all your help. I have /dev/ttyS3 in both
RS485-4wire and RS485-2wire modes working. You might want to put a note
in the kernel configuration that 485 support should not be enabled.
Also, why are both /dev/ttyS1 and /dev/ttyS3 disabled by default?

Thanks again,

Ujwal


On 03 Jul 2001 01:31:32 +0200, johan.adolfsson@xxxxxxx.com wrote:
> 
> ----- Original Message -----
> From: Ujwal S. Sathyam <ujwal@xxxxxxx.com>
> To: <johana@xxxxxxx.com>
> Sent: Tuesday, July 03, 2001 12:27 AM
> Subject: Re: Kernel compile error with RS485
> 
> 
> > Thanks a lot. What is char_time? Is that the time to transmit 1
> > character calculated based on baud rate?
> 
> Yes, there are code that does that in elinux/drivers/char/etrax100ser.c
> 
> > Or is it some constant defined
> > somewhere? Our timings for talking to a device usually involves a few
> > hundered milliseconds between write and read, ie:
> Then it's probably no problem, I now there are some devices that responds
> within a few milliseconds, those are trickier and need the kernel solution.
> 
> > serialWrite(fd, buf, len);
> > usleep(SLEEP_TIME);
> > serialRead(fd, buf, len);
> >
> > Given that, I can probably safely toggle RTS.
> >
> > Also, I assume
> > set_rts_to_tx_mode(fd) means
> >
> > flag |= TIOCM_RTS;
> > ioctl(fd, TIOCMSET, &flag);
> >
> > and set_rts_to_rx_mode means:
> >
> > flag &= ~TIOCM_RTS;
> > ioctl(fd, TIOCMSET, &flag);
> >
> > where flag has previously been obtained by ioctl(fd, TIOCMGET, &flag);
> 
> Looks ok, or use TIOCMBIS and TIOCMBIC instead.
> 
> > Thanks,
> >
> > Ujwal
> 
> /Johan
> 
> 
> > On 02 Jul 2001 21:04:12 +0200, johan.adolfsson@xxxxxxx.com wrote:
> > > Depending on the timing requirement of the RS-485 device you
> > > can probably do the RTS toggling in the user mode application.
> > > Perhaps use tcdrain() and gettimeofday() to know when it's safe to
> > > toggle teh RTS to set receive mode.
> > > (get_lsr_status() in serial.c does not take the last char in the shift
> > > register
> > > into account, see elinux code for that.)
> > >
> > > set_rts_to_tx_mode(fd);
> > > write(fd,data, len)
> > > tcdrain(fd);
> > > gettimeofday(&t0,NULL);
> > > do{
> > >   gettimeofday(&t1,NULL);
> > > }while(((t1.tv_sec-t0.tv_sec)*1000000+t1.tv_usec-t0.tv_usec)<
> char_time);
> > > set_rts_to_rx_mode(fd);
> > >
> > > /Johan
> > >
> > >
> > > ----- Original Message -----
> > > From: Ujwal S. Sathyam <ujwal@xxxxxxx.com>
> > > To: Jonas Holmberg <jonashg@xxxxxxx.com>
> > > Cc: dev-etrax <dev-etrax@xxxxxxx.com>
> > > Sent: Monday, July 02, 2001 5:29 PM
> > > Subject: RE: Kernel compile error with RS485
> > >
> > >
> > > > the port /dev/ttyS3 failed to open because I had not enabled it in the
> > > > kernel config and recompiled the kernel. Now that I enabled it, it
> > > > works. So I should be able to use 4-wire 485 on that port then without
> > > > explicitly enabling 485 in the kernel? Can I also use 2-wire?
> > > >
> > > > Thanks,
> > > >
> > > > Ujwal
> > > >
> > > >
> > > > On 02 Jul 2001 13:05:39 +0200, Jonas Holmberg wrote:
> > > > > > So I figured out that I have to recompile the kernel with ser3
> > > > > > (/dev/ttys3) enabled to use the port. I also turned on RS485
> support.
> > > > > > But now the kernel compile with "make kernel" fails. I
> > > > > > thought I caught
> > > > > > a bug in
> > > > > >
> > > > > > /usr/local/axis/devboard_lx/os/linux/arch/cris/drivers/serial.h
> > > > > >
> > > > > > where CONFIG_RS485 should probably be CONFIG_ETRAX_RS485.
> > > > > >
> > > > > > But it still would not compile. Here is the error after I
> > > > > > made the above
> > > > > > change. Is RS485 support complete on the devboard?
> > > > >
> > > > > The RS485-code comes from the 2.0.38 kernel and hasn't been ported
> yet.
> > > But from what I've heard you should be able to use the port in four-wire
> > > mode without enabling CONFIG_ETRAX_RS485. What went wrong when you tried
> to
> > > open() the port?
> > > > >
> > > > > brdgs
> > > > > /Jonas
> > > > >
> > > >
> > > >
> > >
> >
> >
>