stephenhewitson

Programming iMX28 without mfgtool

Discussion created by stephenhewitson on Oct 22, 2014
Latest reply on Jul 21, 2015 by stephenhewitson

Hi,

 

I am trying to make an automated production environment for programming and testing our product. Previously we would call mfgtool from a custom application, which meant that a user was still required to be present during the programming stage, where we wanted if to be under application control.

 

BitInit is a piece of software that allows the OTP bits to be burned. This is provided with DevSupport.dll that contains a whole load of functionality allowing the iMX28 to be programmed from a C# application.

 

This is just to help people who are having a similar requirement...

 

First we need to get the iMX28 to enumerate as a dummy USB harddrive:

CurrentDevice =(DevSupport.DeviceManager.HidDevice)DevSupport.DeviceManager.Instance.FindDevice(typeof(DevSupport.DeviceManager.HidDeviceClass), new ushort?((ushort)5538), new ushort?());
DevSupport.Api.HidApi.DownloadFw dFW = new DevSupport.Api.HidApi.DownloadFw(@"c:\temp\uce_ivt.sb");
CurrentDevice.SendCommand(dFW);


Then we need to wait for the enumeration to complete:

System.Collections.ObjectModel.Collection<DevSupport.DeviceManager.Device> cDevices = new System.Collections.ObjectModel.Collection<DevSupport.DeviceManager.Device>();
while (cDevices.Count == 0)
{
     cDevices = DevSupport.DeviceManager.WpdDeviceClass.Instance.Refresh();
     Thread.Sleep(500);
}

 

We've now identified the device, but we need the volume too to actually send stuff to it. So we get a list of all the volumes on the PC and find the one that has the same drive letter as the Windows Portable Device we found earlier.

Once we've matched the two together, we can send UTP Commands as per the ucl.xml file.

 

System.Collections.ObjectModel.Collection<DevSupport.DeviceManager.Device> cVolumes = DevSupport.DeviceManager.VolumeDeviceClass.Instance.Refresh();

foreach(DevSupport.DeviceManager.Device volume in cVolumes)
{
     if (volume.ToString().Contains(cDevices[0].FriendlyName.Replace("\\", String.Empty)))
     {
          DevSupport.DeviceManager.UTP.UpdateTransportProtocol utp = new DevSupport.DeviceManager.UTP.UpdateTransportProtocol((DevSupport.DeviceManager.Volume)volume);
          utp.UtpCommand("MediaType:NAND");
          utp.UtpCommand("QueryStoreName:NAND FLASH Storage,Timeout:10");
          utp.UtpCommand("wfw");
          utp.UtpCommand("fwtype:EB_SB");
          utp.UtpWrite("send", @"c:\temp\files\eboot_ivt.sb");
          utp.UtpCommand("save");
          utp.UtpCommand("wfw");
          utp.UtpCommand("fwtype:NK_NB");
          utp.UtpWrite("send", @"c:\temp\files\nk.nb0");
          utp.UtpCommand("save");
          utp.UtpCommand("QueryFolderStatus:FlashDisk,Timeout:10");
          utp.UtpCommand("Done");
     }
}

 

 

Hopefully this all makes sense and people find it useful.

 

Thanks,

Stephen

Outcomes