Hi,
I have an inconsistent issue with IFU on a Cobra III. We have 20 modules so far with the customer that we intend to update with IFU. When the time came for the first update, 2 of the 20 hung and would not recover. When I got them back, I found that they always hang when I try IFU. If I have the failing board bare (we usually have LCD, buttons, CAN/LIN transceivers on a daughter board), and am using a modified version of the standard IFU example (to load Application), and it still fails every time on the InFieldUpdate.FlashAndReset(). It fails with the following exception :
The thread ‘’ (0x2) has exited with code 0 (0x0).
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### GHI.Processor.InFieldUpdate::NativeFlashAndReset [IP: 0000] ####
#### GHI.Processor.InFieldUpdate::FlashAndReset [IP: 000f] ####
#### Program::FlashFirmware [IP: 0011] ####
#### Program::Main [IP: 000d] ####
A first chance exception of type ‘System.InvalidOperationException’ occurred in GHI.Hardware.dll
An unhandled exception of type ‘System.InvalidOperationException’ occurred in GHI.Hardware.dll
After this exception, the board will not boot again, as the application appears to be partially erased or corrupted.
It seems that these 2 Cobras always fail on IFU, although the main SW works fine if I load it via VS or Fez Config. The other 18 Cobras have no problem with IFU, even when I set them to loop the IFU continuously. They have had a second round of IFU with no further problems, so it does seem like these 2 boards are somehow pre-disposed to fail for some reason. All 20 were simply flashed with Fez Config when they arrived with a simple program to write a HW version number to the configuration memory,and then with the then-current version of the SW.
Does anyone know how I can find more details of what the exception might be here? Or is there a known failure rate in the IFU for the G120?
Thanks in advance
Nick
For reference, the modified IFU code I am using to test that gives me this exception is:
(I tried to get it formatted as code but failed )
using GHI.Processor;
using System.IO;
using GHI.IO.Storage;
public class Program
{
public const int BLOCK_SIZE = 65535;
public static void Main()
{
SDCard sd_card = new SDCard();
// Mount the file system
sd_card.Mount();
FlashFirmware();
}
public static void FlashFirmware()
{
// Reserve the memory needed to buffer the update.
// A lot of RAM is needed so it is recommended to do this at the program start.
//InFieldUpdate.Initialize(InFieldUpdate.Types.Firmware | InFieldUpdate.Types.Configuration);
InFieldUpdate.Initialize(InFieldUpdate.Types.Application);
// Start loading the new firmware on the RAM reserved in last step.
// Nothing is written to FLASH In this stage. Power loss and failures are okay
// Simply abort this stage any way you like!
// Files can come from Storage, from network, from serial bus and any Other way.
//LoadFile("\\SD\\Config.hex", InFieldUpdate.Types.Configuration);
LoadFile("\\SD\\FlashTest.JNX1update", InFieldUpdate.Types.Application);
//LoadFile("\\SD\\Firmware2.hex", InFieldUpdate.Types.Firmware); //Only if your device has two firmware files.
// This method will copy The new firmware from RAM to FLASH.
// This function will not return But will reset the system when done.
// Power loss during Before this function resets the system quill result in a corrupted firmware.
// A manual update will be needed if this method failed, due to power loss for example.
InFieldUpdate.FlashAndReset();
}
public static void LoadFile(string filename, InFieldUpdate.Types type)
{
using (var stream = new FileStream(filename, FileMode.Open))
{
var data = new byte[BLOCK_SIZE];
for (int i = 0; i < stream.Length / BLOCK_SIZE; i++)
{
stream.Read(data, 0, BLOCK_SIZE);
InFieldUpdate.Load(type, data, BLOCK_SIZE);
}
stream.Read(data, 0, (int)stream.Length % BLOCK_SIZE);
InFieldUpdate.Load(type, data, (int)stream.Length % BLOCK_SIZE);
}
}
}