DOTA: able to install some files but not others


#1

Hey,

Has anyone had any problems with the size of files being downloaded over the air? I’m running a Fastrack Supreme with firmware revision R74. Using a modified version of the demo DOTA software I can successfully download and install a 50k file, but not a 90k file. The A&Dsize is 2048.

Does anyone have advice on how to solve this problem?

Thanks,
David


#2

i don’t know how to sole this, but i do not hate the problems you describe.
i’m using the same DOTA example (rewritten to use http),
firmware 7.4a
Q2686
default A&D size (never changed it from factory default, so i don’t know the exact size)

and my files are 100k+


#3

Suggests a problem with your “modifications”, doesnt it?

Can you use the sample unmodified?


#4

Problems with my “modifications”… :slight_smile: Yes, I’ve looked into that. Using the unmodified sample code gives me the same errors however. Using the unmodified DOTA code, I have successfully installed small programs, such as the Hello World demo code - about 50k - supplied with the Fastrack Supreme. Files of around 85k and bigger apparently download correctly (at least the file sizes match and the download process runs to completion), but do not install, giving an ADL_INIT_DOWNLOAD_ERROR on reboot. The code modification I made were to compensate for problems with the DOTA process that people observed in previous forum posts, and they form the base for libraries for a larger program.


#5

You still have the problem?

If so, could you send me the response code of AT+WOPEN=6. Is it a G memory of Fastract Supreme?

Thank you.


#6

I have DOTA source code that works on firmware 7.3 and 7.4, the code was adapted from one of the Sample Apps into one source file. I’ll try and upload…but the website seems to be holding me back…


#7

Trying to add code…I can’t seem to write the word “W H I L E” in the code so correct the “wile” please. Lots of TRACES and comments are gone because the website doesn’t want to allow “F T P” and a lot of other stuff…

Please type your F T P details in the Constant declarations and use at=dwl to start DOTA

#include "adl_global.h"
#include "math.h"
#include "wip.h"

const u16 wm_apmCustomStackSize = 4096*3;

//#define
#define GPRS_APN      "internet"
#define GPRS_LOGIN    ""
#define GPRS_PASSWORD ""

const ascii * FTP_TYPE = (ascii*)'I';
const ascii * FTP_STR_HOSTNAME   = "YourFtp";
const ascii * FTP_STR_USERNAME   = "Username";
const ascii * FTP_STR_PASSWORD   = "Password";
const ascii * FTP_FILENAME = "./DOTA.dwl";
#define FTP_PORT	21
#define FTP_MODE_PASSIVE	0

wip_channel_t  FtpChannel    = (wip_channel_t) NULL;
wip_channel_t  FtpFileHandle = (wip_channel_t) NULL;

wip_bearer_t bearerHandle = NULL;
wip_channel_t ftpCnxCh = NULL;
wip_channel_t ftpDataCh = NULL;

//---AnD Variables---//
const u32	CellId = 1;
const u32   AnDSize = ADL_AD_SIZE_UNDEF;
s32        AnDHandle1       = -1;
s32        AnDCellHandle1   = -1;
s32        AnDCellHandle0   = -1;



//---Timer handles---//
adl_tmr_t *BearerTmrHandle;
adl_tmr_t *FtpTmrHandle;

//---Flags---//
bool flag_GpsValid;
bool flag_network;
bool flag_bearer;
bool flag_ftp;
bool flag_server;
bool flag_dwl;
bool flag_upload;
bool flag_LoopTimer;
bool flag_LogonOk;
bool flag_Wtfin;
bool flag_GpsSlow;
bool flag_Startup;

//---Variables---//
s32 s32Ret;
s8 s8Ret;

void Cmd_Dwl_Handler(adl_atCmdPreParser_t *paras);
void DwlNewApp(void);
void AnDEventHandler( adl_adEvent_e Event, u32 Progress );
void BearerConnectTmr(u8 Id, void * Context);
void BearerHandler( wip_bearer_t b, s8 event, void *ctx);
void FtpConnectTmr(u8 Id, void * Context);
void FTPCnxHandler(wip_event_t *ev, void *ctx );
void FTPFileDataHandler( wip_event_t *ev, void *ctx);
void FtpReadFile(void);
void AnDWrite(u32 BufLength, u8 *Buffer);
void DOTA_AnDInit();

void Cmd_Dwl_Handler(adl_atCmdPreParser_t *paras)
{
	TRACE((1,"Download Command Handler"));
	DwlNewApp();
	adl_atSendResponse(ADL_AT_PORT_TYPE ( paras->Port, ADL_AT_RSP ), "\r\nOK\r\n");
}

void DwlNewApp(void)
{
	TRACE((1,"Download New Application Function"));
	flag_dwl = TRUE;
	if(flag_bearer == FALSE)
	{
		BearerTmrHandle = adl_tmrSubscribe(ADL_TMR_CYCLIC_OPT_ON_RECEIVE, 100, ADL_TMR_TYPE_100MS, BearerConnectTmr);
	}
	else if(flag_bearer == TRUE)
		FtpTmrHandle = adl_tmrSubscribe(ADL_TMR_CYCLIC_OPT_NONE, 1, ADL_TMR_TYPE_100MS, FtpConnectTmr);
}

