IFU only works once

We are using basically identical code to the guide to gain IFU features on a G120:


Our process is:

  • Wipe and setup using G120 Updater to 4.2 from package “NETMF and Gadgeteer Package 2013 R2”
  • Use MFDeploy to write our hex file

Our code then runs and we check a USB drive for an app.hex file, only upgrading the Deployment flash area.

First flash upgrade always works. Flash is upgraded and new code runs.

On the second attempt we can monitor (using MFDeploy to view the Debug.Print output) that the USB image is being written ok to SystemUpdate. But when FlashAndReset() is called, it sits there for a long time before resets and not writing the new image.

Any ideas?


ok. Tracked it down.

The images had one difference I didn’t appreciate - some power settings.

One of the commented lines prevents the IFU process working…

        public override void ActivateLowPowerOptions()
            Register PCONP = new Register(0x400fc0c4);

            PCONP.ClearBits(1 << 30);//Turn Off Ethernet
            //PCONP.ClearBits(1 << 0);//Turn Off PCLCD
            //PCONP.ClearBits(1 << 19);//Turn off PCI2C1
            //PCONP.ClearBits(1 << 7);//Turn off PCI2C0
            //PCONP.ClearBits(1 << 26);//Turn off PCI2C2

            //PCONP.ClearBits(1 << 10);//Turn off PCSSP1
            //PCONP.ClearBits(1 << 20);//Turn off PCSSP2
            //PCONP.ClearBits(1 << 21);//Turn off PCSSP0       

Edit: Firefox cannot use editing tags

Ethernet ram is used even if the peripheral is not used.

Not sure what you’re saying there Gus… I can turn off Ethernet ok. It’s the LCD or something else.

I’ll be playing with power soon to optimize this, but surprising IFU requires an active LCD or SPI bus…

You should not turn Ethernet off at any time.

The G120 doesn’t have a PHY, what is the point of keeping it running? It uses a lot of power.

The ram like I said in my previous reply.