digidotcom / xbee-java

Set of Java APIs to interact with Digi International's XBee radio frequency modules.
Mozilla Public License 2.0
83 stars 56 forks source link

Digi Xbee communication error #128

Open Antonyab opened 6 years ago

Antonyab commented 6 years ago

Hello,

I am using the DIGI XBEE CELLULAR 3G GLOBAL Development Kit.The following details are mentioned on the digiXbee module : DIGI XBee Cellular 3G XBC-M5-UT-101 B 357520072985670 S# 08J8BAP87NQ4 Contains FCC ID : XPY1CGM6NNN IC: 8595A-1CGM5NNN

Can someone please help me to know if my module is programmable or not ? In fact, I am having the same issue mentionned in this link : https://github.com/digidotcom/XBeeJavaLibrary/issues/57 Summary of the issue : com.digi.xbee.api.exceptions.InvalidOperatingModeException: Could not determine operating mode.

I need to know what to do in order the solve this problem.

Thanks in advance.

Regards, Antony Abi Rached (Kalima Systems)

brandonmoser commented 6 years ago

@Antonyab what do you mean by programmable? Yes, the module is programmable but is not currently supported by this library, as noted [here].(https://github.com/digidotcom/XBeeJavaLibrary/blob/master/release_notes.txt) You'll need to use our XCTU application, https://www.digi.com/products/xbee-rf-solutions/xctu-software/xctu.

Antonyab commented 6 years ago

Thanks for the reply. In fact i am facing the same issue that is mentionned in the following link https://github.com/digidotcom/XBeeJavaLibrary/issues/57.

When i use a java api example with the digi xbee mounted on the demo board given in the kit, i can communicate normally with the module. When I connect the module directly to the uart of the raspberry pi, the same java api example is not working. I get the following error: com.digi.xbee.api.exceptions.InvalidOperatingModeException: Could not determine operating mode.

do you know the cause of this problem? Thanks for the help.

Regards, Antony

n Fri, Oct 5, 2018, 10:43 PM Brandon Moser notifications@github.com wrote:

@Antonyab https://github.com/Antonyab what do you mean by programmable? Yes, the module is programmable but is not currently supported by this library, as noted [here].( https://github.com/digidotcom/XBeeJavaLibrary/blob/master/release_notes.txt) You'll need to use our XCTU application, https://www.digi.com/products/xbee-rf-solutions/xctu-software/xctu.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/digidotcom/XBeeJavaLibrary/issues/128#issuecomment-427493275, or mute the thread https://github.com/notifications/unsubscribe-auth/AZp2y3w5iOg_IywjCFrSQLa04W_w2H-Cks5uh8R_gaJpZM4XK5Dy .

Antonyab commented 5 years ago

Hello again @brandonmoser,

I will explain for you the tests that I did with the module that I mentioned in my first post.

com.digi.xbee.api.exceptions.InvalidOperatingModeException: Could not determine operating mode.

I dont know the cause of this problem. The following issue https://github.com/digidotcom/XBeeJavaLibrary/issues/57 describe the same problem that I have. But after contacting the digi support, I got the following response:


I looked through that GitHub issue. The old Programmable XBee modules had a Freescale C processor that sat between the UART and the SOC, and that what was causing the issue reported on GitHub. The C processor had no code on it by default, and blocked communication between the UART and the SOC until it was explicitly put into serial bypass mode or loaded with some other application code. The new Xbee Cellular and XBee3 products, like the one that you have, feature embedded MicroPython which is integrated into the SOC and is not accessed unless AP is explicitly set to 4. So yes, the Xbee Cellular you have is programmable, but that is not what is causing your issue. If you have AP=1 for API mode, and you're still receiving that error, then you will want to file an issue on the GitHub repository. The XBee Libraries were designed for our previous ISM XBee products, and might not be updated for XBee Cellular products.


does someone know the cause of the problem that I am facing ?

Thanks in advance for your help.

Regards, Antony

brandonmoser commented 5 years ago

@Antonyab what operating mode are you running. The supported modes are 0-3, as found here.

Antonyab commented 5 years ago

@brandonmoser I am using API mode. the value of the variable AP is 1. In fact I configured this value using the XCTU application. I should also specify the mode in my java application?

Regards, Antony

brandonmoser commented 5 years ago

@Antonyab I think you should output your operating mode from the Java library to confirm it is seeing your AP value of 1. There may be an inconsistency or issue there, since the XBee Cell module is not currently supported.

Antonyab commented 5 years ago

@brandonmoser here is the code that tested like you told me.

package org.kalima.digi.xbee.tests;

import java.net.Inet4Address; import java.net.UnknownHostException; import com.digi.xbee.api.CellularDevice; import com.digi.xbee.api.exceptions.XBeeException; import com.digi.xbee.api.models.IPMessage; import com.digi.xbee.api.models.IPProtocol; import com.digi.xbee.api.models.OperatingMode;

public class MainApp {

/* Constants */
// TODO Replace with the serial port where your sender module is connected to.
private static final String PORT = "COM19";
// TODO Replace with the baud rate of your sender module.  
private static final int BAUD_RATE = 9600;
// TODO Optionally, replace with the text you want to send to the server.
private static final String TEXT = "Hello";

private static final String ECHO_SERVER_IP = "52.43.121.77";
private static final int ECHO_SERVER_PORT = 11001;

private static final IPProtocol PROTOCOL_TCP = IPProtocol.TCP;

public static void main(String[] args) {
    CellularDevice myDevice = new CellularDevice(PORT, BAUD_RATE);

    try {
        OperatingMode op = myDevice.getOperatingMode();
        System.out.println("Operating mode = " + op.toString());
        myDevice.open();

        System.out.format("Sending text to echo server: '%s'", TEXT);
        myDevice.sendIPData((Inet4Address) Inet4Address.getByName(ECHO_SERVER_IP),
                ECHO_SERVER_PORT, PROTOCOL_TCP, TEXT.getBytes());

        System.out.println(" >> Success");

        // Read the echoed data.
        IPMessage response = myDevice.readIPData();
        if (response == null) {
            System.out.format("Echo response was not received from the server.");
            System.exit(1);
        }
        System.out.format("Echo response received: '%s'", response.getDataString());
    } catch (XBeeException | UnknownHostException e) {
        System.out.println(" >> Error");
        e.printStackTrace();
        System.exit(1);
    } finally {
        myDevice.close();
    }
 }

}

If I print the operating mode before myDevice.open() => operating mode = Unknown. If I print the operating mode after myDevice.open():

Regards, Antony

brandonmoser commented 5 years ago

@rubenmoral do you have any suggestions?

Antonyab commented 5 years ago

@brandonmoser When I configure the variable AP using XCTU application to API Mode (API = 1), the configuration will be saved on the module or on the board? If on the board, that would explain my problem. So what do you think about that?

Regards, Antony

brandonmoser commented 5 years ago

All values are saved to the module, the dev boards do not have memory.

On Oct 10, 2018, at 10:15 AM, Antonyab notifications@github.com wrote:

@brandonmoser https://github.com/brandonmoser When I configure the variable AP using XCTU application to API Mode (API = 1), the configuration will be saved on the module or on the board? If on the board, that would explain my problem. So what do you think about that?

Regards, Antony

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/digidotcom/XBeeJavaLibrary/issues/128#issuecomment-428612986, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZKtoZg08htBaYqyFXkV0JZ03Up0fr6ks5ujg8ugaJpZM4XK5Dy.

diescalo commented 5 years ago

Now I want to try using the module directly on the UART of the rapsberry pi without being mounted on the demo board. So I connected the module to UART and I tried the same example that I tested before

How are you connecting the module to the UART of the Raspberry Pi? What lines are you connecting?