GHI Bluetooth Module 1.1 broken?

Hi people.

I know the module I asking for is discontinued.
But I owne one of these modules and would like to use it for bluetooth communication between Windows Phone and my Gadgeteer Spider.

I already tried to get the tutorials running but never found the bluetooth module with any device.
Now I realized there are two LED’s on the Bluetooth Module. But these LED’s never glow.

I am using an FEZ Spider 1.0 with MF 4.2 and the Bluetooth Module connected to any of the U sokets.
I also tried to use another cable between the module and the mainboard.

Is there a common way to check if the module is broken?

Thank you for your help!

Yes it is a Gadgeteer app. What do you mean with initializing the module?
Here is the little code I try to get running and the designer setup as picture.


using Microsoft.SPOT;

using Gadgeteer.Modules.GHIElectronics;

namespace BluetoothGadgeteer
{
    public partial class Program
    {
        private Bluetooth.Client client;

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            client = bluetooth.ClientMode;

            bluetooth.SetDeviceName("Gadgeteer");
            bluetooth.SetPinCode("1234");
            bluetooth.SetDeviceBaud(38400);
            bluetooth.BluetoothStateChanged += new Bluetooth.BluetoothStateChangedHandler(bluetooth_BtStateChanged);
            bluetooth.DataReceived += new Bluetooth.DataReceivedHandler(bluetooth_DataReceived);

            joystick.JoystickPressed += joystick_JoystickPressed;

            Debug.Print("Program Started");
        }

        void joystick_JoystickPressed(Joystick sender, Joystick.JoystickState state)
        {
            if (!bluetooth.IsConnected)
            {
                bluetooth.ClientMode.EnterPairingMode();
            }
        }

        void bluetooth_BtStateChanged(Bluetooth sender, Bluetooth.BluetoothState btState)
        {
            Debug.Print(btState.ToString());
        }

        void bluetooth_DataReceived(Bluetooth sender, string data)
        {
            Debug.Print(data);
        }
    }
}

a phone is not the right test device you should be using for this. Use a PC. This module only offers an SPP profile (Serial Port Profile) that will present a COM port to your PC and you will be able to connect to it with a serial terminal app and send data then. You’ll also find my minimal example (for 4.1 though) on codeshare https://www.ghielectronics.com/community/codeshare/entry/446 that might help lead you in the right direction

Hi Brett,

thank you for this advice. I already read about it and also have an Bluetooth USB 2.1 EDR Dongle connected to my PC.
Sorry, I should mentioned this in the opening post.

In my opinion the Bluetooth Module should sign the connection state through the two LED’s. But there is nothing happening with them.
The connection to another device is the next step.

Hi,
or you could switch to NETMF 4.3 and give this a try
https://www.ghielectronics.com/community/codeshare/entry/1004

if you read through the code in my project (likely RoSchmi’s as well) you’ll see that there’s specific requirements about putting the device into pairing mode after the driver has initialised. That is when the onboard LEDs alternately flash, showing it’s in pairing mode. I don’t have my BT module any more to know for certain what the sequence was, but a simple way to test the module works is to send it commands over the UART and you expect to see UART responses.

I think my bluetooth module is broken, because I am not getting the “+BTState=1” info.

Now I use the BaudRate and MF4.2 modified Eduardo Velloso Bluetooth.cs in my Project:


using System;
using Microsoft.SPOT;
using System.Threading;

using GTM = Gadgeteer.Modules;
using GTI = Gadgeteer.Interfaces;

namespace Gadgeteer.Modules.Velloso
{
    /// <summary>
    /// A Bluetooth module for Microsoft .NET Gadgeteer
    /// </summary>
    public class Bluetooth : GTM.Module
    {

            /// <summary>
            /// Direct access to Serial Port.
            /// </summary>

            //public Gadgeteer.Socket.SocketInterfaces.Serial serialPort;
            public GTI.Serial serialPort;
            private GTI.DigitalOutput reset;
            private GTI.InterruptInput statusInt;
            private Thread readerThread;

