K8055 - Invalid Operation Exception

Hi,

I installed the latest SDK with DLL 4 and VB2008

When loading and running the K8055Demo for VB2008, everything works fine: the board connects and responds as intended.

Then, i try to use this code as a template for another project: i simply copy the files in another project folder as a starting point by modifying it to suit my needs.

But even without modifying anything, when I try to execute, i receive a “InvalidOperationException” with the explanation:
" Une erreur s’est produite lors de la création du formulaire. Pour plus d’informations, consultez Exception.InnerException. L’erreur est : Tentative de chargement d’un programme de format incorrect. (Exception de HRESULT : 0x8007000B)"

Sorry, I’m not a VB champion, but it seems that simply copying files to use them as a starting point for a new project doesn’t work…

I’m pretty sure it’s only a small detail to fix, but i don’t know where to search. Any clue ? Thanks.

Edit: The DLL is present in the Windows folder and in the SysWoW64 folder

Here are the details of the exception:

L’exception System.InvalidOperationException n’a pas été gérée
Message=“Une erreur s’est produite lors de la création du formulaire. Pour plus d’informations, consultez Exception.InnerException. L’erreur est : Tentative de chargement d’un programme de format incorrect. (Exception de HRESULT : 0x8007000B)”
Source=“K8055-I2C1”
StackTrace:
à K8055_I2C.My.MyProject.MyForms.Create__Instance__[T](T Instance) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 190
à K8055_I2C.My.MyProject.MyForms.get_Form1()
à K8055_I2C.My.MyApplication.OnCreateMainForm() dans C:\Users\dvb\Documents\Visual Studio 2008\Projects\K8055-I2C1\K8055-I2C1\My Project\Application.Designer.vb:ligne 35
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
à K8055_I2C.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81
à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
InnerException: System.BadImageFormatException
Message=“Tentative de chargement d’un programme de format incorrect. (Exception de HRESULT : 0x8007000B)”
Source=“K8055-I2C1”
StackTrace:
à K8055_I2C.Form1.SetCounterDebounceTime(Int32 CounterNr, Int32 DebounceTime)
à K8055_I2C.Form1.RadioButton2_CheckedChanged(Object sender, EventArgs e) dans C:\Users\dvb\Documents\Visual Studio 2008\Projects\K8055-I2C\Form1.vb:ligne 157
à System.Windows.Forms.RadioButton.OnCheckedChanged(EventArgs e)
à K8055_I2C.Form1.InitializeComponent() dans C:\Users\dvb\Documents\Visual Studio 2008\Projects\K8055-I2C\Form1.Designer.vb:ligne 362
à K8055_I2C.Form1…ctor()
InnerException:

You have to do this:

Select Tools -> Options -> Projects and Solutions -> General
Check the ‘Show advanced build configurations’ check box.

Select Tools -> Settings -> Expert Settings to see the Build option.
Then select the menu option: Build -> Configuration Manager
In the column ‘Platform’ select <new…>
To the ‘New platform’ select x86

Now go to menu Project -> Properties… There under the Compile and Debug tabs there should be ‘Active (x86)’

Now you can compile the code.

Please see this thread for more details: viewtopic.php?f=3&t=5363

It worked perfectly !

Thank you very much for your help.

Off topic:
You probably figure it out from the name of the project, I’m giving a try to see if I can use K8055 to connect an I2C bus. In fact, I’m just willing to have a simple I2C EEPROM programmer/reader. Using an output for SCL, one output for power control of the EEPROM adapter, and one output + one input for SDA. It will be slow, but it should work, i think. I will experiment to make it work, anyway, maybe using active pull-ups such as LTC4311 to ensure a correct signal on the emulated bus. In case of success, I’ll publish the VB code and schematics of the adapter I’ll have to build to connect the EEPROM to the K8055 on this forum: could be useful to someone.