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

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