BitInit Exception "user buffer is not valid"

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BitInit Exception "user buffer is not valid"

Jump to solution
2,046 Views
cau
Contributor I

Hi,

I'm having trouble writing the OTP Bits to iMX287 when using BitInit.exe. I generated the .sb File with bit_burner.py - which finishes successfully. After that I copied the .sb file to the BitInit folder, plugged in the iMX28 board over USB and run "BitInit.exe". Under Win7 (english or german language) his causes the programm to freeze and after some while it gives this error:

BitInit.exe (Version 2.2.3796.13940)

Unhandled Exception: System.ComponentModel.Win32Exception: The supplied user buf

fer is not valid for the requested operation

  at DevSupport.DeviceManager.DeviceClass.EnumDeviceInterfaceDetails(Int32 inde

x, IntPtr devInfoSet, Guid iFaceGuid, String& devPath, SP_DEVINFO_DATA devInfoDa

ta)

  at DevSupport.DeviceManager.DeviceClass.GetDevInstDataSet()

  at DevSupport.DeviceManager.DeviceClass.BuildDeviceCollection()

  at DevSupport.DeviceManager.DeviceClass.get_Devices()

  at DevSupport.DeviceManager.DeviceManager.FindDevice(Type devClass, Nullable`

1 vid, Nullable`1 pid)

  at BitInit.Program.Main(String[] args)

Running the same on an old WinXP setup works perfectly. But hence we want to figure out how to setup our production environment it is not desirable to use WinXP anymore.

Does anyone have a solution for that - other users seem to be quite happy with BitInit.

Kind Regards

Christian

Labels (1)
0 Kudos
1 Solution
1,481 Views
chris321
Contributor IV

Hello Christian,

I didn't got the BitInit.exe run on my Win7 Prof 64 bit operating system, too. It only works for me on 32 bit systems like xp prof (32bit) and Win7 Prof 64bit.

Good Luck

Chris

View solution in original post

0 Kudos
6 Replies
1,482 Views
chris321
Contributor IV

Hello Christian,

I didn't got the BitInit.exe run on my Win7 Prof 64 bit operating system, too. It only works for me on 32 bit systems like xp prof (32bit) and Win7 Prof 64bit.

Good Luck

Chris

0 Kudos
1,481 Views
christopherpres
Contributor III

Hi Christian,

I have the same problem and just found my solution:

I use the MFG Tool to set the OTP Bits. The MFG Tool also has some flaws in 64bit environments (when clicking on Options->Configurations->USBport the program crashes, so just don't click there), but it works well enough to burn the OTP bits.

In the MFGtool/Profiles directory you have to define a new profile (I just copied an existing one, replaced the .sb file with OtpInit.sb and modified the ucl.xml File. The following posting describes what has to be modified:

How to set OTP bits with MfgTool?

This is the contents of my ucl.xml file

<UCL>

  <CFG>

    <STATE name="Recovery" dev="IMX28"/>

    <STATE name="Updater"   dev="Updater" /> 

    <DEV name="IMX28" vid="15A2" pid="004F"/>

    <DEV name="Updater" vid="066F" pid="37FF" />

  </CFG>

  <LIST name="Singlechip NAND" desc="Install on singlechip NAND">

    <CMD type="boot" body="Recovery" file="OtpInit.sb" timeout="60">flashing OTP.</CMD>

    <CMD type="burn"/>

</LIST>

  <LIST name="SD(with uboot)" desc="Install to SD card">

    <CMD type="boot" body="Recovery" file="OtpInit.sb" timeout="60">flashing OTP.</CMD>

    <CMD type="burn"/>

  </LIST>

  <LIST name="SD(without uboot)" desc="Install to SD card">

    <CMD type="boot" body="Recovery" file="OtpInit.sb" timeout="60">flashing OTP.</CMD>

    <CMD type="burn"/>

  </LIST>

</UCL>

I'm pretty sure that my .xml file is not the optimal solution (most likely it is no necessary to write the command 4 times), but I tried this and it worked.

I hope this can help you.

Best regards,

Christopher

1,481 Views
cau
Contributor I

Thank you Christopher. Initially I was trying to use MfgTool for this task - I already saw your posting... unfortunately I failed understanding what exactly you did - now it is much clearer.

Even if MfgTool seems to be able to burn OTP bits... do you know any way of incrementing a part of the OTP section for each programmed unit? I would like to write the MAC adresses.

Kind regards

Christian

0 Kudos
1,481 Views
christopherpres
Contributor III

You want to write the MAC address into the SRK OTP bits of the processor, right?

I'd write a script which does the following each time you want to burn a new device:

- increment the value in the HAB-fuse-hash-file (srk_fuses.bin, the one which opt_burner.py takes as input)  (the starting value would be the lowest address of your MAC address range)

- run otp_buner.py to generate OtpInit.sb

- copy OtpInit.sb to the new MFG Tool Profile directory

Then you'd have to use MFG Tool to burn the fuses. The ugly thing is that I think you cannot script the MFG Tool so one would first have to call the script and then have to open the MFG Tool

Best regards,

Christopher

0 Kudos
1,481 Views
cau
Contributor I

Kind of... I want to write the Mac address to registers hw_ocotp_cust0 through hw_ocotp_cust3. The Ethernet driver will read it from there and use that for the interfaces eth0 and eth1.

Your suggested solution might work but is awkward for a big number of boards... we need to manufacture hundrets of boards this way. That means that after flashing one board one had to close MFG Tool, run a script to modify the OtpInit.sb, reopen MFG Tool, start the flash process...

So starting MFG Tool, flashing, closing MFG Tool would have to be done somehow automatically... I have not seen a way to do that unfortunately. Have you?

Kind regards

Christian

0 Kudos
1,481 Views
christopherpres
Contributor III

well, I don't have a nice solution for your problem, but.....

You do not have to close the MFGTool, you have to be update the OtpInit.sb file. If there was be a possiblity to tell MFGTool in the ucl.xml File that you want to launch a local script, then everything would be fine. However, I did not find such a thing. However, the source code of the MFG Tool is available and you could implement such a feature - might be a lot of effort though. Alternatively (if it is an option for you) you could have a look at the Linux version of the MFG Tool - perhaps this version is runnable from the command line (I did not check).

There is also a third option (it's a dirty workaround):

- Use the Windows MFG Tool to install a simple Linux on the i.MX28. On this Linux rootfs you already have the otp_burner.py.

- Use the "push" command in the ucl.xml file to give the Linux the input files for otp_burner (to tell it the actual MAC address which you count on the Windows computer)

- Run opt_buner.py on Linux running on the i.MX28

- Use the "push" command to tell Linux to copy OtpInit.sb into the MFGTool/Profiles/yourprofile directory (you'd have to set up some file exchange server/protocol on Windows) (I also don't know whether the Ethernet connection works when the board bootet in USB mode, but I think it should)

- Burn the OTP with the MFG Tool

still, also with this solution you'd have to do some "clicking-work" and cannot fully automate the OPT burning process in a script

Best regards,

Christopher

0 Kudos