P&S! with 4G failing OTA

Using OTA functions with Waspmote
GTsapparellas
Posts: 11
Joined: Mon Oct 21, 2019 1:30 pm
Company: LJMU

P&S! with 4G failing OTA

Post by GTsapparellas » Fri Dec 06, 2019 6:26 pm

Hi,

I'm in the process of setting up the OTA feature for a P&S! 4G node. However, when I upload the example code you provide for the OTA I'm getting an FTP error. Any ideas why?

1. 4G module ready...
==> Request OTA...
[LE910] Checking connection
[LE910] CREG: 0,1
[LE910] CGREG: 0,1
[LE910] GPRS context activation:1
[LE910] IP address:10.xxx.xxx.xx
[LE910] Opening FTP session
[LE910] ==> ERROR CODE: FTP not connected
[LE910] ==> ERROR CODE: FTP not connected
[LE910] Open FTP session ERROR
OTA request failed. Error code: error opening FTP session
5. Switch OFF 4G module
6.1. Enter deep sleep...
6.1. Wake up!!

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

Re: P&S! with 4G failing OTA

Post by libelium-dev » Tue Dec 10, 2019 11:46 am

Hi,

Did you set your own FTP server settings? Our server settings are just an example and they don't work.

Regards

GTsapparellas
Posts: 11
Joined: Mon Oct 21, 2019 1:30 pm
Company: LJMU

Re: P&S! with 4G failing OTA

Post by GTsapparellas » Tue Dec 10, 2019 12:02 pm

Hi,

Yes I did - now it works over an FTP server. But, initially I was trying with an SFTP server instead. It seems that LE910 does not support that. Is that right?

Kind Regards,

Giorgos

GTsapparellas
Posts: 11
Joined: Mon Oct 21, 2019 1:30 pm
Company: LJMU

Re: P&S! with 4G failing OTA

Post by GTsapparellas » Tue Dec 10, 2019 3:47 pm

Hi,

Also on FTP side I'm getting this error:

==> Request OTA...
[LE910] delete file
[LE910] Checking connection
[LE910] Connection active, nothing more to check
[LE910] Opening FTP session
[LE910] Downloading OTA config file...
[LE910] _buffer:
#FTPFSIZE: 52

OK
[LE910] File size in FTP: 52
[LE910] Set delay_ms = 0
[LE910] Packet size: 52
[LE910] Remaining server_filesize: 0
[LE910] DOWNLOAD OK
[LE910] sd_filesize:52
[LE910] server_filesize:52
[LE910] LE910_OTA_FILE download OK
[LE910] FILE:SKETCH_
[LE910] PATH:/files/test
[LE910] SIZE:16370
[LE910] VERSION:11
[LE910] Closing FTP session
[LE910] Close FTP session OK
[LE910] Checking connection
[LE910] Connection active, nothing more to check
[LE910] Opening FTP session
[LE910] Open FTP session OK
[LE910] Downloading OTA FILE
[LE910] _buffer:
#FTPFSIZE: Could not get file size.

OK

[LE910] Server file size is zero
[LE910] Closing FTP session
[LE910] Error getting binary
OTA request failed. Error code: error downloading binary file: server file size is zero

////////////////////////

UPGRADE.TXT file is created correctly with (LF) character at the end of each line.

Any ideas why?

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

Re: P&S! with 4G failing OTA

Post by libelium-dev » Wed Dec 11, 2019 12:22 pm

Hi,

Could you please send us the bin file and UPGRADE.TXT file to check if they are correct?

In addition, please try to perform OTAA using the following files. Does it work?
https://www.libelium.com/forum/libelium_files/OTA_2.zip

Regards

GTsapparellas
Posts: 11
Joined: Mon Oct 21, 2019 1:30 pm
Company: LJMU

Re: P&S! with 4G failing OTA

Post by GTsapparellas » Thu Dec 12, 2019 12:45 pm

Hi,

You can find the files using this link https://drive.google.com/drive/folders/ ... sp=sharing

After performing few tests (using the files you have provided as well), I found out that the problem is that procedure is not following the right PATH which is initialized in the UPGRADE.TXT file. If both, UPGRADE.TXT and the binary files are placed in the root directory of the FTP server is working fine. However, if the binary file is placed in the /files directory lets say is not captured by the UPGRADE.TXT file. Notice that, PATH line is written following your instructions (see docs of link above). Any ideas why?

