Inconsistent communication between Cerbuino Bee and XBee Wi-Fi RF Module

Hello,
Ive tried to communicate to an XBee Wi-Fi RF Module that is plugged into the XBee Adapter of my Cerbuino Bee using the SerialPort class.
The DeviceInfo that Ive got from the MFDeploy tool:


DeviceInfo:
  HAL build info: 4.2.0.0, Copyright Oberon microsystems, Inc.
  OEM Product codes (vendor, model, SKU): 255, 0, 65535
  Serial Numbers (module, system):
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  Solution Build Info: 4.2.1.1, Copyright (C) GHI Electronics, LLC
  AppDomains:
    default, id=1
  Assemblies:
    mscorlib,4.2.0.0
    Microsoft.SPOT.Native,4.2.0.0
    Microsoft.SPOT.Hardware,4.2.0.0
    Microsoft.SPOT.Graphics,4.2.0.0
    Microsoft.SPOT.TinyCore,4.2.0.0
    Microsoft.SPOT.Hardware.SerialPort,4.2.0.0
    Microsoft.SPOT.Hardware.OneWire,4.2.0.0
    Microsoft.SPOT.Hardware.Usb,4.2.0.0
    Microsoft.SPOT.Hardware.PWM,4.2.0.1
    Microsoft.SPOT.Net,4.2.0.0
    System,4.2.0.0
    Microsoft.SPOT.IO,4.2.0.0
    GHI.OSHW.Hardware,4.2.1.0
    Gadgeteer,2.42.0.0
    GHIElectronics.Gadgeteer.FEZCerbuinoBee,1.0.2.0
    System.Http,4.2.0.0
    SimpleXBeeWiFiSample,1.0.0.0
    Microsoft.SPOT.Net.Security,4.2.0.0
    Microsoft.SPOT.Touch,4.2.0.0
    System.Net.Security,4.2.0.0
    System.IO,4.2.0.0

What Ive tried to do: Ive tried to query one of the configuration parameter of the XBee module. According to the user manual of the XBee module, you need follow these steps (everything ASCII encoded)
[ul]Wait 1000ms
Write +++ to the XBee module to enter the configuration mode
Wait 1000ms
The XBee module should answer with OK\r
Write ATAP to query the AP parameter
The XBee module should answer with 0\r (at its current configuration)[/ul]

The problem is, that every time I open a SerialPort and try to execute these steps, some of the responses from the XBee module are missing (or not). Ive tried to break down the problem into a simple c# sample:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using System.IO.Ports;

namespace SimpleXBeeWiFiSample
{
    public partial class Program
    {
        AutoResetEvent ar = new AutoResetEvent(false);
        Queue q = new Queue();
        SerialPort sp;        
        void ProgramStarted()
        {
            Debug.Print("Program started (ID: " + Thread.CurrentThread.ManagedThreadId + ")");                        

            sp = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);            
            sp.DataReceived += (sender, e) =>
            {             
                Debug.Print("Data received");
                int bToRead = 0;
                while (bToRead != sp.BytesToRead)
                {
                    bToRead = sp.BytesToRead;
                    Thread.Sleep(10);
                }
                Byte[] b = new byte[sp.BytesToRead];
                sp.Read(b, 0, b.Length);
                q.Enqueue(b);
                ar.Set();
            };
            sp.ErrorReceived += (sender, e) =>
            {
                Debug.Print("Error on SerialPort");
            };

            Thread workerThread = new Thread(WorkerMethod);                       
            workerThread.Start();            
        }
        void WorkerMethod()
        {
            Debug.Print("Workerthread running (ID: " + Thread.CurrentThread.ManagedThreadId + ")");            
            ar = new AutoResetEvent(false);            
            byte[] commandMode = new byte[] { 43, 43, 43 }; // ASCII +++
            byte[] atAP = new byte[] { 65, 84, 65, 80, 13 }; //ASCII ATAP\r
            byte[] commandModeResponse = new byte[] { 79, 75, 13 }; //ASCII OK\r
            byte[] atAPResponse = new byte[] { 48, 13 }; //ASCII 0\r
            int counter = 1;
            while (counter <= 10)
            {
                Debug.Print("Try #" + counter);                
                sp.Open();                
                Debug.Print("Sending +++");
                Thread.Sleep(1000);
                sp.Write(commandMode, 0, commandMode.Length);
                Thread.Sleep(1000);
                if (ar.WaitOne(10000, false))
                {
                    byte[] b = (byte[])q.Dequeue();
                    if (b.Compare(commandModeResponse))
                    {
                        Debug.Print("Response to +++");
                        Debug.Print("Sending ATAP");
                        sp.Write(atAP, 0, atAP.Length);                        
                        if (ar.WaitOne(10000, false))
                        {
                            b = (byte[])q.Dequeue();
                            if (b.Compare(atAPResponse))
                                Debug.Print("Response to ATAP received");
                            else
                                Debug.Print("Unknown response to ATAP");
                        }
                        else
                        {
                            Debug.Print("No response to ATAP");
                        }
                    }
                    else
                    {
                        Debug.Print("Unknown response to +++");                                                
                    }
                }
                else
                {
                    Debug.Print("No response to +++");
                }
                counter++;
                sp.Close();            
            }
        }        
    }
    static class Extensions
    {
        public static bool Compare(this byte[] b1, byte[] b2)
        {
            if (b1.Length != b2.Length)
                return false;
            for (int i = 0; i < b1.Length; i++)
                if (b1[i] != b2[i])
                    return false;
            return true;
        }
    }
}