            /// <summary>
            /// Possible states of the Bluetooth module
            /// </summary>
            public enum BluetoothState
            {
                /// <summary>
                /// Module is initializing
                /// </summary>
                Initializing = 0,
                /// <summary>
                /// Module is ready
                /// </summary>
                Ready = 1,
                /// <summary>
                /// Module is in pairing mode
                /// </summary>
                Inquiring = 2,
                /// <summary>
                /// Module is making a connection attempt
                /// </summary>
                Connecting = 3,
                /// <summary>
                /// Module is connected
                /// </summary>
                Connected = 4,
                /// <summary>
                /// Module is diconnected
                /// </summary>
                Disconnected = 5
            }

            // Note: A constructor summary is auto-generated by the doc builder.
            /// <summary></summary>
            /// <param name="socketNumber">The socket that this module is plugged in to.</param>
            /// <param name="baud">The designated baud rate</param>
            public Bluetooth(int socketNumber, long baud)
            {
                // This finds the Socket instance from the user-specified socket number.  
                // This will generate user-friendly error messages if the socket is invalid.
                // If there is more than one socket on this module, then instead of "null" for the last parameter, 
                // put text that identifies the socket to the user (e.g. "S" if there is a socket type S)
                Socket socket = Socket.GetSocket(socketNumber, true, this, null);

                this.reset = new GTI.DigitalOutput(socket, Socket.Pin.Six, false, this);
                this.statusInt = new GTI.InterruptInput(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, GTI.InterruptMode.RisingAndFallingEdge, this);
                this.serialPort = new GTI.Serial(socket, 38400, GTI.Serial.SerialParity.None, GTI.Serial.SerialStopBits.One, 8, GTI.Serial.HardwareFlowControl.NotRequired, this);

                //this.statusInt.Interrupt += new GTI.InterruptInput.InterruptEventHandler(statusInt_Interrupt);
                this.serialPort.ReadTimeout = Timeout.Infinite;
                this.serialPort.Open();

                Thread.Sleep(5);
                this.reset.Write(true);

                Thread.Sleep(5);
                this.SetDeviceBaud(baud);
                this.serialPort.Flush();
                this.serialPort.Close();
                this.serialPort.BaudRate = (int)baud;
                this.serialPort.Open();

                readerThread = new Thread(new ThreadStart(runReaderThread));
                readerThread.Start();
                Thread.Sleep(500);
            }

            /// <summary>
            /// This method sets the baud rate for the device
            /// </summary>
            /// <param name="baud">Designated baud rate</param>
            public void SetDeviceBaud(long baud)
            {
                string cmd = string.Empty;

                switch (baud)
                {
                    case 9600:
                        cmd = "9600";
                        break;

                    case 19200:
                        cmd = "19200";
                        break;

                    case 38400:
                        cmd = "38400";
                        break;

                    case 57600:
                        cmd = "57600";
                        break;

                    case 115000:
                        cmd = "115000";
                        break;

                    case 230400:
                        cmd = "230400";
                        break;

                    case 460800:
                        cmd = "460800";
                        break;

                    default:
                        cmd = string.Empty;
                        break;
                }

                if (cmd != string.Empty)
                    this.serialPort.Write("\r\n+STBD=" + cmd + "\r\n");

                Thread.Sleep(500);

            }

            /// <summary>
            /// Hard Reset Bluetooth module
            /// </summary>
            public void Reset()
            {
                this.reset.Write(false);
                Thread.Sleep(5);
                this.reset.Write(true);
            }

            /// <summary>
            /// Gets a value that indicates whether the bluetooth connection is connected.
            /// </summary>
            public bool IsConnected
            {
                get
                {
                    return this.statusInt.Read();
                }
            }

           
        /// <summary>
        /// Thread that continuously reads incoming messages from the module,
        /// parses them and triggers the corresponding events.
        /// </summary>
            private void runReaderThread()
            {
                Debug.Print("Reader Thread");
                while (true)
                {
                   String response = "";
                   while (serialPort.BytesToRead > 0)
                   {
                       response = response + (char)serialPort.ReadByte();
                   }
                   if (response.Length > 0)
                   {
                       Debug.Print(response);


                       //Check Bluetooth State Changed
                       if (response.IndexOf("+BTSTATE:") > -1)
                       {
                           string atCommand = "+BTSTATE:";

                           //String parsing  
                           // Return format: +COPS:<mode>[,<format>,<oper>]
                           int first = response.IndexOf(atCommand) + atCommand.Length;
                           int last = response.IndexOf("\n", first);
                           int state = int.Parse(((response.Substring(first, last - first)).Trim()));

                           OnBluetoothStateChanged(this, (BluetoothState)state);
                       }
                       //Check Pin Requested
                       if (response.IndexOf("+INPIN") > -1)
                       {
                           // EDUARDO : Needs testing
                           OnPinRequested(this);
                       }
                       if (response.IndexOf("+RTINQ") > -1)
                       {
                           //EDUARDO: Needs testing

                           string atCommand = "+RTINQ=";
                           //String parsing  
                           int first = response.IndexOf(atCommand) + atCommand.Length;
                           int mid = response.IndexOf(";", first);
                           int last = response.IndexOf("\r", first);
                           
                           // Keep reading until the end of the message
                           while (last < 0)
                           {
                               while (serialPort.BytesToRead > 0)
                               {
                                   response = response + (char)serialPort.ReadByte();
                               }
                               last = response.IndexOf("\r", first);
                           }

                           string address = ((response.Substring(first, mid - first)).Trim());
                           
                           string name = (response.Substring(mid+1, last-mid));

                           OnDeviceInquired(this, address, name);
                           //Debug.Print("Add: " + address + ", Name: " + name );
                       }
                       else
                       {
                           OnDataReceived(this, response);
                       }
                   }
                   Thread.Sleep(10);
                }
            }

            #region DELEGATES AND EVENTS
            #region Bluetooth State Changed
            /// <summary>
            /// Represents the delegate used for the <see cref="BluetoothStateChanged"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>
            /// <param name="btState">Current state of the Bluetooth module</param>
            public delegate void BluetoothStateChangedHandler(Bluetooth sender, BluetoothState btState);
            /// <summary>
            /// Event raised when the bluetooth module changes its state.
            /// </summary>
            public event BluetoothStateChangedHandler BluetoothStateChanged;
            private BluetoothStateChangedHandler onBluetoothStateChanged;

            /// <summary>
            /// Raises the <see cref="BluetoothStateChanged"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>  
            /// <param name="btState">Current state of the Bluetooth module</param>
            protected virtual void OnBluetoothStateChanged(Bluetooth sender, BluetoothState btState)
            {
                if (onBluetoothStateChanged == null) onBluetoothStateChanged = new BluetoothStateChangedHandler(OnBluetoothStateChanged);
                if (Program.CheckAndInvoke(BluetoothStateChanged, onBluetoothStateChanged, sender, btState))
                {
                    BluetoothStateChanged(sender, btState);
                }
            }
            #endregion
            #region DataReceived
            /// <summary>
            /// Represents the delegate used for the <see cref="DataReceived"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>
            /// <param name="data">Data received from the Bluetooth module</param>
            public delegate void DataReceivedHandler(Bluetooth sender, string data);
            /// <summary>
            /// Event raised when the bluetooth module changes its state.
            /// </summary>
            public event DataReceivedHandler DataReceived;
            private DataReceivedHandler onDataReceived;

