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

Re: Again: RS485 line turnaround



I find it strange that write() doesn't work after rs485ctrl.enabled
is set.
At one time we made a merge that caused the FIOQSIZE ioctl to clash
with the TIOCSERSETRS485 ioctl causing the rs485 config to fail
completely so rsd485.enabled is never set - using the ioctl to write
doesn't care about that though so that would still work and use the
default rs485 config, I didn't expect that version to be released though.

What kernel version are you using?

If you check os/linux/asm-cris/ioctls.h, does it have
#define FIOQSIZE       0x5460

#define TIOCSERSETRS485 0x5460  /* enable rs-485 */

which is wrong, or
#define TIOCSERSETRS485 0x5460  /* enable rs-485 */
#define TIOCSERWRRS485  0x5461  /* write rs-485 */

#define FIOQSIZE  _IOR('f', 128, loff_t) /* Get exact space used by quota */

which is correct?

/Johan

----- Original Message ----- 
From: "Andrew Radford" <andrew@xxxxxxx.nz>
To: "Frank Brown" <fcb3@xxxxxxx.net>
Cc: <dev-etrax@xxxxxxx.com>
Sent: Friday, August 20, 2004 5:39 AM
Subject: RE: Again: RS485 line turnaround


> Ahh that was it after all. Funny thing is I *had* that code in my
> program but remarked out, obviously there must have been another problem
> at the time which stopped it working then. I seem to have gone through
> all permutations but finally I have 2 wire RS485 going. So I needed
>
> -485 supported in the kernel config (under etrax specific hardware)
> -the 485 serial port enabled in the kernel config
> -initialisation of the 485 as following:
>
> //Include for ioctl struct
> #include <asm/rs485.h>
>
> //Init RS485
> struct rs485_control ctrl485;
> ctrl485.rts_on_send=0;
> ctrl485.rts_after_sent=1;
> ctrl485.delay_rts_before_send=0;
> ctrl485.enabled=1;
> ioctl(fd, TIOCSERSETRS485, &ctrl485);
>
> -write to the port using the ioctl method not write()
>
>  struct rs485_write      tx;
>
>        tx.outc_size = 7;
>        tx.outc = out_buff;
>        ioctl(fd, TIOCSERWRRS485, &tx);
>
>
> Thanks Frank, and all others who helped
>
> Andrew
>
>
>
>
> -----Original Message-----
> From: Frank Brown [mailto:fcb3@xxxxxxx.net]
> Sent: Thursday, 19 August 2004 4:22 p.m.
> To: dev-etrax@xxxxxxx.com
> Cc: OGurkan@xxxxxxx.com
> Subject: Again: RS485 line turnaround
>
> I went through the same frustration. I ended up
> putting some very direct code in one place.
> See the prior note about 9th bit routines.
>
> By the way, I used the special RS485 Ioctl
> stuff someone built in, not write(...).
>
> >
> > struct rs485_write      tx;
> >
> >       tx.outc_size = 7;
> >       tx.outc = out_buff;
> >       ioctl(serial_channel3, TIOCSERWRRS485, &tx);
>
>
> Look for rs485.h for rs485_write & TIOCSERWRRS485.
>
> I had to do the same bit by bit progress. Sometimes
> it feels like the tale about "the kid hitting himself
> in the head with a hammer cause it feels so good when
> he quits" is not apochryphal at all. But even a herd
> of turtles gets there sooner or later.
>
> Good Luck
>
> Frank Brown
> Phoenix Consulting
> for Emerson Climate Technology
> fcb3@xxxxxxx.net
>
>
>
>
>
>
>
>
>
>
>
>
>