Question
Accessing ST Dfuse DLL with C#
Posted on April 12, 2012 at 10:26
To integrate firmware update functionality into a custom c♯ application I start to use ST Dfuse dll from c♯. I managed to enumerate and identify the device (UM0392 - 3.1 and 3.2) but now get stucked while trying to erase the device. Out of the manual:
DWORD OperationCode; PDWORD pNbAlternates; PMAPPING pMapping; PHANDLE pHandle; // Programming the operation contex lstrcpy(Context.szDevLink, DFUName); Context.DfuGUID=GUID_DFU; Context.AppGUID=GUID_APP; Context.Operation=OPERATION_ERASE; Context.bDontSendFFTransfersForUpgrade= TRUE; STDFUPRT_CreateMappingFromDevice((LPSTR)(LPCSTR)DFUName,&pMapping, &NbAlternates); STDFUFILES_CreateImageFromMapping(pHandle, pMapping); STDFUFILES_FilterImageForOperation(hImage, m_pMapping+TargetSel, OPERATION_ERASE, FALSE); Context.hImage=hImage; if( STDFUPRT_LaunchOperation(&Context, &OperationCode) != STDFUPRT_NOERROR) { Printf(�Erase error�); } The call of STDFUPRT_LaunchOperation() does always return a STDFUPRT_BADPARAMETER error. Is there a way to get some more information about this error? Which parameter is bad? The first parameter in LaunchOperation() is a pointer to the struct DFUThreadContext. I rebuilt this struct in c♯ using the information given in UM0384.pdf chapter 4.3.4. My UM0384 is revision 1 - June 2007 - wonder if that user manual is still up-to-date?!? I did not find UM0384 on the webpage (my copy is out of the package UM0412.zip). Does anyone have a newer one? Thanks in advance for any help #st-dfu #st-dfuse #dfuse