void AnDEventHandler( adl_adEvent_e Event, u32 Progress )
{
  TRACE((1, "AnDEventHandler: Event %d, Progress %d", Event, Progress));
}

void Disconnect(void)
{
	TRACE((1,"Disconnect function"));
	flag_bearer = FALSE;
	if(bearerHandle != NULL)
	{
		//wip_bearerStop(bearerHandle);
		wip_bearerClose(bearerHandle);
		bearerHandle = NULL;
	}
}

void BearerConnectTmr(u8 Id, void * Context)
{
	flag_bearer = FALSE;
	s8Ret = wip_bearerOpen ( &bearerHandle, "GPRS", ( wip_bearerHandler_f )
							BearerHandler, NULL);
	TRACE (( 1, "wip_bearerOpen: ret = %d",s8Ret ));
	s8Ret = wip_bearerSetOpts( bearerHandle,
							WIP_BOPT_GPRS_APN, GPRS_APN,
							WIP_BOPT_LOGIN,    GPRS_LOGIN,
							WIP_BOPT_PASSWORD, GPRS_PASSWORD,
	                       	WIP_BOPT_END);
	TRACE (( 1, "wip_bearerSetOpts: ret = %d",s8Ret ));
	s8Ret = wip_bearerStart( bearerHandle );
	TRACE (( 1, "wip_bearerStart: ret = %d",s8Ret ));
}

void BearerHandler( wip_bearer_t b, s8 event, void *ctx)
{
	switch(event)
	{
		case WIP_BEV_IP_CONNECTED:
			TRACE (( 1, "evh_bearer: <WIP_BEV_IP_CONNECTED>"));
			flag_bearer = TRUE;
			s32Ret = adl_tmrUnSubscribe(BearerTmrHandle, BearerConnectTmr, ADL_TMR_TYPE_100MS );
			TRACE((1,"Bearer Timer unsubscribe: %d", s32Ret));
			if(flag_dwl == TRUE)
				FtpTmrHandle = adl_tmrSubscribe(ADL_TMR_CYCLIC_OPT_NONE, 1, ADL_TMR_TYPE_100MS, FtpConnectTmr);
		break;
		case WIP_BEV_CONN_FAILED:
			TRACE (( 1, "evh_bearer: <WIP_BEV_CONN_FAILED>"));
			flag_dwl = FALSE;
			Disconnect();
		break;
		case WIP_BEV_STOPPED:
			TRACE (( 1, "evh_bearer: <WIP_BEV_STOPPED>"));
			flag_dwl = FALSE;
			Disconnect();
		break;
		default:
			TRACE (( 1, "evh_bearer: <Other Events>"));
			flag_dwl = FALSE;
			Disconnect();
		break;
    }
}

void FtpConnectTmr(u8 Id, void * Context)
{
	if(flag_ftp == TRUE)
	{
		s32Ret = wip_close(ftpCnxCh);
		FtpTmrHandle = adl_tmrSubscribe(ADL_TMR_CYCLIC_OPT_NONE, 100, ADL_TMR_TYPE_100MS, FtpConnectTmr);
		flag_ftp = FALSE;
		return;
	}
	else
		(flag_ftp = TRUE);

	ftpCnxCh = wip_FTPCreateOpts((ascii*)FTP_STR_HOSTNAME, FTPCnxHandler, NULL,
	   	   		  WIP_COPT_USER, FTP_STR_USERNAME,
      	   		  WIP_COPT_PASSWORD, FTP_STR_PASSWORD,
      	  		  WIP_COPT_PEER_PORT, FTP_PORT,
      	   		  WIP_COPT_TYPE, FTP_TYPE,
      	   		  WIP_COPT_PASSIVE, FTP_MODE_PASSIVE,
      	   		  WIP_COPT_END);
       FtpTmrHandle = adl_tmrSubscribe(ADL_TMR_CYCLIC_OPT_NONE, 100, ADL_TMR_TYPE_100MS, FtpConnectTmr);
}

void FTPCnxHandler(wip_event_t *ev, void *ctx )
{
  switch( ev->kind)
  {
    case WIP_CEV_OPEN:
    	s32Ret = adl_tmrUnSubscribe(FtpTmrHandle, FtpConnectTmr, ADL_TMR_TYPE_100MS );
 
    	AnDCellHandle1 = adl_adSubscribe ( CellId, AnDSize);
    	TRACE((2,"AnD Subscribe: %d",AnDCellHandle1));
    	FtpFileHandle = wip_getFile ( ftpCnxCh,(ascii*) FTP_FILENAME, FTPFileDataHandler, NULL );

    break;
    case WIP_CEV_PEER_CLOSE:
    	    break;
    case WIP_CEV_ERROR:
    	TRACE((1,"ftpCnxHandler: WIP_CEV_ERROR"));
    break;
    case WIP_CEV_DONE:
    	TRACE((1,"ftpCnxHandler: WIP_CEV_DONE"));
    break;
    case WIP_CEV_PING:
        TRACE((1,"ftpCnxHandler: WIP_CEV_PING"));
    break;
    case WIP_CEV_READ:
        TRACE((1,"ftpCnxHandler: WIP_CEV_READ"));
    break;
    case WIP_CEV_WRITE:
        TRACE((1,"ftpCnxHandler: WIP_CEV_WRITE"));
    break;

  }
}

