Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 5, 3 & 1

FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi there,

we have implemented a USB Bootloader starting from the excellent AN https://www.cypress.com/documentation/application-notes/an73503-psoc-usb-hid-bootloader

when we create the release mode version of the attached AN (we made some changes).

we found out that it works only on the machine that has PSoC creator installed (and it doesn't work for our customer).

please see the error message: (can't find the Bootloader_Utils.dll.) The confusing part is that when we browsed inside the installed directory,the dll is there! so I'm very confused...

do you have any suggestions?

Thanks!

Francesco

ofya8mpr.bmp

0 Likes
62 Replies
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Thank you Len,

if you have problem let me know I'll create the project for you.

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

I changed my VID to CDAB and PID to 7.

I load my .cyacd.

I now get the following window:

pastedImage_0.png

I press "Program" and nothing happens.   Am I still missing something?

You mentioned:

3. write the command "GO TO BOOTOLADER"

I'm not sure how to interpret this.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi Len,

the reason is because after the "Bootloader" command, the PSoC should go in "Bootloader USB mode" with a different VID and PID.

Shall I send you the bootloader and the program for your kit? it should not take too long.

As alternative... you could have a second kit with VID=0xCDAB  PID= 0x8

and you unplug the the kit with PID = 0x7 and plug the one with PID = 0x7.

Kind regards,

Francesco

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

Maybe it would be better if you sent the project.

Thanks.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi Len,

can you send me an email of francesco@neutronix-ltd.co.uk with your email and I'll send you the project files?

( I can't share the project to the forum) but I have agreed with my customer that I can share with Cypress.

Kind regards,

Francesco

0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi Len,

thank you for your help so far.

I have send you the hex files  and the cyad for you to test.

Please let me know if you can program using the bootloader.

Kind regards,

Francesco

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

I did as you instructed.

Now my PSoC5 completed the programming of your .cyacd file with no errors.

pastedImage_0.png

I did notice however, that the GREEN progress bar at the bottom never goes away.  It appears to be stuck at about 97%.  Probably just a visual cleanup thing.

It would appear that my system doesn't have the same issue as your customer.   I've got another idea to try shortly.

A thought:  Is it possible that your customer's virus checking SW is blocking some install or blocking access to the installed .dll?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

I install your USBBootloader as a published program.  I got the same results.

Part of the potential problem on yours and my system is that we are developers.  We may have certain files and the such installed that your customer does not.

Hmm?  (... Head scratching ...)

You said you have one of your customer's computers that exhibit this issue.  Is that still true?

If so,  can you run the USBBootloader and get the failure again.   This time, expand the "Unhandled Exception" message box.   There might be some additional information to be gleaned.

Additionally, you provided a filtered output from ProcessMon from the offending machine.  The filtering included only Process="USBBootloaderHost.exe" and excluded Result="Success".  This time remove the Result="Success" exclusion.

I'm spit-balling here ...

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi Len,

the issue is that the system can't load the USB dll.

there is an error System.BadImageFormatException which probably happen when the program attempt to load the USB_bootloader.dll.

************** Exception Text **************

  1. System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

   at USBBootloaderHost.Bootloader_Utils.CyBtldr_Program(String file, Byte[] securityKey, Byte appId, CyBtldr_CommunicationsData& comm, CyBtldr_ProgressUpdate update)

   at USBBootloaderHost.Form1.uploadFirmware() in C:\Users\franc\Desktop\Lidco\lidco_USBBootloaderHost\USBBootloaderHost\Form1.cs:line 313

   at CyUSB.USBDeviceList.PnP_Event_Handler(IntPtr pnpEvent, IntPtr hRemovedDevice)

   at CyUSB.MsgForm.WndProc(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************

mscorlib

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.8806 (QFE.050727-8800)

    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll

----------------------------------------

USBBootloaderHost

    Assembly Version: 1.0.0.0

    Win32 Version: 1.0.0.0

    CodeBase: file:///C:/DAC%20USB%20Bootloader/DAC_USBBootloaderHost/USBBootloaderHost/bin/Release/USBBootloaderHost.exe

----------------------------------------

  1. System.Windows.Forms

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.5491 (Win7SP1GDR.050727-5400)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.8806 (QFE.050727-8800)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

  1. System.Drawing

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.5495 (Win7SP1GDR.050727-5400)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

----------------------------------------

CyUSB

    Assembly Version: 3.4.7.0

    Win32 Version: 3.4.7.0

    CodeBase: file:///C:/DAC%20USB%20Bootloader/DAC_USBBootloaderHost/USBBootloaderHost/bin/Release/CyUSB.DLL

----------------------------------------

************** JIT Debugging **************

To enable just-in-time (JIT) debugging, the .config file for this

application or computer (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

  1. enabled.
0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

I looked up System.BadImageFormatException on the internet.   Here's a link to what Microsoft has to say about it.

BadImageFormatException Class (System) | Microsoft Docs

Microsoft cites many potential reasons for this exception.

One of possible reasons is that you may have compiled with a later version of the .Net Framework.

If I'm correct, you're using

Win32 Version: 2.0.50727.8806 (QFE.050727-8800)

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll

Therefore it works with your computer.  (As well as mine since I usually have a later version of the .Net Framework.  

However, your customer's computer may have installed an earlier version.

If this is the case, I believe there are two ways to solve:

  • Lower the .Net Framework version for your compile.
  • Raise the .Net Framework version for your customer as a install requirement.

Take a look at the other potential causes to see if there might be a more logical match.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Thanks Len,

let me check with my customer.

Francesco

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

It's common in the "Publish" requirements to 'force' a load of prerequisite components.

Here is the Publish\Prerequisites... from your .sln:

pastedImage_0.png

The System.BadImageFormatException complaint on the 'nonworking' PC is showing:

Win32 Version: 2.0.50727.8806 (QFE.050727-8800)

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll

Maybe this will help.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Thank you Len,

this is very encouraging.

I'm out doing EMC testing, but next week I'll try out.

I will let you know how it goes!

Thank you!

Francesco

0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi Len,

sorry for the delay in my answer... I had to do some EMC testing for a product I designed...

I tried and still not working.

I'm not sure what else I can try, we tried literally everything we can. I have forced .NET 4.7.2 ... and I could see .NET to be installed in the machine that had the issue.. .and still not working! 😞

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

You probably already tried this:  Disable the Virus checking program.

Is Visual Studio loaded on the target machine with the issue? 

Idea:

  • Load Visual Studio on the target machine. 
  • Run the BootloaderHost solution in Debug mode.
  • Breakpoint the code just before the dll call. 
  • set up ProcessMonitor with your BootloaderHost as an Include filter.  ProcessMonitor capture OFF
  • Start the ProcessMonitor capture.
  • Run the solution to the point where the Exception error occurs.
  • Turn off the ProcessMonitor capture.

At this point the ProcessMonitor captured data should be minimized.  Hopefully something will stand out.

Len.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi Len,

I have open a case with Cypress

I will post here what we'll found out for the benefit of others.

Kind regards,

Francesco

0 Likes
PSa_795526
Level 4
First like given 10 replies posted 5 solutions authored
Level 4

Hi Francesco,

I got the same error(unable to load DLL 'BootLoader_Utils.dll') when directly using the bootloader host provided with the AN (AN73503 - PSoC USB HID Bootloader).

OS is Windows 10 Pro 64-bit OS, with PSoC Creator 4.3 installed.

But there are multiple zip files in the AN website - "USBBootloaderHost_VC2015.zip" and then "USB Bootloader Host.zip"

The "USBBootloaderHost_VC2015.zip" folder contains a Bootloader_Utils.dll that is of 54 KB size

The "USB Bootloader Host.zip" contains a Bootloader_Utils.dll that is of 89 KB size.

When using the host from "USBBootloaderHost_VC2015.zip" folder the dll error occurs.

When using the host from "USB Bootloader Host.zip" folder, there is no error and the bootload operation is successful.

Also replacing the 54 KB dll file with the 89 KB dll file makes even the host in "USBBootloaderHost_VC2015.zip" run the bootload operation successfully.

I noticed the bootloader host you had attached (LIDCO) in an earlier post seems to contain the 54 KB Bootloader_Utils.dll file.

Could you please try replacing it with the 89 KB dll file from the "USB Bootloader Host.zip" found in the AN73503 website( https://www.cypress.com/documentation/application-notes/an73503-psoc-usb-hid-bootloader ) and check if the bootload operation is successful with your host in the failing machines ?

Also attaching the 89 KB Bootloader_Utils.dll file here.

Best Regards,

Prem Sai

0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Thank you Prem,

I have tried this and using the dll attached I have the bootloader not working anymore on my machine. I tried to install on a machine that display the issue and doesn't work either. I'm going to install VS Community on the target machine and try again using the newest dll.

I'll keep everyone posted...

Thank you both Prem and Len!

Kind regards,

Francesc

0 Likes
WaMa_286156
Level 5
100 replies posted 50 replies posted 50 questions asked
Level 5

Since nothing else has worked, how about something from left field?  This *may not* work, but I think is worth a try.  (you have tried other things)

If you updated your PSOC programmer to the latest, something in the DLL's provide by Cypress will sometimes *prevent* a PSOC 5 from being recognized by Windows when in bootloader mode.  I had a VM which no longer saw a PSOC in bootloader mode, no matter the plugs/unplugs.

I solved the problem on my machine by uninstalling the latest programmer and installing the previous version which was working.

If you do that, then rebuild your application from scratch, then see if it will work on the one machine you have which you duplicated the problem on.

I know, probably won't fix it.  Is a shot in the dark.

0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hello everyone,

I have set the .NET framework to 3.5 and I have changed the dll as suggested by Prem.

I have also installed visual studio on a machine that was displaying the issue. and that seems to have fixed the issue.

I have asked my customer to install the app and if works means we solved the issue!

thank you for your help guys really appriciated!

Francesco

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

Thanks for the feedback.  It sounds encouraging.  I hope your customer has similar success.

Sadly we don't know which of the three changes you made fixed the problem on your end.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
FrPo_1282226
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

Hi guys,

I can confirm, positive feedback from my customer it worked.

so... the key was to use .NET 3.5 and the "second" dll

Thank you,

Francesco

Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Francesco,

I take it your customer DID NOT install visual studio.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes