Invalid checksum and Unsupported operating mode with java API.

Hello I have been working on using an raspberry pi with an Xbee.
So far i’m using my computer as the controller, I have downloaded the Xbee java library made by digi.

So far i wanted to modify a IO to high/low (lets start simple).
I tried sending it to a remote device got an error (seen at the end), when i got this i thought i’d try just with the local device. Same error.

Here is the piece of code and the error.

Thanks in advance guys !

Code

XBeeDevice myDevice = new XBeeDevice(PORT, BAUD_RATE);
myDevice.open();

            XBee64BitAddress addresseCapteur1 = new XBee64BitAddress("0013A2004146706F");

	RemoteXBeeDevice capteur1 = new RemoteXBeeDevice(myDevice, addresseCapteur1);
            
            myDevice.setIOConfiguration(IOLine.DIO4_AD4,IOMode.DIGITAL_OUT_LOW);

Error

SEVERE: Error parsing the API packet.
com.digi.xbee.api.exceptions.InvalidPacketException: Invalid checksum (expected 0xBD).
at com.digi.xbee.api.packet.XBeePacketParser.parsePacket(XBeePacketParser.java:192)
at com.digi.xbee.api.connection.DataReader.run(DataReader.java:409)

Jul 18, 2016 11:30:35 AM com.digi.xbee.api.XBeeDevice close
INFO: [/dev/tty.usbserial-AL016TA8 - 9600/8/N/1/N] Connection interface closed.
Exception in thread “main” com.digi.xbee.api.exceptions.InvalidOperatingModeException: Unsupported operating mode: AT mode
at com.digi.xbee.api.XBeeDevice.open(XBeeDevice.java:221)
at xbeepc.XbeePc.main(XbeePc.java:65)

I just wanted to add that i am working with two series 1 Xbee in API mode.

Whats more, for the same program the expected checksum varies, I find that a little odd.

Problem solved.

It appeared that having both Xbees plugged in to the computer was giving me that error.
Solved it by giving the other Xbee a separate power supply.
(also not quitting netbeans between two runs)

I am not familiar with this library but the following error message in the log may be at the root of your problem.

Unsupported operating mode: AT mode

Is your PC XBee operating in AT mode? Seems like the library was designed for API mode.

Problem solved.

It appeared that having both Xbees plugged in to the computer at the same was giving me that error.
Solved it by giving the other Xbee a separate power supply, and also quitting netbeans between two runs.

Don’t know which of both was the most critical but the basic programs work now.