Also can you please confirm if the LE910 supports SFTP (see previous post)?

Kind Regards,

Giorgos

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

Re: P&S! with 4G failing OTA

Post by libelium-dev » Mon Dec 16, 2019 10:18 am

Hi,

Apologies for our delay answering we are overwhelmed these days. Do you confirm that the OTA is working when the files are in the root directory? If so we are going to perform tests to know why it's not working when the bin file is placed in another path.

Is your FTP active or passive? Passive mode is set by default in the library.

We have just checked the 4G module datasheet and it doesn't support SFTP.

Regards

GTsapparellas
Posts: 11
Joined: Mon Oct 21, 2019 1:30 pm
Company: LJMU

Re: P&S! with 4G failing OTA

Post by GTsapparellas » Mon Dec 16, 2019 1:29 pm

Hi,

No worries.

Indeed, I can confirm that the OTA is working when both files are in the root directory. However, when the bin file is placed in another path, redirection of UPGRADE.TXT file is not working. I have changed the FTP_PASSIVE macro to FTP_ACTIVE in the library but with no luck.

Any other ideas on how we can resolve this issue?

Kind Regards,

Giorgos

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

Re: P&S! with 4G failing OTA

Post by libelium-dev » Mon Dec 16, 2019 2:33 pm

Hi,

There is a bug in the requestOTA function. Please try to replace the last part of the function with this one, which sets the working directory acording to path configured.

Code: Select all

////////////////////////////////////////////////////////////////////////////
	// 5. Download binary file
	////////////////////////////////////////////////////////////////////////////

	#if DEBUG_WASP4G > 1
		PRINT_LE910(F("Downloading OTA FILE\n"));
	#endif

	// change working directory if needed
	error = ftpChangeWorkingDirectory(path);

	if (error = 0)
	{
		#if DEBUG_WASP4G > 0
			PRINT_LE910(F("Working  directory changed to "));
			PRINT_LE910(path);
		#endif
	}
	else
	{
		#if DEBUG_WASP4G > 0
			PRINT_LE910(F("Error changing working  directory: "));
			PRINT_LE910(error);
		#endif

	}

	// get binary file
	error = ftpDownload((char*)aux_name, aux_name);

	if (error == 0)
	{
		// check if size matches
		SD.ON();

		// get file size
		int32_t sd_file_size = SD.getFileSize(aux_name);
		if (sd_file_size != aux_size)
		{
			SD.OFF();
			ftpCloseSession();
			#if DEBUG_WASP4G > 0
				PRINT_LE910(F("Size does not match\n"));
				PRINT_LE910(F("sd_file_size:"));
				USB.println(sd_file_size);
				PRINT_LE910(F("UPGRADE.TXT size field:"));
				USB.println(aux_size);
			#endif
			return 11;
		}
		#if DEBUG_WASP4G > 1
			SD.ls();
		#endif
		ftpCloseSession();

		// call OTA function
		Utils.loadOTA(aux_name,aux_version);
		return 0;
	}
	else
	{
		error_flag = error;
		SD.OFF();
		ftpCloseSession();
		#if DEBUG_WASP4G > 0
			PRINT_LE910(F("Error getting binary\n"));
		#endif
		return error_flag + 11; // error codes: 12 to 24
	}
Let us know if the problem is solved.
Regards

GTsapparellas
Posts: 11
Joined: Mon Oct 21, 2019 1:30 pm
Company: LJMU

Re: P&S! with 4G failing OTA

Post by GTsapparellas » Tue Dec 17, 2019 4:57 pm

Hi,

I can now confirm that the issue has been resolved. Working directory is set according to the path configured.

Seizing the opportunity, how would it be possible to update multiple P&S nodes OTA with different firmware? Can a single UPGRADE.TXT file support that? Or does it have to be changed every time? I am asking that as imagine you have 2 different P&S nodes which at some point call the requestOTA function. You also have 2 different bin files (one for each P&S node). However, if only one bin file can be supported by the UPGRADE.TXT file at a time it means that if you get the timings wrong you might end up updating the wrong firmware on a node.

Two possible solutions I can think of are:

1) Have a different UPGRADE.TXT files for each node (e.g. one named UPGRADE_1.TXT and the other UPGRADE_2.TXT).
2) Support more than one updates in a single UPGRADE.TXT file.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest