I'm a quasi-newbie in Linux technical questions, so sorry for any inaccuracy! Sorry for my english, too!

I bought a Sheevaplug and I need to use it to acquire data from some sensors connected to the Sheeva's USB plug via a RS485_to_USB converter. The chip installed on the converter is a ftdi ft232bl, and the converter itself is this one: http://www.dghcorp.com/usb/ .

Actually I don't know:1. if the 2.6.22.18 kernel has some drivers for this kind of converter (I found some drivers for the 2.4.x kernels, but none for the 2.6.x ones);2. which is the correct device name in /dev/ to use: I thought I was able to find a /dev/usb/ttyUSBx device, but I'm just finding some ttys and usbdev1.x [tty, tty0, tty1, ...., tty63, ttyS0, ..., ttyS3, ttyp0, ..., ttypf, usbdev1.1, usbdev1.1_ep00, usbdev1.1_ep81, usbdev1.2, usbdev1.2_ep00, usbdev1.2_ep02, usbdev1.2_ep81].

I really need some help, so I hope someone out there can give me some advices (some GOOD advices! )!!!

I still didn't wrote any line of java code to communicate with the sensors, but I'm very confident that on the laptop I will be able to use them.So my question is: is there a way to load the correct ftdi_sio driver in the Sheevaplug? How? Can someone out there help me providing a step-by-step (very, very verbose!) guide? I would really appreciate your efforts!

My "best" advice would be to upgrade the SW on your plug to something more recent which would make "finding" drivers easier. Having written that, I realize not everyone wants to do this so your only other choices (that I see right now) are to either, as you said, find the ftdi_sio driver for the kernel you are using OR build the driver from source yourself.

RS-485 has an address associated with each attached device, right? I have not looked at the IO control interfaces in the Linux serial driver. Do you know if the standard drivers support the 485 protocol? Sorry for the questions; but, I'd hate for you to get all of the drivers you need and still not be able to talk to the hardware in a manner you want.

I would hope that a 422/485 interface would very much look like a standard serial port - it is basically a standard UART with a different hardware interface (to the world). IE a 232 device has ground, transmit and receive pins (plus a bunch of optional signal control pins) The 485 interface has a differential (+/- pair) for receive and transmit. This allows one to send high speed signals over long distances. Long ago I set up a snow making system at Whistler with more than a mile of wire between the control computer and the hydrants & sensors we were controlling.

So assuming you get a driver loaded, it will probably look like a serial port. The big issue with 485 software, is that you may be operating in a mode where the transmit and receive pairs are tied together onto a single pair so that you see whatever you transmit. In this case, you need to turn off the transmitter after sending a message out to your instrumentation in order to get a reply back. In transmit mode the controlling transmitter is driving the line levels and only one transmitter can do that at a time. The trick here is determining when you've finished sending. Even with a 1 character hardware send buffer you may get a buffer free interrupt before the last bit is out. If you turn the line around too soon, you'll clobber the last few bits (or bytes) of the message you just sent. Two solutions without an interrupt that tells you that the transmit buffer is truly empty)

1 - wait a bit until the buffer is surly free2 - look at the data you've just sent until you see it all (since the receive pair is tied to transmit)This latter method will work with a standard 232 serial port driver.

I typically used an external 232 - 485 converter which has hardware built in to turn the line around as needed.

I'm not sure I understand what dlh was telling, anyway it seems that the very first step is to have a properly working driver.I tried to install the 1.0 Installer, but I was not lucky. Maybe I'm missing some points, but when I start the runme.exe with "nand" option, I get some informations and then everything seems to suddenly stop. I'm going to try it again, probably I will be able to have a ftdi_sio driver correctly loaded. By the way: why /proc/modules/ is empty?

I used the installer to set up ubuntu on an SD card, did an apt-get update/upgrade and then installed an up to date kernel ( Currently using Linux ubuntu 2.6.33)

When you attach the USB 485 it will appear in /dev as ttyUSBx (Where x is the next availible number).I use a udev rule filter to symlink the /dev/ttyUSBx to /dev/usbserial so my C application can check and use /dev/usbserial instead of trying to find out which ttyUSBx is the 485 device

You can then treat it like a normal serial port, my USB to 485 automatically does the direction line switching not sure that's a function of the chip or my board so be aware of that.

Thank you again for all of your efforts in helping me! I appreciate very much!

I was figuring that the problem was related with the old kernel shipped with the Sheevaplug - and I was right!I just installed the Installer-1.0 and (after some pain!) I was able to correctly see a /dev/ttyUSB0 device.

I have installed openjdk to install my Java programs and everything is going on fine.I'm going to use an USB HDSPA modem to upload data to a remote server, and it works very well.

Next step will be to control the RS485 port via a Java program. I'm currently using librxtx-java that seems to work fine.

@CarlMLE: I'm not able to write a complex C program, so I really need Java code (that is much simpler for me). Anyway probably you could help me again: my old acquisition software is written in basic and it mainly just open the com port, write a string on it to ask data, listen to get data (written in a string with a command like this

Quote

str$ = input$(#comport, lof(#comport))

and closes the com port. I'm trying to replicate the same behavior in my new Java program, but on the read the program hangs waiting for data. Do you have some advices, since it's my very first attempt to control a com port through a Java program? Thank you in advance!

Our projects are very similar, mine also uses a HDSPA usb modem to upload data, another tip, I had to update the kernel to add in PPP support so I could dial the modem, with out PPP support in the kernel I could not get a connection.

A lot of things are messing in this pseudo-code I wrote, but the point is that the ouputStream.write seems to do correctly his dirty jpb, while the instruction "inputStream.available()" constantly returns 0, even when it should find some data.

My only thought is related with the "open" command in basic:

Quote

open "COM9:9600,n,8,1,cs,ds,rs" for random as #dgh

Should I use the same parameters (cs, ds, rs) in my Java program too? How?Or the problem is buried much deeper, probably in the way RS485 protocol should be used? Maybe I'm wrong, but in the basic code I was using nothing seems to be too hard to understand and implement in a similar Java program. The result, however, is that the basic code is working, while my Java code not!

Found and solved the problem! Maybe it will be useful to someone else.It was very simple!

While in basic the "print #" statement prints a string ending with a newline character, the Java .write statement doesn't! It was a simple matter to add a "\r" at the end of the string to send on the rs485 converter the correct command.