Can you update fez Panda 2's project without a USB?

Hello all,

I was wondering today, where I am working on a project for the FEZ Panda 2, if it was possible to update the panda without using the USB and visual studio to deploy an application.

I currently have a BlueTooth module connected to the board (through COM3) and thought it would be cool if I could ‘update’ the program using it instead (if this is possible)?

I.e. if I needed to ‘patch’ the software, rather than connecting it to the PC and updating it there, I don’t suppose I could send the update through this bluetooth device, and have the Fez read this as an update, and send it from there?

(Obviously the FEZ panda 2 is very old/discontinued, but this would still be pretty good to ‘update’ without using the USB (even using the SD card to update would be cool too!).

Any suggestions i’ll be glad to hear from you!

@ jbutler483 - I think the feature you’re looking for is called In-Field Update (IFU). This allows you to update your managed code using RS232 or SD card. Very useful if you need to patch software on boards that are already with customers in the field. You need to convert your binary application into SREC/HEX format to do this.

There are many topics on the forum regarding IFU.

Here’s some code I use for the Panda II to allow customers to update their code in the field via microSD card:


using System;
using System.IO;

using Microsoft.SPOT;

using GHIElectronics.NETMF.System;
using GHIElectronics.NETMF.IO;

namespace ManagedBootLoader
{
    // User-defined program responsible for performing application updates.
    public class Program
    {

        /// <summary>
        /// This is the filename that the program will check to determine if a program update is available.
        /// </summary>
        public static string UpdateFileName = "Application.hex";

        private static PersistentStorage sd;
        private static string updateFilePath;
        private static FileStream file;

        public static void Main()
        {

            try
            {
                // Assume SD card is already inserted
                sd = new PersistentStorage("SD");
                sd.MountFileSystem();

                updateFilePath = "\\SD\\" + UpdateFileName;

                // Check for presence of update file
                if (File.Exists(updateFilePath) == false)
                {
                    // Return to application if update file not found
                    SystemUpdate.AccessApplication();
                }

                file = new FileStream(updateFilePath, FileMode.Open, FileAccess.Read);
            }
            catch (Exception)
            {
                // If an exception occurs at this point, the application region has not yet been touched and should
                // still be intact, so we can return to it.
                SystemUpdate.AccessApplication();
            }

            // *************************** POINT OF NO RETURN *******************************

            // The application region will be modified at this point. The bootloader MUST successfully finish its work, 
            // or else the application will be corrupted. Any exceptions that occur after this point are intentionally
            // uncaught so they can terminate the bootloader, giving a chance to attempt another update during the
            // next reboot.

            // Start update
            SystemUpdate.ApplicationUpdate.Start();

            // Read the file in chunks
            byte[] buffer = new byte[10 * 1024];
            int length;

            do
            {
                length = file.Read(buffer, 0, buffer.Length);
                SystemUpdate.ApplicationUpdate.Write(buffer, 0, length);
            } while (length == buffer.Length);

            file.Close();

            // End update
            SystemUpdate.ApplicationUpdate.End();

            // Remove the update file to ensure that the update process doesn't start again when the normal application runs
            File.Delete(updateFilePath);

            // The update file will only truly be deleted when we unmount the file system. If we forget to do this, the
            // file will remain.
            sd.UnmountFileSystem(); 

            // Access the application
            SystemUpdate.AccessApplication();

        }
    }
}

1 Like