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

Re: rs485 2-wire on devboard 82?




----- Original Message ----- 
From: "Ken Klinner" <ken@xxxxxxx.com>
To: <dev-etrax@xxxxxxx.com>
Sent: Wednesday, June 18, 2003 11:54 PM
Subject: rs485 2-wire on devboard 82?


> I understand that rs485 in 2-wire mode will use only the RX pins but I see
> my transmissions on the TX pins and never on the RX pins. Any idea what
I'm
> doing wrong? I am using the following code on a devboard 82 with kernel
> 2.4.20 configured for rs485, fast timers and rs485_disable_receiver.
>
> struct rs485_ctrl ctrl485;
> struct rs485_wrt io485;
> int result;
>
> ctrl485.rts_on_send = 0;
> ctrl485.rts_after_send = 1;
> ctrl485.delay_rts_before_send = 0;
> result = ioctl(fd, TIOCSERSETRS485, &ctrl485);
>
> io485.outc_size = len;
> io485.outc = data;
> result = ioctl(fd, IOCSERWRRS485, &io485);
>
>
> -Ken
Hi,

Looks ok, although there is a field ctrl485.enabled as well, that allows you
to use ordinary write() instead of ioctl() to write data.

Seems like the RTS toggling isn't working for you,
please verify that the /SERIAL_INIT pin on PA0 is set to 0:
In the kernelconfig, make sure that the default value for PA0 is an output
and the value 0
E.g.
CONFIG_ETRAX_DEF_R_PORT_PA_DIR=1d
CONFIG_ETRAX_DEF_R_PORT_PA_DATA=f0
also, make sure that you disable the following options ("RS-485 on PA")
which shouldn't be enabled but they are in the 1.90 release:
CONFIG_ETRAX_RS485_ON_PA=y
CONFIG_ETRAX_RS485_ON_PA_BIT=0

You can check the value of the PA pins in runtime from a shell using
"hwtestserial -r" or "readbits -p a".

Hope that helps
/Johan