Deployment errors on fez spider

Hi.I’m using fez spider and two weeks ago i loaded code to my fez then it was ok.Now it is also working so my device is working now.But i’m try debugging new code to fez and it says “there were deployment errors” and it uses existing code.
Thank you.

@ andre.m - Thank you for quick answer.I pressed reset button then debugged but there was same error.

@ andre.m - Is there another way for this problem? How i can clear existing code?

@ andre.m - yes i have fez config on my laptop,i used it before.Which way i can follow for removing the code by fezconfig?

@ kmrn -
do you see the right target device in the properties of your Project?

@ RoSchmi - Yes i see

@ kmrn - that’s o.k., then try the advice of andre.m.
Sometimes it helps to use another USB Port on the PC, use a powered usb hub, disconnect all additional modules (disconnected from power) or load the Firmware again.

@ kmrn -i’ve tried all way that you said but now there is “ghi bootloader” error.I didnt get this error at the first loading but now there is.

@ kmrn - Have you looked at

@ Mike - İ don’t understand why it’s not continue debugging after i press reset button.I want to remove existing code because i have to add new one.please help if there is another way?

Perhaps you should post what you get in your output window, when you try to deploy (debug) the code

@ RoSchmi - that’s what i get

Found this link on your error message:

What happens when you make a new Project, only with the Spider and the USB power module and no code except the Program Started method?

@ RoSchmi - i use usb client sp module and fez spider without any code in program started.and its what i see output screen

And if you click on “Yes” as the answer of the question?
It seems that the program.started method begins to run but is hold by the Message Window.

@ RoSchmi - i build new project and try debug,after i click yes it says check your hardware and i also see that message

@ RoSchmi - and i uses your bluetooth driver for pulse oximeter.i combined two code in one program.thats code:

namespace Pulse
    public partial class Program
        private int _pulse;
        private int _spo2;

        const string MyDeviceName = "MyFez";   // Device Name
        const string MyPinCode = "0000";            // Pin Code
        const int MySocketNumber = 9;               // The SocketNumber of the mainboard to which the BT-Module is connected
        const long BT_Device_Baudrate = 38400;      // Baudrate
        // possible baudrates 9600, 19200, 38400, 57600, 115200, 230400, 460800

        const bool ReadMode_ByteArray = true;       // false: data are received as strings -Event: bluetooth_DataReceived
        // true: data are received as byte array-Event: bluetooth_DataByteArrayReceived

        const bool FastReadMode = true;             // true: switch to transmit without parsing
        // false: data are always parsed for BT-module messages

        const int MyEventDelay = 20;                // Choose higher value if data received events queue up ( 20 = standard)
        // has no effect in ReadMode_ByteArray Mode in combination with FastReadMode 

        const int SendInterval = 4000;              // In this time interval  we send a message to the BT-Module

        //**************** End Parameter to be changed by user ***************************

        static private Bluetooth bluetooth;
        static private Bluetooth.Client client;

        static int MessageCounter = 1;    // Counter to count the sent messages

        static long BytesTransferred = 0;
        static long LastBytesTransferred = 0;
        static long baudrate = 0;
        static long events = 0;
        static long lastevents = 0;
        static long eventspersec = 0;
        static long showEvent = 0;

        byte[] datadrain = new byte[2000];  // Dummy, here we can put the received data

        // timerSendData is used to fire in interval to send data to the BT-Module
        GT.Timer timerSendData;

        // timer, used to calculate statistics every 2 seconds (not needed in applications)
        GT.Timer CalculateBaudrate;

        // timerEnterPairing is used to enter pairing mode automatically
        GT.Timer timerEnterPairing;

        string dataLine1 = null;      // used to process incoming data in eventhandler: bluetooth_DataReceived (as String)
        string dataLine2 = null;      // used to process incoming data in eventhandler: bluetooth_DataByteArrayReceived (as Byte Array)
        byte[] ReceivedBytes;         // used to process incoming data in eventhandler: bluetooth_DataReceived (as String)
        SerialBuffer mySerialBuffer;  // used to connect incoming data chunks and split after LineFeed (0x0A)

        #region ProgramStarted()
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
            Debug.Print("Program Started");

            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);

            // Set a timer to enter pairing mode after 3 seconds
            timerEnterPairing = new GT.Timer(3000, GT.Timer.BehaviorType.RunOnce);
            timerEnterPairing.Tick += new GT.Timer.TickEventHandler(timerEnterPairing_Tick);

            // Set a timer to send data to the BT-Module in intervals
            timerSendData = new GT.Timer(SendInterval);
            timerSendData.Tick += new GT.Timer.TickEventHandler(timerSendData_Tick);

            CalculateBaudrate = new GT.Timer(2000, GT.Timer.BehaviorType.RunContinuously);
            CalculateBaudrate.Tick += new GT.Timer.TickEventHandler(CalculateBaudrate_Tick);

            // define a bluetooth module running on socket: "MySocketNumber", baudrate: "BT_Device_Baudrate"
            Debug.Print("Program Message: Initialize Bluetooth module on Port " + MySocketNumber.ToString()
                         + " Baudrate: " + BT_Device_Baudrate.ToString());
            bluetooth = new Bluetooth(MySocketNumber, BT_Device_Baudrate);

            bluetooth.EventDelay = MyEventDelay;  // Choose higher value in "Presets" if data received events queue up ( 20 = standard)
            // has no effect in ReadMode_ByteArray Mode in combination with FastReadMode 

            // Set the Mode to receive data as Strings or as Byte Array depending on the settings in "Presets"

            // Set up eventhandler for state changes
            bluetooth.BluetoothStateChanged += new Bluetooth.BluetoothStateChangedHandler(bluetooth_BluetoothStateChanged);

            // Set up eventhandler to receive data from the Bluetooth module as Strings or as Byte Arrays (only one is needed)
            bluetooth.DataReceived += new Bluetooth.DataReceivedHandler(bluetooth_DataReceived);
            bluetooth.DataByteArrayReceived += new Bluetooth.DataByteArrayReceivedHandler(bluetooth_DataByteArrayReceived);

            Debug.Print("Program Message: Set Bluetooth module to Client Mode" + "\r\n");
            client = bluetooth.ClientMode;

            Debug.Print("Program Message: Set Device Name: " + MyDeviceName + "\r\n");
            Thread.Sleep(2000);                     // time was not tested

            Debug.Print("Program Message: Set Device Pincode" + "\r\n");
            Thread.Sleep(2000);                     // time was not tested

            Debug.Print("Program Message: Set BT-Device to: Disable Auto-connect " + "\r\n");

            Debug.Print("Program Message: Set BT-Device to: Enable Auto-connect " + "\r\n");
            Thread.Sleep(200);                      // time was not tested

            Debug.Print("Program Message: Set BT-Device to: PermitBeConnected" + "\r\n");
            Thread.Sleep(200);                      // time was not tested


            mySerialBuffer = new SerialBuffer(256);

            Debug.Print("Program Started");

            multicolorLed.GreenBlueSwapped = true;


            pulseOximeter.ProbeAttached += new PulseOximeter.ProbeAttachedHandler(pulseOximeter_ProbeAttached);
            pulseOximeter.ProbeDetached += new PulseOximeter.ProbeDetachedHandler(pulseOximeter_ProbeDetached);
            pulseOximeter.Heartbeat += new PulseOximeter.HeartbeatHandler(pulseOximeter_Heartbeat);

        #region CalculateBaudrate_Tick  (this is needed only to calaculate statistics)
        void CalculateBaudrate_Tick(GT.Timer timer)
            baudrate = ((BytesTransferred - LastBytesTransferred) / 2) * 10;
            LastBytesTransferred = BytesTransferred;
            eventspersec = (events - lastevents) / 2;
            lastevents = events;

        #region timerSendData_Tick   Sends a message over the Bluetooth Connection
        void timerSendData_Tick(GT.Timer timer)
            //Debug.Print("Program Message: ____________________________timerSendData ticked");
            // check to see that the bluetooth module is connected, and if so send a message over the connection
            if (bluetooth.IsConnected)
                //Debug.Print("Program Message: BT is connected, so I send the message: " + "Hello from TinyClr, Message No.: " + MessageCounter.ToString());

                client.SendLine(MessageCounter + ") SpO2 : " + _spo2 + "\r\n" + "   Pulse : " + _pulse + "\r\n");
                Debug.Print("Program message: BT is not connected, cannot send message");

        #region button_ButtonPressed    Enter Pairing Mode
        void button_ButtonPressed(Button sender, Button.ButtonState state)
            // check to see that the bluetooth module is connected, and if so do nothing
            if (bluetooth.IsConnected)
                Debug.Print("Program Message: You pressed the button but BT was connected, so not activating pairing mode");
            // otherwise, just go into first-time pairing mode.
                Debug.Print("Program Message: You pressed the button and BT was not connected, so I go to pairing mode");

        #region timerEnterPairing_Tick    Enter Pairing Mode
        void timerEnterPairing_Tick(GT.Timer timer)
            if (!bluetooth.IsConnected)
                Debug.Print("Enter pairing mode by timer event");

        // You have the choice to receive the data as strings or as ByteArrays. You need only one

        #region  Eventhandler --  Receive data as Strings
        // Select this output mode with the  bluetooth.SetReadMode_ByteArray(false) command
        private void bluetooth_DataReceived(Bluetooth sender, string data)
            ReceivedBytes = System.Text.UTF8Encoding.UTF8.GetBytes(data);
            mySerialBuffer.LoadSerial(ReceivedBytes, 0, ReceivedBytes.Length);

            // To see the chunks of data we can activate this Debug.Print
            //Debug.Print("\r\n Program Message: Received chunk of data (String Mode). Byte-Count: " + data.Length.ToString() + " Data: " + HexEncoding.ToString(ReceivedBytes, 0, ReceivedBytes.Length) + "\r\n" + data + "\r\n");


        #region  Eventhandler --  Receive data as Byte Arrays
        // Select this output mode with the  bluetooth.SetReadMode_ByteArray(true) command
        void bluetooth_DataByteArrayReceived(Bluetooth sender, byte[] data, int startIndex, int ByteCount)
            BytesTransferred += ByteCount;
            Array.Copy(data, startIndex, datadrain, 0, ByteCount);  // Dummy for the time it takes to get the data (they are not valid for a long time)

            if (ByteCount < 100)   // for short messages we send it over rs232
                mySerialBuffer.LoadSerial(data, startIndex, ByteCount);


        #region  Eventhandler signalizing that the BTSTATE of the Bluetooth module has changed
        void bluetooth_BluetoothStateChanged(Bluetooth sender, Bluetooth.BluetoothState btState)
            // here the bluetooth module's state has changed. First, just debug print the value so we know what is happening
            Debug.Print("New state:" + btState.ToString());

            // If the state is now "connected", we can do stuff over the link.
            if (btState == Bluetooth.BluetoothState.Connected)
                Debug.Print("\r\n Program Message: BT-Connection established, BTSTATE: " + btState.ToString() + "\r\n");

                bluetooth.SetFastReadMode(FastReadMode);  // Set fastReadMode, depending on the flag in presets

                Thread.Sleep(1000);      // do this to wait for BT module to connect; 
                client.Send("\r\nConnected to Fez\r\n");
            // if the state is now "disconnected", you might need to stop other processes but for this example we'll just confirm that in the debug output window
            if (btState != Bluetooth.BluetoothState.Connected)
                // Debug.Print("\r\n" + "Program Message: Bluetooth disconnected, BTSTATE: " +  btState.ToString() + "\r\n");

        void pulseOximeter_Heartbeat(PulseOximeter sender, PulseOximeter.Reading reading)
            Debug.Print("Pulse: " + reading.PulseRate);
            Debug.Print("SPO2: " + reading.SPO2);
            Debug.Print("Signal: " + reading.SignalStrength);

            multicolorLed.BlinkOnce(GT.Color.Red, new TimeSpan(0, 0, 0, 0, 250), GT.Color.Green);

            if (_pulse != reading.PulseRate || _spo2 != reading.SPO2)
                char_Display.PrintString("Pulse: " + reading.PulseRate);
                char_Display.SetCursor(1, 0);
                char_Display.PrintString("SPO2: " + reading.SPO2);

                _pulse = reading.PulseRate;
                _spo2 = reading.SPO2;

        void pulseOximeter_ProbeDetached(PulseOximeter sender)
            Debug.Print("Probe Detached");


            char_Display.PrintString("Probe Detached");

        void pulseOximeter_ProbeAttached(PulseOximeter sender)
            Debug.Print("Probe Attached");


            char_Display.PrintString("Probe Attached");

            _pulse = 0;
            _spo2 = 0;

I don’t know. Can it be that you have a Version mismatch of the Firmware and the assemblies you want to deploy?
What says FEZ Config when you click the “Check Device für Update” Button?

@ RoSchmi - but it was work before.thats message:

@ kmrn -
Sorry, but I have not more time now and I see no obvious reason. Perhaps sombody else can take over.