ESP32 remote firmware update options

Thread Starter

zazas321

Joined Nov 29, 2015
936
Just to get it out of the way, I have decided to test very simple GET request commands using my GSM module using AT commands. I have followed this guide:

And I was able to get the response without any issues:
1617876771361.png

Which confirms that my GSM module is capable of making HTTP request, now I just need to solve my server problem and that should be it!
 

Ya’akov

Joined Jan 27, 2019
9,170
It is an http request, not a file system,. Try just :
Code:
esp.bin
Also, check the logs for Apache to see what is happening.
 

Ya’akov

Joined Jan 27, 2019
9,170
Sorry, I couldn't read through everything thoroughly. I am helping you blind. I don't know what you are doing with Apache. I am using psychic powers to debug this.

Try this, point your web browser at <server>/esp.bin and see what you get. Also, the Apache logs are very important to debug this.
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
I am sorry for confusing so many things in one, I am trying to be as clear as possible, nonetheless, you are helping a lot!. I have tried typing this in a browser:

http://192.168.1.247/esp.bin

This request immediately caused a download of a binary file so I assume my apache server is working as expected!\


Ok, so now I have confirmed that:

1. My GSM module is able to make http requests ( post #21 )
2. My apache server is working as expected since I can initiate a binary file download when putting this in my browser: http://192.168.1.247/esp.bin

Which means that the only thing that can be wrong is the provided example code because I am still experiencing client timeout issue:




1617879016006.png



For some reason the forum wont allow me to post an answer when I include full arduino code, perhaps it is too long for the post?
 

Ya’akov

Joined Jan 27, 2019
9,170
I am sorry for confusing so many things in one, I am trying to be as clear as possible, nonetheless, you are helping a lot!. I have tried typing this in a browser:

http://192.168.1.247/esp.bin

This request immediately caused a download of a binary file so I assume my apache server is working as expected!\


Ok, so now I have confirmed that:

1. My GSM module is able to make http requests ( post #21 )
2. My apache server is working as expected since I can initiate a binary file download when putting this in my browser: http://192.168.1.247/esp.bin

Which means that the only thing that can be wrong is the provided example code because I am still experiencing client timeout issue:




View attachment 234833



For some reason the forum wont allow me to post an answer when I include full arduino code, perhaps it is too long for the post?
I am out photographing the sunrise but I’ll try to help when I get back inside. 3DE95E5D-2009-4435-99B7-3D476E80F4D8.jpeg
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
Hello. I have made slight progress. After all, it might be my apache server problem not allowing remote connections?

I have tried with different server url:
Code:
const char server[] = "iforce2d.net";
const int port = 80;
const char resource[] = "/test.php"; //here de bin file
It is some random link I have found online.

1617884558760.png

As you can see from my serial monitor, the get request seems to be working fine, the get request return a date . if you type this in your browser : http://www.iforce2d.net/test.php , thats what you are going to get.


To further test my apache webserver, In my htpcd I have created a very simple html page:

Code:
<!DOCTYPE html>
<html>
    <head>
        <title>Example</title>
    </head>
    <body>
        <p>This is an example of a simple HTML page with one paragraph.</p>
    </body>
</html>
Now, by typing in the browser , i can see that page:
1617884759982.png

However, I am still not able to make a request to this server from my ESP32 device, the apache logs does not say anything.


When I change the parameters to:

Code:
const char server[] = "192.168.1.247";
const int port = 80;
const char resource[] = "/html_test.html"; //here de bin file
It is timing out as I have previously shown:
1617885264585.png

But what concerns me the most, is that client.connect(192.168.1.247) is able to execute sucesfully because it returns OK.

How can it connect to the server but then fail a get request? If there is something wrong with my apache, I would expect client.connect(192.168.1.247) function to be unsucesful
 

djsfantasi

Joined Apr 11, 2010
9,163
Apache logs.
My Apache experience is getting old, but have you set the permissions on the htdocs folder for remote access?

If you enter the server name and path in your browser, can you see the file information?

The requested Apache logs will show if the permissions are incorrect.
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
My Apache experience is getting old, but have you set the permissions on the htdocs folder for remote access?

If you enter the server name and path in your browser, can you see the file information?

The requested Apache logs will show if the permissions are incorrect.
I have not changed any permissions, perhaps that is the issue.

When I type the IP address in the browser, I can see the file information.

As I mentioned, apache logs do not give any information after I run the program on the ESP32 device, no new logs appear on either of these
1617889807371.png


However, when I type 192.168.1.247 in my browser, I can see new log appear in access.log. So that would mean my ESP32 device not even trying to reach the server?
 
Last edited:

Ya’akov

Joined Jan 27, 2019
9,170
I really think you should be using a Linux server for this. I know you are "just testing" but all the tools to work with this are there with Linux and you will almost certainly be using it in production. I feel like you are wasting time with the uncertainty of trying to do this "quickly".

I know you don't have the experience, but a Linux server could be up and running in 15 minutes. Even if you just got a copy of Virtual Box running on your Windows machine and installed a pre-configured image of Debian (probably an hour's work or so) you would be in a much better place to make this work.
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
Okay I will try the suggestion with netcat tommorow if this does not bring any answers, I will have to try linux server. I have raspberry pi lying arround
 

djsfantasi

Joined Apr 11, 2010
9,163
Wait! You’re running Apache on a Windows box?

If so, are you starting it with Administrator privileges? Right-click on the shortcut to run Apache, look for a selection “Run as Administrator” on one of the tabs (I forget which one, but it should be obvious). Make sure it’s check box is selected. Restart the Apache server and re-test.
 

Ya’akov

Joined Jan 27, 2019
9,170
Okay I will try the suggestion with netcat tommorow if this does not bring any answers, I will have to try linux server. I have raspberry pi lying arround
The RPi would be great! Install the very latest Rasbpian distro. You might want to skip Apache and just install Nginx which will be better for your actual deployment.
 

Ya’akov

Joined Jan 27, 2019
9,170
Wait! You’re running Apache on a Windows box?

If so, are you starting it with Administrator privileges? Right-click on the shortcut to run Apache, look for a selection “Run as Administrator” on one of the tabs (I forget which one, but it should be obvious). Make sure it’s check box is selected. Restart the Apache server and re-test.
The server seems to be working properly and the odd part is his sketch claims to connect to it but times out and doesn't seem to appear in the logs. I suspect there is a network problem but debugging will be a lot easier with a Linux environment.
 

djsfantasi

Joined Apr 11, 2010
9,163
I understand your point. But perhaps it can be solved in Windows...

Look at the installation log the TS provided earlier. There are two warnings.

2AAF7ED7-4B0A-4F14-9140-13A746661D27.jpeg

The first is that the install wasn’t performed with Administrator rights. This is usually a no-no. But the details of the warning don’t appear to apply. Unless he is running XAMPP as a service...

One of my beliefs is that before you can debug a problem, any identified errors or warnings must be resolved.

Hence, if it were me, I’d uninstall and re-install as Administrator.

After I looked into the second warning. And I’d specify all files/paths without special characters or spaces.

The path/file can be converted to its equivalent without spaced by using the

echo “%~spathfile%​

command, where pathfile is a variable containing the - well - pathfile!

The converted (short) path should be used in XAMMP.

XAMPP is a port and there may be Linux artifacts in the Windows version.

Further testing with Linux isn’t a bad idea. Maybe these points will be valuable.
 

Ya’akov

Joined Jan 27, 2019
9,170
I understand your point. But perhaps it can be solved in Windows...

Look at the installation log the TS provided earlier. There are two warnings.

View attachment 234848

The first is that the install wasn’t performed with Administrator rights. This is usually a no-no. But the details of the warning don’t appear to apply. Unless he is running XAMPP as a service...

One of my beliefs is that before you can debug a problem, any identified errors or warnings must be resolved.

Hence, if it were me, I’d uninstall and re-install as Administrator.

After I looked into the second warning. And I’d specify all files/paths without special characters or spaces.

The path/file can be converted to its equivalent without spaced by using the

echo “%~spathfile%​

command, where pathfile is a variable containing the - well - pathfile!

The converted (short) path should be used in XAMMP.

XAMPP is a port and there may be Linux artifacts in the Windows version.

Further testing with Linux isn’t a bad idea. Maybe these points will be valuable.
But he's demonstrated that Apache will serve files. He got both the bin and a test html document to be delivered. And, you can start XAMPP as administrator, you don't have to reinstall it. And the warning is about services, not application related. I don't think it's relevant, really.

My main complaint is the platform lacks the basic sysadmin tools and won't be used in production anyway.
 

djsfantasi

Joined Apr 11, 2010
9,163
But he's demonstrated that Apache will serve files. He got both the bin and a test html document to be delivered. And, you can start XAMPP as administrator, you don't have to reinstall it. And the warning is about services, not application related. I don't think it's relevant, really.

My main complaint is the platform lacks the basic sysadmin tools and won't be used in production anyway.

Are you sure that he has demonstrated that “his” Apache server will serve files? The only post referring to that was post #27, and his code referred to a random test server on the Internet.

Or am I wrong? Only the TS can definitely answer if his XAMP server on a Windows box will serve files.

BTW, what version of XAMP and Windows is he using? And what’s his comfort level with Linux?
 

Ya’akov

Joined Jan 27, 2019
9,170
Are you sure that he has demonstrated that “his” Apache server will serve files? The only post referring to that was post #27, and his code referred to a random test server on the Internet.

Or am I wrong? Only the TS can definitely answer if his XAMP server on a Windows box will serve files.

BTW, what version of XAMP and Windows is he using? And what’s his comfort level with Linux?
Yes:

To further test my apache webserver, In my htpcd I have created a very simple html page:

Code:
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<p>This is an example of a simple HTML page with one paragraph.</p>
</body>
</html>
Now, by typing in the browser , i can see that page:
1617884759982.png
I don't know either of those things but I do know that I can help him much more using Linux, and that he has no special experiences with Apache or XAMPP anyway. I think he's better off starting with what will almost certainly be the platform for deployment.
 
Top