Problem witho OTA GPRS

Using OTA functions with Waspmote
koki
Posts: 84
Joined: Sun Sep 18, 2016 11:02 am

Re: Problem witho OTA GPRS

Post by koki » Thu Jul 20, 2017 12:18 pm

I first formatted the SD card of my P&S SE Pro v12, and then ran the example OTA code with the instructed modification in WaspGPRS_Pro_core.cpp.
Here is an excerpt of the log message that has changed from the last time.
...
OTA file: UT_02_U
File path: /
Version: 11
[SD] Invalid filename
No OTA
RESTARTING
Program version: 10
New program version: 10
...
This is just a quick reply to your instruction. I'll also try to find what's wrong with the SD file name.

koki
Posts: 84
Joined: Sun Sep 18, 2016 11:02 am

Re: Problem witho OTA GPRS

Post by koki » Thu Jul 20, 2017 1:28 pm

I think the debugging code can be placed along with the Version checking part as follows:

Code: Select all

						// ...
						version = atoi(aux_ver);
						
						#if GPRS_debug_mode>0
							USB.print(F("Version: "));
							USB.println(version, DEC);
							
							USB.print(F("aux_name: "));
							USB.println(aux_name);
							USB.print(F("programID: "));
							USB.println(programID);
							USB.print(F("version: "));
							USB.println(version, DEC);
							USB.print(F("Utils.getProgramVersion(): "));
							USB.println(Utils.getProgramVersion(), DEC);
						#endif
					
						SD.del(aux_name);
						// ...
I ran with the above code and got the following output.
...
OTA file: UT_02_U
File path: /
Version: 11
aux_name:
programID: UìU}U
version: 11
Utils.getProgramVersion(): 10
[SD] Invalid filename
No OTA
RESTARTING
...
So, the value set in the variable aux_name is lost by unknown reason. :(

Other observations so far are:
  • The variable version is defined as int8_t. This is the reason of printing -1 when defined as "VERSION:255". I don't know if this leads to any unexpected results.
  • The message "[SD] Invalid filename" comes from the above SD.del(aux_name) command, and at this point this is not a fatal problem.
Regards

koki
Posts: 84
Joined: Sun Sep 18, 2016 11:02 am

Re: Problem witho OTA GPRS

Post by koki » Thu Jul 20, 2017 1:36 pm

Sorry for my serial postings. But I should have added "Utils.getProgramID(programID);" in the debugging code as follows.

Code: Select all

						// ...
						version = atoi(aux_ver);
						
						#if GPRS_debug_mode>0
							USB.print(F("Version: "));
							USB.println(version, DEC);
							
							Utils.getProgramID(programID);
							USB.print(F("aux_name: "));
							USB.println(aux_name);
							USB.print(F("programID: "));
							USB.println(programID);
							USB.print(F("version: "));
							USB.println(version, DEC);
							USB.print(F("Utils.getProgramVersion(): "));
							USB.println(Utils.getProgramVersion(), DEC);
						#endif
					
						SD.del(aux_name);
						// ...
And, I got a new result with the proper programID as follows. Still, aux_name is lost.
...
OTA file: UT_02_U
File path: /
Version: 11
aux_name:
programID: UT_02_U
version: 11
Utils.getProgramVersion(): 10
[SD] Invalid filename
No OTA
RESTARTING
...
Regards

koki
Posts: 84
Joined: Sun Sep 18, 2016 11:02 am

Re: Problem witho OTA GPRS

Post by koki » Thu Jul 20, 2017 2:54 pm

Then the next mystery is then why I see "No OTA" message.
So, I modified the debugging part as follows to check the value set in str_aux1.

Code: Select all

						// ...
						version = atoi(aux_ver);
						
						#if GPRS_debug_mode>0
							USB.print(F("Version: "));
							USB.println(version, DEC);
						#endif
					
						SD.del(aux_name);
		
						strcpy_P(str_aux1, (char*)pgm_read_word(&(table_OTA_GPRS[1])));	//NO_OTA

						#if GPRS_debug_mode>0
							USB.print(F("str_aux1: "));
							USB.println(str_aux1);
							USB.print(F("aux_name: "));
							USB.println(aux_name);
							Utils.getProgramID(programID);
							USB.print(F("programID: "));
							USB.println(programID);
							USB.print(F("version: "));
							USB.println(version, DEC);
							USB.print(F("Utils.getProgramVersion(): "));
							USB.println(Utils.getProgramVersion(), DEC);
						#endif

						if (strcmp(aux_name, str_aux1) != 0)
						{
							#if GPRS_debug_mode>0
								USB.println(F("Downloading OTA FILE"));
							#endif
							// ...
						}
						else
						{
							
							#if GPRS_debug_mode>0
								USB.println(F("No OTA"));
							#endif
							SD.OFF();
							return -69;
						}
						// ...
						
							
Having run the example OTA code with our FTP server, the debugging part reports as follows, i.e. no value is set neither in str_aux1 nor aux_name, which results in the condition strcmp(aux_name, str_aux1) to 0. The version number is wrong, too.
...
OTA file: UT_02_U
File path: /
Version: 11
[SD] Invalid filename
str_aux1:
aux_name:
programID: UT_02_U
version: 4541513
Utils.getProgramVersion(): 10
No OTA
RESTARTING
...
When I run the same example code with Libelium's FTP server, I get the following result.
...
OTA file: UT_02_U
File path: /
Version: 11
str_aux1: NO_FILE
aux_name: UT_02_U
programID: UT_02_U
version: 11
Utils.getProgramVersion(): 10
Downloading OTA FILE
...
(and OTA completes)
I wonder what I can do to solve this.

By the way, the expected str_aux1 value is not "NO_OTA" written int the source code but "NO_FILE" as is seen above.
Regards

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Problem witho OTA GPRS

Post by libelium-dev » Fri Jul 21, 2017 9:55 am

Hi,

Is your FTP server active or passive? The library sets passive mode by default, maybe this could be the cause.

Please try to perform OTA using these files in your ftp server
http://www.libelium.com/forum/libelium_ ... _files.zip

Regards

koki
Posts: 84
Joined: Sun Sep 18, 2016 11:02 am

Re: Problem witho OTA GPRS

Post by koki » Fri Jul 21, 2017 2:29 pm

Hi,
Our FTP server works both in passive and in active mode.
And the suggested OTA files worked with our FTP server. :!:

I finally found that there was a mistake in the UPGRADE.TXT file I had been using with our FTP server. I forgot to end the fourth line (it was VERSION line) with '\n' as was described in the document. After I corrected the UPGRADE.TXT file every requestOTA works so far as is expected.

Thanks for the help.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Problem witho OTA GPRS

Post by libelium-dev » Mon Jul 24, 2017 8:45 am

Hi koki,

Glad to hear finally OTA work! :D

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest