Reputation: 1851
I'm trying to communicate with th DLP-IO20 board on linux (ubuntu) but I get an error every time. The same program under windows works well.
In order to communicate with the board, I first installed all the FTDI drivers, then I generated a library for linux libjd2xx.so
Now when I try to run the Main program of the JD2XX.java file I get the following error:
index: 0, flags: 0x0, type: 0x5, id: 0x4036001, location: 0x204, serial: 12345678, description: DLP-IO20, handle: 0x0 Exception in thread "main" java.io.IOException: invalid handle (1)
As you can see the board information are read by the program but when it tries to send a command to the board the above exception is thrown. The row that thrown an exception is the last one on the following code:
DeviceInfo di = jd.getDeviceInfoDetail(0);
System.out.println(di.toString());
jd.open(0);
String msg = "Hello dude. This is the message.";
int ret = jd.write(msg.getBytes());
Any suggestion?
Upvotes: 2
Views: 893
Reputation: 4173
The following is not a Java answer but illustrate how to communicate very simply and directly with the DLP-IO8 without installing any driver, maybe this can help you with your DLP-IO20
On linux devices are abstracted by a file (unlike on for eg Windows where you must call functions of .dll
to access devices).
So when I plug my DLP-IO8 in the USB port, the /dev/ttyUSB0
file appears. (It might vary so you can run dmesg
in a terminal and it will display a log of all USB devices that were connected/disconnected and their location so you can deduce where is located your DLP-IO8)
Now you don't need any driver or anything. /dev/ttyUSB0
is recognized and correspond to your DLP-IO20 so you're good to go, you can write/read to /dev/ttyUSB0
in order to write/read to your DLP-IO8.
So from the DLP documentation you have to communicate at a baud of 115200. You can set this baud value with :
sudo stty -F /dev/ttyUSB0 115200
Still from the DLP documentation, if you want to get the voltage value on the channel 1, then you have to send the ascii character 'Z'
to the DLP-IO8. So open two terminals, in one of them run:
sudo cat /dev/ttyUSB0
in order to see what's returning the board. With the other terminal run:
echo -en '\x5A' > /dev/ttyUSB0
in order to send the character 'Z'
( whose ascii number is 5A
in hex). Now you should see your voltage value in the 1st Terminal.
So if you don't know how to do in pure Java, you can always execute those system commands from Java.
Upvotes: 1
Reputation: 760
Try running the read example program supplied with the FTDI drivers (under release/examples/EEPROM/read if I recall). See if that has any problems.
If you're desperate, see if ftdi_sio is installed and try removing it with 'rmmod ftdi_sio' (that's what worked for me)
Upvotes: 0