Package installer with many imporovements

I simply started MFDeploy, chose USB/FEZ Hydra_Gadgeteer and clicked Plugin/Debug/Erase Firmware.

I just made a movie of the whole update procedure (I made one cut during the dataflash erase) which should be available on youtube in a few minutes:

Update: The first upload didn’t work. I’ll post a new link in here when I managed to get the video up.

wow! This could be a bug, but in this case, this is a very good bug! Will give it a try!

OK now here is the video I promised earlier…

Awesome! Erasing the firmware shouldn’t erase tinybooter so this is a bug. It is a very good bug :smiley:

We will test this further and see how we can make the update simpler. Thanks for the advice.

Tested the SD Card and get the following error when I insert the Sd Card. Before you ask, the card is formated to FAT and is 16 meg capacity.

Une exception de première chance de type ‘System.Exception’ s’est produite dans GHIElectronics.OSH.NETMF.Hardware.dll
SDCard ERROR : Error mounting SD card - no card detected.
#### Exception System.Exception - CLR_E_FAIL (1) ####
#### Message:
#### GHIElectronics.OSH.NETMF.Hardware.StorageDev::MountSD [IP: 0000] ####
#### GHIElectronics.Gadgeteer.FEZHydra::_MountStorageDevice [IP: 0003] ####
#### Gadgeteer.Modules.GHIElectronics.SDCard::MountSDCard [IP: 0012] ####
#### Gadgeteer.Modules.GHIElectronics.SDCard::_sdCardDetect_Interrupt [IP: 000a] ####
#### Gadgeteer.Interfaces.InterruptInput::OnInterruptEvent [IP: 0055] ####
#### System.Reflection.MethodBase::Invoke [IP: 0000] ####
#### Gadgeteer.Program::DoOperation [IP: 001a] ####
#### Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 004a] ####
#### Microsoft.SPOT.Dispatcher::PushFrame [IP: 001d] ####
#### Microsoft.SPOT.Dispatcher::Run [IP: 0006] ####
#### Gadgeteer.Program::Run [IP: 001c] ####
#### HyperionGadgeteer.Program::Main [IP: 001a] ####

Please post thd code you used. Also, have you tried another card?

With another Card the board freeze. The freezing Card is FAT32 with 3 folders. The other card is FAT and empty.


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 GTI = Gadgeteer.Interfaces;

using Microsoft.SPOT.Hardware;
using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Modules.Seeed;

namespace HyperionGadgeteer
{
    public partial class Program
    {
        // Définission des variable globales
        Font baseFont = Resources.GetFont(Resources.FontResources.NinaB);
        Font baseFontSmall = Resources.GetFont(Resources.FontResources.small);
        GTI.I2CBus MyI2C;
        bool RunningTest = true;
        int I2C_timeout = 100;
        int bitShift = 0;
        long ValueToWrite = 255;
        byte[] ByteToWrite = new byte[1];
        byte[] ByteRead = new byte[1];
        ushort PHILLIPS_PFC8574A_ADDRESS = 0x38;
        int PHILLIPS_PFC8574A_CLOCK_IN_kHz = 100;
        
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/
            
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            GT.Socket socket = GT.Socket.GetSocket(5, true, MyExtender, null);
            MyI2C = new GTI.I2CBus(socket, PHILLIPS_PFC8574A_ADDRESS, PHILLIPS_PFC8574A_CLOCK_IN_kHz, null);

            ShowHyperionInfo();

            // Définitions des timers
            GT.Timer TimerOR8 = new GT.Timer(250);   // every 0.5 seconds (500ms)

            // Définition des Handlers
            TimerOR8.Tick += new GT.Timer.TickEventHandler(TimerOR8_Tick);
            MySDCard.SDCardMounted += new SDCard.SDCardMountedEventHandler(MySDCard_SDCardMounted);
            MySDCard.SDCardUnmounted += new SDCard.SDCardUnmountedEventHandler(MySDCard_SDCardUnmounted);
            MyButton.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(MyButton_ButtonPressed);

            // Démarrage des timers
            TimerOR8.Start();
                        
            //Initialisation des relais à l'état éteint;
            ByteToWrite[0] = (byte)ValueToWrite;
            MyI2C.Write(ByteToWrite, I2C_timeout);

            MyI2C.Read(ByteRead, I2C_timeout);     
            //ShowRelayState();

        }
                     
        void ShowRelayState()
        {
            MyOledDisplay.SimpleGraphics.Clear();
            string RelayResult;
            RelayResult = IsSet(ByteRead[0], 0).ToString() + " " + IsSet(ByteRead[0], 1).ToString() + " " + IsSet(ByteRead[0], 2).ToString() + " " + IsSet(ByteRead[0], 3).ToString() + " " + IsSet(ByteRead[0], 4).ToString() + " " + IsSet(ByteRead[0], 5).ToString() + " " + IsSet(ByteRead[0], 6).ToString() + " " + IsSet(ByteRead[0], 7).ToString();
            MyOledDisplay.SimpleGraphics.DisplayText(RelayResult, baseFont, GT.Color.Purple, 15, 75);
        }