Ive executed that sample three times and saved the Debug Output:


Program started (ID: 0)
Workerthread running (ID: 4)
Try #1
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #2
Sending +++
No response to +++
Try #3
Sending +++
Data received
Response to +++
Sending ATAP
No response to ATAP
Try #4
Sending +++
Data received
Response to +++
Sending ATAP
No response to ATAP
Try #5
Sending +++
Data received
Response to +++
Sending ATAP
No response to ATAP
Try #6
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #7
Sending +++
No response to +++
Try #8
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #9
Sending +++
No response to +++
Try #10
Sending +++
Data received
Response to +++
Sending ATAP
No response to ATAP

Program started (ID: 0)
Workerthread running (ID: 4)
Try #1
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #2
Sending +++
No response to +++
Try #3
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #4
Sending +++
No response to +++
Try #5
Sending +++
No response to +++
Try #6
Sending +++
Data received
Response to +++
Sending ATAP
No response to ATAP
Try #7
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #8
Sending +++
No response to +++
Try #9
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #10
Sending +++
No response to +++

Program started (ID: 0)
Workerthread running (ID: 4)
Try #1
Sending +++
Data received
Response to +++
Sending ATAP
No response to ATAP
Try #2
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #3
Sending +++
No response to +++
Try #4
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #5
Sending +++
No response to +++
Try #6
Sending +++
Data received
Response to +++
Sending ATAP
No response to ATAP
Try #7
Sending +++
No response to +++
Try #8
Sending +++
Data received
Response to +++
Sending ATAP
Data received
Response to ATAP received
Try #9
Sending +++
No response to +++
Try #10
Sending +++
No response to +++

What am I doing wrong here? Why are these results so different every time I try it?

Thank you for your help,
AlexAUT

Alex, welcome to the forums.

Your problem is your DataRecieved event, most likely.

It should get in, get what data out that is there, and get out as quick as possible.

          sp.DataReceived += (sender, e) =>
            {             
                Debug.Print("Data received");
                int bToRead = 0;
                while (bToRead != sp.BytesToRead)
                {
                    bToRead = sp.BytesToRead;
                    Thread.Sleep(10);
                }
                Byte[] b = new byte[sp.BytesToRead];
                sp.Read(b, 0, b.Length);
                q.Enqueue(b);
                ar.Set();
            };

BytesToRead will always be non-zero when you end up in the handler. Simply ditch the WHILE loop (which I have no idea really what you were trying to achieve with that)

As better diagnostics, you could loop through the items in the array and debug.print them. You would NOT expect to get all the responses in each pass through the datarecieved event handler either; perhaps you’re dequeue isn’t actually returning what you expect when you only get a partial message? Debug.print the characters in the queue so you know what is there!

Also not sure what value you’re getting from “ar”?

Thank you for your reply, Brett.

Since the XBee module sends the data without any format, I cant rely on the fact that one DataReceived equals one message from the module. The module supports an API-Frame based communication including a length field but before I can use it, I have to set the AP parameter to 1 so that the module accepts commands in that API-Frame format. Because I had the problem that responses from the module arrived in fragments, Ive tried to wait until there is no incoming data for 10ms. Thats the reason for that while loop.

That problem should be fixed when Im able to enable the API-Frame format. For the sample application this shouldnt be a problem, since there is always 1 response from the module for every message from the application. And if the application doesnt understand a message in the queue, it should print it in the Debug (which it didnt through all the 30 tries).
And even if the application cant work with the information in the queue, at least the Data received should show up in the Debug log (which it doesnt).

The AutoResetEvent ar should only signalize another thread that there is data in the queue that it can work with.

you’re missing the point. Serial comms are not guaranteed to be handled the way you think. DataRecieved event handler can fire twice for a simple “o\n” string. First, with a bytestoread of 1, saying it got the “0” character. Then, later, a second time with a bytestoread of 1, for “\n”. That just the way serial comms works. It has nothing to do with the fact that you have an xbee in a particular mode connected to it.

And this problem does not go away when you enable API mode, unless API mode guarantees to give you single byte returns for anything you do?

You need to go back to a simpler state, and use Debug.print to show what you get back in the handler. If you think the 10ms sleep is adding value, use a debug.print in the loop to show how bytestoread changes - but personally I think you’re asking for problems if you approach it this way (again, a handler is meant to be called and exited in the shortest possible time; the netmf is controlling when the next iteration of the handler is called and you don’t want to do something that might mess with it)

debug.print is your friend - well at least in chise case while you’re trying to make sense of what is coming back, although it adds so much time because of the string operations you will find you get different behaviours when you go back to not debugging.

@ alexAUT - Before your first iteration the module is in transparent mode waiting for ‘+++’ in order to enter AT mode. In your second iteration the module is already in AT mode but you try to enter it once again - this will fail. You have to wait either 10s (by default) so that the module returns to transparent mode due to inactivity or use the ATCN command to force the exit from AT mode. This should help

@ Brett:
Ive now tried to implement it the way I think you meant:


 sp.DataReceived += (sender, e) =>
            {                             
                Byte[] b = new byte[sp.BytesToRead];
                sp.Read(b, 0, b.Length);                
                inputQueue.Enqueue(b);
                Debug.Print("Data received");
                for (int i = 0; i < b.Length; i++)
                    Debug.Print(b[i].ToString());                
                inputre.Set();
            };

The DataReceived-Handler now only copies the Data thats been received into an array and puts that array into a Queue. Another Thread then takes the array(s) in the Queue and tries to reassemble them into a valid message (if the message gets spitted into multiple DataReceived calls).
But unfortunately, this doesnt fix the problem… Responses to +++ or ATAP are still missing sometimes (and the debug output shows, that the application handles the fragment messages correctly).

@ Gralin
I just tried to put a Thread.Sleep(20000) after the sp.Close so that the module falls back into transparent mode, but it didnt help either. And even if this would explain why some of the repsones for +++ are missing, it doesnt explain why some the responses to ATAP are missing after receiving a response to +++.

@ alexAUT - I would do the DataReceived handler this way, but i doubt this will fix your problem

sp.DataReceived += (sender, e) =>
{
	while (sp.BytesToRead > 0)
	{
		var b = new byte[sp.BytesToRead];
		var readCount = sp.Read(b, 0, b.Length);
		if (readCount  <= 0) break;
		inputQueue.Enqueue(b);
		
		Debug.Print("Data received");
		for (int i = 0; i < b.Length; i++)
			Debug.Print(b[i].ToString()); 
	}
	
	inputre.Set();
}

Do you have any XBee USB adapter so that you can connect your module to PC and use X-CTU to upgrade your firmware and set everything to default value? If not maybe check using AT command what is the value of SM (Sleep Mode). If the value is greater than 0 than your problems are caused by module going to sleep.

Unfortunately, I dont have such an adapter.
Thank you for the hint with the sleep mode, but it was at 0 (no sleep).

Anyone got any idea?

May be worth showing us the debug output so we can see the guts of what is going on

@ alexAUT - i think you will need the adapter anyway especially for the wifi module as this one is pretty new and the firmware is still pretty much in development. What version of firmware do you have ?

Thank you again for your help.

Thats the code that produced the output below:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using System.IO.Ports;

namespace SimpleXBeeWiFiSample
{
    public partial class Program
    {
        ManualResetEvent responsere = new ManualResetEvent(false);
        ManualResetEvent inputre = new ManualResetEvent(false);
        Queue responseQueue = new Queue();
        Queue inputQueue = new Queue();
        SerialPort sp;        
        void ProgramStarted()
        {
            Debug.Print("Program started (ID: " + Thread.CurrentThread.ManagedThreadId + ")");                        

            sp = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);            
            sp.DataReceived += (sender, e) =>
            {                             
                Byte[] b = new byte[sp.BytesToRead];
                sp.Read(b, 0, b.Length);                
                inputQueue.Enqueue(b);
                Debug.Print("Data received");
                for (int i = 0; i < b.Length; i++)
                    Debug.Print(b[i].ToString());                
                inputre.Set();
            };
            sp.ErrorReceived += (sender, e) =>
            {
                Debug.Print("Error on SerialPort");
            };

            Thread processingThread = new Thread(ProcessInput);
            processingThread.Start();

            Thread workerThread = new Thread(WorkerMethod);                       
            workerThread.Start();            
        }
        void ProcessInput()
        {
            while (true)            
                TryBuildMessage(null);                                   
        }
        void TryBuildMessage(byte[] previous)
        {            
            byte[] b = previous.Concat(inputQueue.GetNext(inputre));                        
            var l = b.Split();
            for (int i = 0; i < l.Count - 1; i++)
            {                
                responseQueue.Enqueue(l[i]);                
                responsere.Set();             
            }
            if (l.Count != 0)
            {
                var sub = (byte[])l[l.Count - 1];
                if (sub.EndDelimiter())
                {                    
                    responseQueue.Enqueue(sub);
                    responsere.Set();
                }
                else
                {                 
                    TryBuildMessage(sub);
                }
            }
        }
        void WorkerMethod()
        {
            Debug.Print("Workerthread running (ID: " + Thread.CurrentThread.ManagedThreadId + ")");
            responsere = new ManualResetEvent(false);            
            byte[] commandMode = new byte[] { 43, 43, 43 }; // ASCII +++
            byte[] atAP = new byte[] { 65, 84, 65, 80, 13 }; //ASCII ATAP\r            
            byte[] commandModeResponse = new byte[] { 79, 75, 13 }; //ASCII OK\r
            byte[] atAPResponse = new byte[] { 48, 13 }; //ASCII 0\r
            int counter = 1;
            while (counter <= 10)
            {
                Debug.Print("Try #" + counter);                
                sp.Open();                
                Debug.Print("Sending +++");
                Thread.Sleep(1000);
                sp.Write(commandMode, 0, commandMode.Length);
                Thread.Sleep(1000);
                if (responsere.WaitOne(10000, false))
                {                   
                    byte[] b = (byte[])responseQueue.Dequeue();
                    if (responseQueue.Count == 0)
                        responsere.Reset();
                    if (b.Compare(commandModeResponse))
                    {
                        Debug.Print("Response to +++");
                        Debug.Print("Sending ATAP");
                        sp.Write(atAP, 0, atAP.Length);                        
                        if (responsere.WaitOne(10000, false))
                        {                         
                            b = (byte[])responseQueue.Dequeue();
                            if (responseQueue.Count == 0)
                                responsere.Reset();
                            if (b.Compare(atAPResponse))
                                Debug.Print("Response to ATAP received");
                            else
                                Debug.Print("Unknown response to ATAP");
                        }
                        else
                        {
                            Debug.Print("No response to ATAP");
                        }
                    }
                    else
                    {
                        Debug.Print("Unknown response to +++");                                                
                    }
                }
                else
                {
                    Debug.Print("No response to +++");
                }
                counter++;
                sp.Close();
                Thread.Sleep(20000);
            }
        }        
    }
    static class Extensions
    {
        public static bool Compare(this byte[] b1, byte[] b2)
        {
            if (b1.Length != b2.Length)
                return false;
            for (int i = 0; i < b1.Length; i++)
                if (b1[i] != b2[i])
                    return false;
            return true;
        }
        public static bool EndDelimiter(this byte[] b)
        {
            return b[b.Length - 1] == '\r';
        }
        public static byte[] Concat(this byte[] b1, byte[] b2)
        {
            if(b1 == null)
                return b2;
            byte[] retValue = new byte[b1.Length + b2.Length];
            b1.CopyTo(retValue, 0);
            b2.CopyTo(retValue, b1.Length);
            return retValue;
        }
        public static byte[] GetNext(this Queue q, ManualResetEvent mr)
        {
            if (q.Count != 0)
                return (byte[])q.Dequeue();
            else
            {
                mr.WaitOne();
                mr.Reset();                
                return (byte[])q.Dequeue();                
            }
        }      
        public static ArrayList Split(this byte[] b)
        {
            ArrayList al = new ArrayList();
            int lastIndex = 0;
            for (int i = 0; i < b.Length; i++)
            {
                if (b[i] == 13)
                {
                    byte[] sub = new byte[(i - lastIndex) + 1];
                    for (int x = lastIndex, y = 0; x <= i; x++, y++)
                        sub[y] = b[x];
                    al.Add(sub);
                    lastIndex = i + 1;
                }                   
            }
            if (lastIndex != b.Length)
            {
                byte[] sub = new byte[b.Length - lastIndex];
                for (int x = lastIndex, y = 0; x < b.Length; x++, y++)
                    sub[y] = b[x];
                al.Add(sub);
            }
            return al;
        }        
    }
}

