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

RE: RS485 line turnaround




Thanks for the info, however I still cannot seem to get it to work. I
think it must be a kernel configuration issue. In the 'Drivers for ETRAX
100LX built in interfaces' I have 'RS-485 support' enabled,  'RS-485
mode on PA' disabled and 'Disable serial receiver' enabled. I think this
is how it is supposed to be. I used the code snippet below and it
compiled fine, but when run the write() commands do not alter the RTS
line. I have monitored this signal with a scope, and on pin 3 of D24 (ie
the transmit enable pin of the 485 transceiver) there is no activity.
The data itself is reaching the chip but it is never being transmitted. 
In normal user mode, when I manually change the RTS line, everything
works fine. This is with the same kernel. 
Is there any other tricks or settings that I am not aware of?

Thanks,

Andrew


-----Original Message-----
From: Bernhard Roessmann [mailto:roessmann@xxxxxxx.net] 
Sent: Monday, 16 August 2004 8:51 p.m.
To: Mailingliste Etrax
Subject: RE: RS485 line turnaround

Hi Andrew,

first, you have to enable "RS-485 support" in "Drivers for ETRAX 100LX 
built-in interfaces" (e.g. using "make menuconfig").

See the following (hopefully correct) code-snippet for an example of 
using this "kernel RS485 mode". I got approximately 120us send/receive 
switch time using this.

//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);

//You can use now ordinary write() to send data, it
//automagically switches to send mode before writing
//an switches back to receive mode after writing (using
//the RTS pin)



regards,

-- 
Bernhard Roessmann
Don't Fear The Penguins!