0

i try to communicate with Denkovi relay board (FTDI) with a mac. If i try to open the FTDevice i get the excepction:

com.ftdi.FTD2XXException: D2XX error, ftStatus:INVALID_HANDLE

I installed the newest FTDI drivers.

I found this post: Using Java to access SainSmart 4 Relay with Mac OS 10.8.5 doesn't work

They write that the problem is the 64 bit JVM. But this was 4 years ago. Is there a solution now?

With the Denkovi original Software (Java too) i can communicate with the board. But i have only the Jar so i couldn't see the code how they do it.

My code:

         public static void main(String[] args) {
    FTDevice usb16Relay;
    List<FTDevice> fTDevices;


   byte[] command = new byte[5];
    try {
            fTDevices = FTDevice.getDevices();
            usb16Relay = fTDevices.get(0);  

            System.out.println(usb16Relay.getDevDescription());
            System.out.println(usb16Relay.getDevID());
            System.out.println(usb16Relay.getDevSerialNumber());

            usb16Relay.open();
            usb16Relay.setBaudRate(9600);
            usb16Relay.setDataCharacteristics(WordLength.BITS_8, StopBits.STOP_BITS_1, Parity.PARITY_NONE);

            command[0]='x';
            command[1]=1;
            command[2]=0;
            command[3]='/';
            command[4]='/';

            usb16Relay.write(command);
            usb16Relay.close();
    } catch (FTD2XXException ex) {
       ex.printStackTrace();
    }
}
Kevin Jedynak
  • 133
  • 1
  • 1
  • 9
  • You could try to use a java decompiler to see what's happening inside the jar file. – AntiqTech Jul 03 '19 at 06:56
  • You mentioned the other post already. Did you try the suggested solutions there? Especially the -d32 switch thingy? Alternatively you could try to avoid using the D2XX access and use the VCP if the boards supports that (which seems to be the case for many of their boards). – Christian B. Jul 03 '19 at 08:23
  • Thanks for your answer. I don't know what they mean with the -d32 switch thing. I need to change my java version to 32 bit.. but do i need to do this in netbeans or in the java config? And how? – Kevin Jedynak Jul 03 '19 at 14:39
  • did you check https://stackoverflow.com/questions/6942063/how-to-run-32-bit-java-on-mac-osx-10-7-lion and similar? What about the VCP option? Did you look into that? – Christian B. Jul 03 '19 at 18:56

0 Answers0