Ive tested it with two Cerbuino Bee boards to check if the board is the cause of the problem.
Debug output 1:


Try #1
Sending +++
Data received
79
75
13
Response to +++
Sending ATAP
Data received
48
Data received
13
Response to ATAP received
Try #2
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
Data received
48
Data received
13
Response to ATAP received
Try #3
Sending +++
No response to +++
Try #4
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
Data received
48
Data received
13
Response to ATAP received
Try #5
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
Data received
48
Data received
13
Response to ATAP received
Try #6
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #7
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #8
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #9
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #10
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP


Debug output 2:
Try #1
Sending +++
Data received
79
75
13
Response to +++
Sending ATAP
Data received
48
Data received
13
Response to ATAP received
Try #2
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #3
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
Data received
48
Data received
13
Response to ATAP received
Try #4
Sending +++
No response to +++
Try #5
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #6
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
Data received
48
Data received
13
Response to ATAP received
Try #7
Sending +++
No response to +++
Try #8
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #9
Sending +++
Data received
79
Data received
75
Data received
13
Response to +++
Sending ATAP
No response to ATAP
Try #10
Sending +++
No response to +++

The module I’m using: IoT Products and Services - Wireless Devices, System-on-Modules and Single Board Computers for Development of Demanding IoT Applications | Digi International
The firmware and hardware Versions of the module (if I interpreted them correctly):
Firmware Version = 49, 48, 49, 53, 13 = 1.0.1.5
Hardware Version = 49, 70, 52, 50, 13 = 1.F.4.2

I think this adapter (http://www.physicalcomputing.at/shop/article_A-1117400/XBee-Explorer-Dongle.html?shop_param=cid%3D22%26aid%3DA-1117400%26) should work, or? (I think thats the same product on sparkfun, at least I cant any difference: http://www.sparkfun.com/products/9819
The first one is just a distributer that closer to where I life).

Can you cast your debug.print to (char) so we get the character - I can’t remember what 74 is :slight_smile:

Looks to me like the module really isn’t responding. There’s no datarecieved event firing, so unless you’re dropping the characters in your code somehow, it doesn’t seem to respond occasionally…

This discussion has been going on for a while, and I don’t member anyone mentioning that you should open a serial port before you subscribe to the DataReceived event.

Also why is the serial port continuously opened and closed?

Good catch. On both !

Thank you for the hint with the DataReceived event… I didnt know that.
My idea behind the opening and closing of the serial port was to simulate a full restart of the connection.

I implemented both things but unfortunately that didnt make any difference either.

Yep, you have the oldest firmware. There are currently four versions and the newest is 102D. I know there was a lot of bugs at the beginning so it’s worth upgrading.

The XBee adapter dongle you suggested is absolutely fine. I would go with version that has USB cable instead of a plug but this is up to you.

When you buy this adapter you will be able to use X-CTU to read settings from your module. That X-CTU does is exactly the same as what you are doing so if crashes you will know that it’s the module that is causing the problem.

1 Like

Ive ordered one of these adapters and will post again whether the firmware upgrade fixes my problem or not as soon as the adapter arrives.

Thanks for the help so far!

Hello,
the adapter Ive order (see above) arrived today. It seems as if the new firmware fixed the problem Ive had (Ive let my sample application run 3 times = 30 tries and all 30 passed). But it was a bumpy road to get the new firmware onto the module.
At the beginning, the X-CTU didnt recognize the XBee WiFi Module at all. After finding a thread in the Sparkfun Forum (http://forum.sparkfun.com/viewtopic.php?f=14&t=29697) and one in the Digi Forum (http://forums.digi.com/support/forum/viewthread_thread,9861) X-CTU finally recognized the XBee Module. Next problem was that the Sparkfun board power supply filtering was inadequate and WiFi module would only initialize maybe 1 in 20 attempts. (digi forum link) … and in fact after plugging the SparkFun adapter in and out multiple times it finally worked. But X-CTU still didnt manage to update the Firmware (it always stopped in the middle and reported an error). Since the same tactic worked before, Ive simply tried to update the firmware multiplie times and after about 5 tries it actually worked.

So thank you all for your help!
alexAUT

@ alexAUT - when you power up your XBee WiFi do you sometimes hear it buzz? Mine has to be restarted several times before I am able to communicate with it. In other cases the module seems not to be booting and you can hear a buzz sound if you put your ear down next to it.

I didnt hear any buzzing or other sounds from my XBee module so far and since the firmware update my XBee module always worked without any problems.