USBizi deploy problems

Hello all,
I am experimenting similar deployment issues with PANDA II and GHI NETMF v4.1 SDK : I have a lot of deployment errors :

Here is what happen :
-I deploy my application (using Interrupts, PWM, ios, and touch fez and soon webserver)

  • Often (too much) visual express 2010 shows the output " Incrementally deploying assemblies to device / Deploying assemblies for a total size of 79336 bytes" and then hangs here
    -In that case I unconnect USB from PandaII and try to deploy again, wich works often (deploy sucess)
    -Sometimes even when I try several times to disconnect/reconnect USB and deploy again, visual express 2010 hangs again…
    In that case the only way to do things going better is to reupdate firmware with USBizi updater.

-I wonder if it could be related to the size of code? I guess it happens more since my code has significantly grows up (about 80kbytes)?
-I read on this forums that a powered USB port could do thing best in some cases. Should it be related to my issue?
-Indeed I am surprised that firmware could be corrupted by application…

Any help/clue would be appreciated!

Regards,
CCa

Can you please show your main method? How many projects in your solution?

I also found that just pressing reset button helps, during “stuck” deployment

Thanks for reply :
Yes, I agree that sometimes Reset button helps.
My main includes PWM, button and optical sensor interrupt, fez touch driver and copying a picture from uSD to LCD…it looks like :



using System;
using System.IO;
using System.Text;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.IO;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.System;
using GHIElectronics.NETMF.Native;

//<...........>

  public static void Main()
        {

          bool ledState = false;
            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
            for (int i = 0; i < 5; i++ )
            {
                Thread.Sleep(100);
                ledState = !ledState;
                led.Write(ledState);
            }

            LcdITDB02.LCD_Init();
            LcdITDB02.BacklightBrightness = 100;

            //Sequence d'init de l'ecran FEZ TOUCH
            // This is for FEZ Panda II
            FEZ_Components.FEZTouch.LCDConfiguration lcdConfig = new FEZ_Components.FEZTouch.LCDConfiguration(
                FEZ_Pin.Digital.Di28,
                FEZ_Pin.Digital.Di20,
                FEZ_Pin.Digital.Di22,
                FEZ_Pin.Digital.Di23,
                new FEZ_Pin.Digital[8] { FEZ_Pin.Digital.Di51, FEZ_Pin.Digital.Di50, FEZ_Pin.Digital.Di49, FEZ_Pin.Digital.Di48, FEZ_Pin.Digital.Di47, FEZ_Pin.Digital.Di46, FEZ_Pin.Digital.Di45, FEZ_Pin.Digital.Di44 },
                FEZ_Pin.Digital.Di24,
                FEZ_Pin.Digital.Di26
                );

            FEZ_Components.FEZTouch.TouchConfiguration touchConfig = new FEZ_Components.FEZTouch.TouchConfiguration(
                SPI.SPI_module.SPI2, FEZ_Pin.Digital.Di25, FEZ_Pin.Digital.Di34
                );
            
            lcdFEZ = new FEZ_Components.FEZTouch(lcdConfig, touchConfig);
            // Montage microSD
            PersistentStorage sdPS;
            sdPS = new PersistentStorage("SD");
            sdPS.MountFileSystem();

 path = @ "\SD\picture.bin";

            printLCDPictFromSD(path, 100, 15);

 ////////////////////////////////////////////////////////////////////////////////
 //INIT MOTEUR
            PID.Init_PID();

 InterruptPort it_motor  = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di1, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);
            InterruptPort sw        = new InterruptPort((Cpu.Pin)FEZ_Pin.Digital.LDR, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);

   it_motor.OnInterrupt += new NativeEventHandler(motor_OnInterrupt);
            sw.OnInterrupt += new NativeEventHandler(button_OnInterrupt);

pwmMotor.Set(Param.iPWMFreqHz, (byte)fDutyCycleFiltered);


        

            //Affichage secondes
            string sCpt;
            while (true)
            {
                for (char cDigit2 = '5'; cDigit2 > '0'; cDigit2--)
                {
                    //printLCDCharFromSD(cDigit2, 30, 120, SIZE_LARGE);//Affichage digit2
                    //Thread.Sleep(200);
                    for (char cDigit1 = '9'; cDigit1 >= '0'; cDigit1--)
                    {
                        sCpt = cDigit2.ToString() + cDigit1.ToString();
                        //printLCDCharFromSD(cDigit1, 30, 170, SIZE_LARGE);//Affichage digit1
                        lcdFEZ.DrawString(sCpt, 30, 170, FEZ_Components.FEZTouch.Color.White, FEZ_Components.FEZTouch.Color.Black);
                        Thread.Sleep(750);
                    }
               
                }
            }

}

Edit : I was also trying to introduce some native code with RLP just before I had to reflash firmware. Maybe wrong calls to RLP can more easily corrupt the flash?


//Init RLP
            int ret = 0;
            RLP.Enable();
            RLP.Unlock("<RLP KEY>"});
            byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.RLP_test);
       
            RLP.LoadELF(elf_file);
            RLP.InitializeBSSRegion(elf_file);
            FillByteArray = RLP.GetProcedure(elf_file, "FillByteArray_c");
            // We don't need this anymore
            elf_file = null;
            byte[] byteArray = new byte[128];
            ret = FillByteArray.Invoke(byteArray, 0x51); // crash-tested before with incorect call :  ret = FillByteArray.Invoke(byteArray ,byteArray ,byteArray ); 


With no RLP experience myself, I can still certainly understand why if you mess up the RLP your Fez may no longer work as you expect, so like everything when introducing a new concept/functional block, you should test it in isolation and make sure that you have that sorted out. That way you would have known it was only your RLP that caused the main issue.

Yes, Doing an other test with just including the simple RLP application with wrong calls, I was able to corrupt flash again… and after re-updating firmware all was okay again… => So you are probably right, Brett, it is likely the wrong RLP access that corrupt the flash.

Indeed, I was experiencing deployments errors/hanging long before I try RLP. => In that case, cycling the power of pandaII (sometimes several trials are necessary) and/or restarting visual express made finally the deployment work.