void FTPFileDataHandler( wip_event_t *ev, void *ctx)
{
  TRACE (( 1, "DOTA_FTPFileDataHandler Event = %d", ev->kind));

  switch( ev->kind)
  {
    case WIP_CEV_OPEN:
      break;

    case WIP_CEV_READ:
      FtpReadFile();
    break;

    case WIP_CEV_WRITE:
      break;

    case WIP_CEV_DONE:
      break;

    case WIP_CEV_ERROR:
      break;

    case WIP_CEV_PEER_CLOSE:
      wip_close(ftpDataCh);
      wip_close(ftpCnxCh);

      s32Ret = adl_adFinalise (AnDCellHandle1);
      TRACE((2, "adl_adFinalise  %d", s32Ret));

      s32Ret = adl_adInstall(AnDCellHandle1);
      TRACE((2, "adl_adInstall %d", s32Ret));
    break;
    default:
    break;
  }
}

void FtpReadFile(void)
{
  s32 sLen;
  u8 uBuffer[1500];
  wile( (sLen = wip_read( FtpFileHandle, uBuffer, sizeof(uBuffer))) > 0)
  {
    if (AnDCellHandle1 < 0)
    {
    	adl_atSendResponse (ADL_AT_RSP, "\r\nDOTA_AnDWriteData Error\r\n");
    	break;
    }
    else
    {
    	AnDWrite(sLen, uBuffer);
    }
  }
}

void AnDWrite(u32 BufLength, u8 *Buffer)
{
	s32Ret = adl_adWrite(AnDCellHandle1, BufLength, Buffer);
	TRACE((2,"AnD write: %d",s32Ret));
}

void DOTA_AnDInit()
{

  AnDHandle1 = adl_adEventSubscribe ( (adl_adEventHdlr_f) AnDEventHandler );
  adl_adFormat(AnDHandle1);
}

void adl_main(adl_InitType_e adlInitType)
{
	s8 InitValue = 0;
	TRACE((1,"Main function"));
	adl_atSendResponse(ADL_AT_UNS, "\r\nStart DOTA Program (Success)\r\n" );
	switch (adlInitType)
	{
	  case ADL_INIT_POWER_ON:
		  InitValue = 1;
	  break;
	  case ADL_INIT_REBOOT_FROM_EXCEPTION:
		  InitValue = 2;
	  break;
	  case ADL_INIT_DOWNLOAD_SUCCESS:
		  InitValue = 3;
	  break;
	  case ADL_INIT_DOWNLOAD_ERROR:
		  InitValue = 4;
	  break;
	  case ADL_INIT_RTC:
		  InitValue = 5;
	  break;
	  default:
	  break;
	}
	DOTA_AnDInit();
	adl_atCmdSubscribe ( "AT+DWL",
				         Cmd_Dwl_Handler,
				         ADL_CMD_TYPE_ACT);

	wip_netInit();
}

#8

Forum problems - and workaround - descirbed here: https://forum.sierrawireless.com/t/forum-broken/4278/1


#9

Is it possible to examine the contents of A&D memory. I can’t seem to send it out over the serial port fast enough when it arrives over File Transfer Protocol however. Does anyone know the memory address of the A & D cell that the file is stored in?

zafer:
The command:
at+wopen=6
gives the response:
+WOPEN: 6,2048,3072

The command:
ati3
gives the response:
R74_00gg.FSU005 2120060 041709 19:18
which indicates G memory I believe.

charlvz:
Thank you, I’ll try it.


#10

Look in the ADL User Guide - there is a function that gives a pointer to it…


#11

Hi there,

I had a similar problem. I was using G memory Fastract Supreme with the firmware R71.b. I just format the AD space by AT+WOPEN=6,X command where X grater than my application size. Then my problem was solved.

So can you execute AT+WOPEN=6,2000 command on your module just to format your AD space. Then try DOTA again.

Thanks.


#12

At last it works. After checking the contents of the A&D space to confirm that the files downloaded correctly and trying several different versions of DOTA, I found the clue in charlvz’s code (thanks charlvz). I was following the advice of the demo code documentation and trying to load the .wpb.dwl file, not the .dwl file. Strangely I can successfully download a .wpb.dwl file of 87600 bytes but not one of 90565 bytes. Loading the .dwl file works - as the ADL documentation suggests. :laughing:

Thank you all very much for your input and help.