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

RE: 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!