cancel
Showing results for 
Search instead for 
Did you mean: 

DfuSe Demonstration crashes

willie2
Associate II
Posted on January 06, 2010 at 12:52

DfuSe Demonstration crashes

10 REPLIES 10
willie2
Associate II
Posted on May 17, 2011 at 12:41

When I try to run the ''DfuSe Demonstration'' application on my PC

I get a violation and the application exits.

I tried rebuilding the application from the source to find out

where the error occurs, but after finding out that it is while

enumerating the HID devices I cannot eliminate the error.

Has anyone else had the same experience with this application?

I am running on an Acer tablet PC (which has about 11 different HID

devices loaded).

peterwrigley9
Associate II
Posted on May 17, 2011 at 12:41

Hi willie,

We had a customer experience an issue with DFU as ST's code hard-coded the STR7 to USB endpoint 0 (zero). This caused problems with one particular brand of USB hub. It sounds as if you could be suffering from a similar problem.

Can you disable some of the USB devices on the laptop? It is possible one of them may have a similar problem.

Cheers

Peter

willie2
Associate II
Posted on May 17, 2011 at 12:41

Hi Peter et al,

I put in the effort and got the demonstration working.

There were errors in both Enumeration.cpp and in the

FindMyHIDDevice() routine in DfuSeDemoDlg.cpp

In Enumeration.cpp whenever there is a loop

for (i = 0; i < numValues; i++, valueCaps++) {

it should be changed to use the number of ''Caps'' as the terminator

and not the number of values.

e.g. HidDevice->Caps.NumberOutputValueCaps

In FindMyHIDDevice() each device should be tested to check that the

device was actually opened:

add the test after line 218 in DfuSeDemoDlg.cpp

pWalk = pHid; // Initialize pWalk

if (INVALID_HANDLE_VALUE == pWalk->HidDevice) { // add this

continue; //

} //

I hope that helps someone else.

Willie

alexsuchko
Associate
Posted on May 17, 2011 at 12:41

willie1: Your post was very helpful, the binary of DfuSe wouldn't run when I downloaded it, but I made the corrections and it runs now. I'm kind of surprised ST hasn't updated the DfuSe download available to include your fixes.

Unfortunately, I have some sort of problem on the target side, which I can't understand since I'm using an off-the-shelf development board that I've used the USB hardware on before. I've tested that the onboard bootloader works over USART but in my application USB would be much better.

...if anyone's experienced this before and has an idea, please let me know.

Thanks,

Alex

mariemzidi
Associate II
Posted on May 17, 2011 at 12:41

Hi Willie,

I'm working on a project in which I need to program an LCD via STM32F103ZE. I started with an appliction note from STm but I need to install the ''DfuSeDemo'' in my PC to program the Demo and I searched for the .exe and didn't found it.

Any ideas PLEASE..

Best Regards,

Mariem 

christianweiss9
Associate II
Posted on July 29, 2011 at 13:24

Hi Mariem,

> [...] I need to install the ''DfuSeDemo'' in my PC to program the Demo and I searched > for the .exe and didn't found it.

the download link for the DfuSeDemo is http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/SW_DEMO/um0412.zip

You have to unzip it and execute the Setup, then you can start it from the start panel.

But I have a problem with this program and hope anyone can help me (I also wrote to the support, but perhaps I get help here):

I have to customize the DfuSeDemo.exe that a user is able to upgrade the firmware with one click, but if I execute it as release it crashes immediatly (mostly after changing from HID to DFU mode or vice versa). The debug version works correct, but not the release, so I'm not able to debug it (sometimes there is a CtrUnvalidHeapPointer() error). I started with the version 3.0.1 which includes the changes given a few posts over mine. There the version started from the start panel works, but the version 3.0.2 (not modified by me) also crashes if a device is plugged. I use Windows 7 x64 and Visual Studio 2005. I also installed Visual Studio 2005 on a Windows XP x86 (32 bit) and there the original program and also my customized one worked until a update of Visual Studio 2005 (now it also crashes). Now only the debug versions works but not the releases.

Does anyone know, if I have to use a special version of Visual Studio to get it working as release?

I know that I need the license for my vendor ID and product ID, but I think this is only important if I want to see my IDs in the program instead of STm's IDs.

Thanks for helping me

Christian

Nickname12657_O
Associate III
Posted on July 29, 2011 at 21:54

Hi Christian,

I believe that this crash comes from the hid.lib pre-compiled library from Microsoft and the way it is called with x86 and x64 OSs.   Could you comment

Line 344 , File : DfuSeDemoDlg.cpp

// Begin with HID devices // Commented in Version V3.0.3 and to be Kept for customer usage if wanted with HID classes

/*ReleaseHIDMemory();

m_Enum.FindHidDevice(&m_HidDevices,&m_HidDevice_Counter);

FindMyHIDDevice();

for(i=0;i<int(m_HidDevice_Counter);i++)

{

PHID_DEVICE pWalk;

pWalk = m_HidDevices + m_Tab_Index[i];

if(HidD_GetProductString(pWalk->HidDevice, Product, sizeof(Product)))

{

for(j=0;j<160;j+=2)

Prod += Product[j];

}

else

Prod=''(Unknown HID Device)'';

String.Format(''%s'',Prod);

m_CtrlDFUDevices.AddString(String);

m_CtrlDevices.AddString(String);

Prod = '''';

}*/

This will disable your HID devices enumuration like mouses,keyboards etc...  Then re-compile again and let me know if the problem still there.

Cheers,

STOne-32.

christianweiss9
Associate II
Posted on August 01, 2011 at 10:18

Hello STOne-32,

when I commented the given lines, it don't crashes, but our product is a keyboard-mouse-device which should be upgraded by the end-user, so this is no solution. I also tried it on a 32bit-system (Win XP) with the same result, so I think it is not a problem with the 64 bit OS.

Thanks

Christian

apayer
Associate
Posted on November 29, 2011 at 14:55

It crashes when pick kit 2 is connected.I could run it disconnecting pick kit 2 before I use the application.