            /// <summary>
            /// Raises the <see cref="DataReceived"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>  
            /// <param name="data">Data string received by the Bluetooth module</param>
            protected virtual void OnDataReceived(Bluetooth sender, string data)
            {
                if (onDataReceived == null) onDataReceived = new DataReceivedHandler(OnDataReceived);
                if (Program.CheckAndInvoke(DataReceived, onDataReceived, sender, data))
                {
                    DataReceived(sender, data);
                }
            }
            #endregion
            #region PinRequested
            /// <summary>
            /// Represents the delegate used for the <see cref="PinRequested"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>
            public delegate void PinRequestedHandler(Bluetooth sender);
            /// <summary>
            /// Event raised when the bluetooth module changes its state.
            /// </summary>
            public event PinRequestedHandler PinRequested;
            private PinRequestedHandler onPinRequested;

            /// <summary>
            /// Raises the <see cref="PinRequested"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>  
            protected virtual void OnPinRequested(Bluetooth sender)
            {
                if (onPinRequested == null) onPinRequested = new PinRequestedHandler(OnPinRequested);
                if (Program.CheckAndInvoke(PinRequested, onPinRequested, sender))
                {
                    PinRequested(sender);
                }
            }
            #endregion
            #endregion

            #region DeviceInquired
            /// <summary>
            /// Represents the delegate used for the <see cref="DeviceInquired"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>
            /// <param name="macAddress">MAC Address of the inquired device</param>
            /// <param name="name">Name of the inquired device</param>
            public delegate void DeviceInquiredHandler(Bluetooth sender, string macAddress, string name);
            /// <summary>
            /// Event raised when the bluetooth module changes its state.
            /// </summary>
            public event DeviceInquiredHandler DeviceInquired;
            private DeviceInquiredHandler onDeviceInquired;

            /// <summary>
            /// Raises the <see cref="PinRequested"/> event.
            /// </summary>
            /// <param name="sender">The object that raised the event.</param>  
            /// <param name="macAddress">MAC Address of the inquired device</param>
            /// <param name="name">Name of the inquired device</param>
            protected virtual void OnDeviceInquired(Bluetooth sender, string macAddress, string name)
            {
                if (onDeviceInquired == null) onDeviceInquired = new DeviceInquiredHandler(OnDeviceInquired);
                if (Program.CheckAndInvoke(DeviceInquired, onDeviceInquired, sender, macAddress, name))
                {
                    DeviceInquired(sender, macAddress, name);
                }
            }
            #endregion
            private object _lock = new Object();

            private Client _client;
            /// <summary>
            /// Sets Bluetooth module to work in Client mode.
            /// </summary>
            public Client ClientMode
            {
                get
                {
                    lock (_lock)
                    {
                        if (_host != null) throw new InvalidOperationException("Cannot use both Client and Host modes for Bluetooth module");
                        if (_client == null) _client = new Client(this);
                        return _client;
                    }
                }
            }

            private Host _host;
        /// <summary>
        /// Sets Bluetooth module to work in Host mode.
        /// </summary>
            public Host HostMode
            {
                get
                {
                    lock (_lock)
                    {
                        if (_client != null) throw new InvalidOperationException("Cannot use both Client and Host modes for Bluetooth module");
                        if (_host == null) _host = new Host(this);
                        return _host;
                    }
                }
            }

        /// <summary>
        /// Sets the device name as seen by other devices
        /// </summary>
        /// <param name="name">Name of the device</param>
            public void SetDeviceName(string name)
            {
                this.serialPort.Write("\r\n+STNA=" + name + "\r\n");
            }

        /// <summary>
        /// Sets the PIN code for the Bluetooth module
        /// </summary>
        /// <param name="pinCode"></param>
            public void SetPinCode(string pinCode)
            {
                this.serialPort.Write("\r\n +STPIN=" + pinCode +"\r\n");
            }

        /// <summary>
        /// Client functionality for the Bluetooth module
        /// </summary>
            public class Client
            {
                private Bluetooth bluetooth;
                internal Client(Bluetooth bluetooth)
                {
                    Debug.Print("Client Mode");
                    this.bluetooth = bluetooth;
                    bluetooth.serialPort.Write("\r\n+STWMOD=0\r\n");
                }

                /// <summary>
                /// Enters pairing mode
                /// </summary>
                public void EnterPairingMode()
                {
                    Debug.Print("Enter Pairing Mode");
                    bluetooth.serialPort.Write("\r\n+INQ=1\r\n");

                }

                /// <summary>
                /// Inputs pin code
                /// </summary>
                /// <param name="pinCode">Module's pin code. Default: 0000</param>
                public void InputPinCode(string pinCode)
                {
                    Debug.Print("Inputting pin: " + pinCode);
                    bluetooth.serialPort.Write("\r\n+RTPIN=" + pinCode + "\r\n");
                }

                /// <summary>
                /// Closes current connection. Doesn't work yet.
                /// </summary>
                public void Disconnect()
                {
                    Debug.Print("Disconnection is not working...");
                    //NOT WORKING
                    // Documentation states that in order to disconnect, we pull PIO0 HIGH,
                    // but this pin is not available in the socket... (see schematics)
                }

                /// <summary>
                /// Sends data through the connection.
                /// </summary>
                /// <param name="message">String containing the data to be sent</param>
                public void Send(string message)
                {
                    Debug.Print("Sending: " + message);
                    bluetooth.serialPort.WriteLine(message);
                }
            }

        /// <summary>
        /// Implements the host functionality for the Bluetooth module
        /// </summary>
            public class Host
            {
                private Bluetooth bluetooth;
                internal Host(Bluetooth bluetooth)
                {
                    Debug.Print("Host mode");
                    this.bluetooth = bluetooth;
                    bluetooth.serialPort.Write("\r\n+STWMOD=1\r\n");
                }
                
                /// <summary>
                /// Starts inquiring for devices
                /// </summary>
                public void InquireDevice()
                {
                    Debug.Print("Inquiring device");
                    bluetooth.serialPort.Write("\r\n+INQ=1\r\n");
                    
                }

                /// <summary>
                /// Makes a connection with a device using its MAC address.
                /// </summary>
                /// <param name="macAddress">MAC address of the device</param>
                public void Connect(string macAddress)
                {
                    Debug.Print("Connecting to: " + macAddress);
                    bluetooth.serialPort.Write("\r\n+CONN="+macAddress+"\r\n");
                }

                /// <summary>
                /// Inputs the PIN code.
                /// </summary>
                /// <param name="pinCode">PIN code. Default 0000</param>
                public void InputPinCode(string pinCode)
                {
                    Debug.Print("Inputting pin: " + pinCode);
                    bluetooth.serialPort.Write("\r\n+RTPIN=" + pinCode + "\r\n");
                }

                /// <summary>
                /// Closes the current connection. Doesn't work yet.
                /// </summary>
                public void Disconnect()
                {
                    Debug.Print("Disconnection is not working...");
                    //NOT WORKING
                    // Documentation states that in order to disconnect, we pull PIO0 HIGH,
                    // but this pin is not available in the socket... (see schematics)
                }
            }
        }
    }

and changed the Program.cs also and removed the bluetooth module from the designer:



using Microsoft.SPOT;

using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Modules.Velloso;

namespace BluetoothGadgeteer
{
    public partial class Program
    {
        private Bluetooth bluetooth = new Bluetooth(4,38400);
        private Bluetooth.Client client;
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            
            client = bluetooth.ClientMode;

            bluetooth.SetDeviceName("Gadgeteer");
            bluetooth.SetPinCode("1234");
            bluetooth.BluetoothStateChanged += new Bluetooth.BluetoothStateChangedHandler(bluetooth_BtStateChanged);
            bluetooth.DataReceived += new Bluetooth.DataReceivedHandler(bluetooth_DataReceived);

            joystick.JoystickPressed += joystick_JoystickPressed;

            Debug.Print("Program Started");
        }

        void joystick_JoystickPressed(Joystick sender, Joystick.JoystickState state)
        {
            Debug.Print("Button pressed");

            if (!bluetooth.IsConnected)
            {
                Debug.Print("Try to enter pairing mode");
                bluetooth.ClientMode.EnterPairingMode();
            }
        }

        void bluetooth_BtStateChanged(Bluetooth sender, Bluetooth.BluetoothState btState)
        {
            Debug.Print(btState.ToString());
        }

        void bluetooth_DataReceived(Bluetooth sender, string data)
        {
            Debug.Print(data);
        }
    }
}

@ nilhau -
can you please show the content of the output window when you deploy the program

Hello RoSchmi,

here is the Micro Framework Device Deployment output:


Looking for a device on transport 'USB'
Starting device deployment...
Iteration 0
Opening port \\?\usb#vid_1b9f&pid_0102#5&2d7ae1ff&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Attaching debugger engine...
... debugger engine attached!
Querying device assemblies...
Found Assembly mscorlib 4.2.0.0
Found Assembly Microsoft.SPOT.Native 4.2.0.0
Found Assembly Microsoft.SPOT.Security.PKCS11 4.2.0.0
Found Assembly System.Security 4.2.0.0
Found Assembly Microsoft.SPOT.Hardware.PWM 4.2.0.1
Found Assembly Microsoft.SPOT.Hardware.SerialPort 4.2.0.0
Found Assembly Gadgeteer 2.42.0.0
Found Assembly Microsoft.SPOT.Graphics 4.2.0.0
Found Assembly Microsoft.SPOT.Hardware 4.2.0.0
Found Assembly Microsoft.SPOT.IO 4.2.0.0
Found Assembly GTM.GHIElectronics.Joystick 4.2.101.0
Found Assembly Gadgeteer.Serial 2.42.0.0
Found Assembly BluetoothGadgeteer 1.0.0.0
Found Assembly Microsoft.SPOT.TinyCore 4.2.0.0
Found Assembly System.IO 4.2.0.0
Found Assembly GHI.Premium.System 4.2.11.1
Found Assembly GHI.Premium.IO 4.2.11.1
Found Assembly Microsoft.SPOT.Net 4.2.0.0
Found Assembly GHI.Premium.Hardware 4.2.11.1
Found Assembly GTM.GHIElectronics.UsbClientDP 4.2.101.0
Found Assembly GHIElectronics.Gadgeteer.FEZSpider 4.2.101.0
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.PWM.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Gadgeteer\Core\Assemblies\.NET Micro Framework 4.2\le\gadgeteer.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Graphics.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.IO.pe to deployment bundle
Adding pe file C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\Joystick\NETMF 4.2\le\gtm.ghielectronics.joystick.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Gadgeteer\Core\Assemblies\.NET Micro Framework 4.2\le\gadgeteer.serial.pe to deployment bundle
Adding pe file C:\Users\Nils\Desktop\BluetoothGadgeteer\BluetoothGadgeteer\bin\Debug\le\BluetoothGadgeteer.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.TinyCore.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.IO.pe to deployment bundle
Adding pe file C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\ghi.premium.system.pe to deployment bundle
Adding pe file C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\ghi.premium.io.pe to deployment bundle
Adding pe file C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Net.pe to deployment bundle
Adding pe file C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\ghi.premium.hardware.pe to deployment bundle
Adding pe file C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\UsbClientDP\NETMF 4.2\le\gtm.ghielectronics.usbclientdp.pe to deployment bundle
Adding pe file C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Mainboards\FEZSpider\NETMF 4.2\le\ghielectronics.gadgeteer.fezspider.pe to deployment bundle
Attempting deployment...
Incrementally deploying assemblies to device
All assemblies on the device are up to date.  No assembly deployment was necessary.
Assemblies successfully deployed to device.
Restarting interpreter...
Attaching to device...
Waiting for device to initialize...

and this is the debug output:


Create TS..0.0)    
 Assembly: System.Security (4.2.0.0)  Loading Deployment Assemblies.

Attaching deployed file.

   Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1)  Attaching deployed file.

   Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0)  Attaching deployed file.

   Assembly: Gadgeteer (2.42.0.0)  Attaching deployed file.

   Assembly: Microsoft.SPOT.IO (4.2.0.0)  Attaching deployed file.

   Assembly: GHI.Premium.System (4.2.11.1)  Attaching deployed file.

   Assembly: GHI.Premium.Hardware (4.2.11.1)  Attaching deployed file.

   Assembly: GTM.GHIElectronics.UsbClientDP (4.2.101.0)  Attaching deployed file.

   Assembly: GHIElectronics.Gadgeteer.FEZSpider (4.2.101.0)  Resolving.

GC: 1msec 30852 bytes used, 7308816 bytes available

Type 0F (STRING              ):     24 bytes

Type 15 (FREEBLOCK           ): 7308816 bytes

Type 17 (ASSEMBLY            ):  28992 bytes

Type 29 (MEMORY_STREAM_DATA  ):    396 bytes

Type 34 (APPDOMAIN_HEAD      ):     72 bytes

GC: performing heap compaction...

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\mscorlib.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Native.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Security.PKCS11.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.Security.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Graphics.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.TinyCore.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Net.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.IO.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.IO.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Gadgeteer\Core\Assemblies\.NET Micro Framework 4.2\le\Gadgeteer.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\Joystick\NETMF 4.2\le\GTM.GHIElectronics.Joystick.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\Microsoft .NET Gadgeteer\Core\Assemblies\.NET Micro Framework 4.2\le\Gadgeteer.Serial.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\UsbClientDP\NETMF 4.2\le\GTM.GHIElectronics.UsbClientDP.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.System.dll" geladen
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.IO.dll" geladen
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.Hardware.dll" geladen
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Mainboards\FEZSpider\NETMF 4.2\le\GHIElectronics.Gadgeteer.FEZSpider.dll" geladen, Symbole geladen.
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): "C:\Users\Nils\Desktop\BluetoothGadgeteer\BluetoothGadgeteer\bin\Debug\le\BluetoothGadgeteer.exe" geladen, Symbole geladen.
Der Thread '<Kein Name>' (0x2) hat mit Code 0 (0x0) geendet.
Using mainboard GHI Electronics FEZSpider version 1.0
Reader Thread
Client Mode
Program Started
Der Thread '<Kein Name>' (0x4) hat mit Code 0 (0x0) geendet.


@ andre.m -

please have a look at post #7 [url]https://www.ghielectronics.com/community/forum/topic?id=20145&page=1#msg198710[/url]
This is the current implementation.

I thank you for your help!

@ nilhau -
Hi, again,
it seems, that the driver does not get responses from the BT-Module. From my experience this is in most cases caused by a baudrate mismatch between the baudrate of the mainboards serial port and the actually set baudrate of the serial port of the module. The driver code you are using cannot solve such a situation (logical error). I would suggest to use this driver.
https://www.ghielectronics.com/community/codeshare/entry/763
Version 3 is for NETMF 4.2. You will have to change some setting in ProgramStarted (e.g. Socket Nr.). This driver tries to connect with different baudrates and if the driver finds the baudrate with which it can communicate with the module it sets both serial ports to the baudrate selected in the constructor.

Edit: Another idea: May be that harwareflowcontrol is activated on the bluetooth module. Try to use a K-Socket on the Spider. Or, it is really broken…

1 Like

Hi @ all

now I am very sure my bluetooth module is broken. Why?
I ordered another one and this one is responding as it should do.

Blinking blue LED when connected to the Spider Mainboard and when I start the code i got the “+BTSTATE” respond messages from the module.

Thank you all for you help! :clap:

PS: How to mark this thread as closed or solved?

Not possible, the broken Module is 3 years old…

@ nilhau - Bad luck, did you Check that Vcc and GND arrive at the Module?