        int IsSet(long ba, int bit)
        {
            long mask = 1L << bit;
            if ((ba & mask) != 0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

        void Set(ref long ba, int bit)
        {
            ba |= 1L << bit;
        }

        void Clear(ref long ba, int bit)
        {
            long mask = 1L << bit;
            mask = ~mask;
            ba &= mask;
        }

        void ShowHyperionInfo()
        {
            MyOledDisplay.SimpleGraphics.DisplayText("Inertia Systemes", baseFont, GT.Color.Blue, 15, 15);
            MyOledDisplay.SimpleGraphics.DisplayText("Hyperion P.A.S.", baseFont, GT.Color.White, 15, 30);
            MyOledDisplay.SimpleGraphics.DisplayText("Version 2012.02.19", baseFontSmall, GT.Color.White, 15, 45);
        }

        #region EventHandler

        void TimerOR8_Tick(GT.Timer timer)
        {
            if (RunningTest)
            {
                ValueToWrite = 255;
                Clear(ref ValueToWrite, bitShift);
                ByteToWrite[0] = (byte)ValueToWrite;
                MyI2C.Write(ByteToWrite, I2C_timeout);
                MyI2C.Read(ByteRead, I2C_timeout);
                //ShowRelayState();

                if (bitShift < 7)
                {
                    bitShift += 1;
                }
                else
                {
                    bitShift = 0;
                }
            }
            
            //throw new NotImplementedException();
        }


        void MyButton_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
        {
            if (RunningTest)
            {
                RunningTest = false;
            }
            else
            {
                RunningTest = true;
            }
            
            //throw new NotImplementedException();
        }

        void MySDCard_SDCardMounted(SDCard sender, GT.StorageDevice SDCard)
        {
            Debug.Print("\r\nAn SD card has been inserted.");
            if (sender.IsCardInserted)
            {
                Debug.Print("The IsCardInserted property correctly says that the SD Card is inserted.");
            }
            else
            {
                Debug.Print("*** The IsCardInserted property incorrectly claims that the SD card is not inserted.");
            }
            if (sender.IsCardMounted)
            {
                Debug.Print("The IsCardMounted property correctly says that the SD Card is mounted.");
            }
            else
            {
                Debug.Print("*** The IsCardMounted property incorrectly claims that the SD card is not mounted.");
            }

            Debug.Print("\r\nUsing the SDCard parameter of the SDCardMounted event, the directory of the SD card root is:");
            string[] root = SDCard.ListRootDirectoryFiles();
            foreach (string fileName in root)
            {
                Debug.Print("    " + fileName);
            }

            Debug.Print("\r\nUsing the GetStorageDevice call, the directory of the SD card root is:");
            string[] root2 = sender.GetStorageDevice().ListRootDirectoryFiles();
            foreach (string fileName in root2)
            {
                Debug.Print("    " + fileName);
            }

            Debug.Print("\r\nPlease remove the SD card to finish the test.");
        }


        void MySDCard_SDCardUnmounted(SDCard sender)
        {
            Debug.Print("\r\nAn SD card has been removed.");
            if (!sender.IsCardInserted)
            {
                Debug.Print("The IsCardInserted property correctly says that the SD Card is not inserted.");
            }
            else
            {
                Debug.Print("*** The IsCardInserted property incorrectly claims that the SD card is inserted.");
            }
            if (!sender.IsCardMounted)
            {
                Debug.Print("The IsCardMounted property correctly says that the SD Card is not mounted.");
            }
            else
            {
                Debug.Print("*** The IsCardMounted property incorrectly claims that the SD card is mounted.");
            }

            Debug.Print("\r\nEnd of SD_Card test.");
        }
       #endregion
    }
}

Please keep code tagged. I modified your post so code is readable

Does anybody has problem using ENC28 with custom port and sending receiving data?

I’m looking at the ENC module at the moment. I’m also finding limitations, but remember that this is beta code. I would suggest that you would be better off starting a new thread rather than getting all mixed up in this one, or post in a similar one - there is another about the ENC module on the Gadgeteer forum).

I’ll post up the issues that I find in a few days once I’ve had a good mess about with it.

Phil

Ok OzFlip, I’ll wait for your feedback in a few days :slight_smile:
I can’t wait…

A minor bug I noted today.

When updating a Hydra with a an EMX connected via another USB port, when prompted to reset the button in the dialog won’t enable if both are connected. Tried a couple of times, then when I unplugged the EMX dev board and reran the update, it properly detected the Hydra after reset.

Firmware update with multiple NETMF devices connected is untested and not supported as of now. But thanks for the feedback, We will note it fro future.

Joystick press & release events don’t seem to fire.

Remove joystick and put button (same code) will it work now?

Now, remove joystick and add button in designer, will it work?

Haven’t checked joystick yet, have tested socket 4 though…still doesn’t work.

I’ve tried both the OLED and the Music module on 4, neither work.

Both are fine on socket 3 though.