Automating DWLWin


I am trying to Automate DWLWin by following the user manual. Has anybody had any success in this area? I have been working on it for a while without much luck. I can connect to my device but just long enough for it to disconnect again and fail with a code 154 error.

My code is below.

int main(int argc, char **argv)
dwlwin::IDwlwinPtr pDWLWin;

if (pDWLWin.CreateInstance("dwlwin.application") != NOERROR)
	printf("Cannot launch DWLWin server\n");
	return -1;

_bstr_t bsVersion = pDWLWin->getVersion(); 
printf("DWLWin Version = %s\n", (LPCTSTR)bsVersion); 

// setup the download options

	11,				        // target is COM11 
	460800,				// 460800 bps 
	"C:\\firmware\\",	        // working directory 
	"tiwipro.r74.18001.wpb|R74_00-cus-wmp-05.wpk|",	// download package file name (plus a pipe) 
	"",					// no eeprom files 
	"",					// no customization files 
	0,					// do not erase objects 
	1,					// do not erase customization files 
	0,					// do not erase the Open AT application 
	0,					// do erase the whole flash memory 
	0,					// do not reset the firmware after download 
	0,					// installation address = don't care 
	7,					// autodetection 
	0,					// no security plugin 
	"");				// no path to security plugin 

// start the download on COM11 
// Wait (download initialization delay) 
printf("Starting up\n");	
// wait during the download 
bool bConnected = false;

while (! pDWLWin->isDownloadOver(11)) 
	if (! bConnected && pDWLWin->isBootOk(11)) 
		printf("DWLWin is connected\n");
		bConnected = true; 


// Display the exit message 
int nExitCode = pDWLWin->getErrorCode(11); 
_bstr_t bsMessage = pDWLWin->translateErrCode(nExitCode); 
printf("Exit message = %s (code %d)\n", (LPCTSTR)bsMessage, nExitCode);

return 0; 


Thanks in advance for your help,



Did your code work?

I’m also interested to automate the DWLwin operation and download firmware+ application.

Did you look at this topic?

I don’t know if the problem could be related to the sequence of the file in the setDownloadOptions function.
Try to revert “tiwipro.r74.18001.wpb|R74_00-cus-wmp-05.wpk|” in “R74_00-cus-wmp-05.wpk|tiwipro.r74.18001.wpb|”