Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digi Xbee communication error #128

Open
Antonyab opened this issue Oct 5, 2018 · 11 comments
Open

Digi Xbee communication error #128

Antonyab opened this issue Oct 5, 2018 · 11 comments

Comments

@Antonyab
Copy link

Antonyab commented Oct 5, 2018

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 :
#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
Copy link
Member

@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
Copy link
Author

Antonyab commented Oct 5, 2018 via email

@Antonyab
Copy link
Author

Antonyab commented Oct 9, 2018

Hello again @brandonmoser,

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

  • First of all I downloaded XCTU application and I tested to send a message to an echo server. The example is mentioned in this documentation : https://www.digi.com/resources/documentation/digidocs/90001541/default.htm#tasks/t_echo_server.htm%3FTocPath%3DConnection%2520examples%7C_____1

  • After that, I configured the module in API Mode (API Mode Without Escapes) in order to use the java API with the module.

  • I downloaded XBeeJavaLibrary from this link: https://github.com/digidotcom/XBeeJavaLibrary/releases
    I took the .jar and test it the same example (send message to echo server). I got the same result. It worked !!!
    P.S : the module is mounted on the demo board and is connected to my pc using USB. The OS of my pc is windows.

  • I tried to execute the same example on a raspberry pi. So I generated an executable and runned it on raspberry but it didn't work due to a serial port issue (RXTXlibrary).

  • So I decided to use purejavacomm instead of RXTXlibrary to handle serial port using Java. So I downloaded the source code of the XbeeJavaLibrary and made the changes to implement purejavacomm instead of RXTX library.

  • After the changes that I made, I tested again on the raspberry pi and it worked perfectly. P.S : the module is mounted on the demo board and is connected to the raspberry pi using USB.

  • 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. Here is the problem. When I execute the example, I got the following error :

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

I dont know the cause of this problem. The following issue #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
Copy link
Member

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

@Antonyab
Copy link
Author

Antonyab commented Oct 9, 2018

@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
Copy link
Member

@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
Copy link
Author

Antonyab commented Oct 9, 2018

@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():

  • if the module is mounted on the board : operating mode = API Mode
  • if the module is mounted on the uart directly : dont know because the error happens on myDevice.open() so the program exits and I cant know the value of operating Mode.

Regards,
Antony

@brandonmoser
Copy link
Member

@rubenmoral do you have any suggestions?

@Antonyab
Copy link
Author

@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
Copy link
Member

brandonmoser commented Oct 10, 2018 via email

@diescalo
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants