You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/ota_updates/ota_updates.md
+63-10
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ title: OTA Update
11
11
*[Requirements](#requirements)
12
12
*[Application Example](#application-example)
13
13
*[Classic OTA](#classic-ota)
14
+
*[Troubleshooting](#troubleshooting)
14
15
*[ArduinoOTA](#arduinoota)
15
16
*[Web Browser](#web-browser)
16
17
*[Requirements](#requirements-1)
@@ -42,7 +43,7 @@ Arduino IDE option is intended primarily for software development phase. The two
42
43
43
44
In any case first firmware upload have to be done over a serial port. If OTA routines are correctly implemented in a sketch, then all subsequent uploads may be done over the air.
44
45
45
-
There is no imposed security on OTA process from being hacked. It is up to developer to ensure that updates are allowed only from legitimate / trusted source. Once update is complete, module restarts and new code is executed. Developer should ensure that application running on module is shut down and restarted in a safe manner. Chapters below provide additional information regarding security and safety of OTA process.
46
+
There is no imposed security on OTA process from being hacked. It is up to developer to ensure that updates are allowed only from legitimate / trusted source. Once update is complete, module restarts and new code is executed. Developer should ensure that application running on module is shut down and restarted in a safe manner. Chapters below provide additional information regarding security and safety of OTA process.
Flash chip size needs a size thats is able to hold the old sketch (currently running) and the new sketch (OTA) at the same time.
83
-
keep in mind that the File system and EEPROM for example needs space too (one time) see [flash layout](../filesystem.md#flash-layout).
83
+
Flash chip size needs a size that is able to hold the old sketch (currently running) and the new sketch (OTA) at the same time.
84
+
Keep in mind that the File system and EEPROM for example needs space too (one time) see [flash layout](../filesystem.md#flash-layout).
84
85
```cpp
85
86
ESP.getFreeSketchSpace();
86
87
```
87
88
can be used for checking the free space for the new sketch.
88
89
90
+
For overview of memory layout, where new sketch is stored and how it is copied during OTA process see [Update process - memory view](https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/ota_updates.md#update-process---memory-view).
89
91
90
92
91
93
The following chapters provide more details and specific methods of doing OTA.
@@ -125,11 +127,11 @@ Instructions below demonstrate how to configure both [Classic OTA](#classic-ota-
125
127

126
128
127
129
2. Now prepare the sketch and configuration for the upload over a serial port.
128
-
- Start Arduino IDE and load sketch DNS_SD_Arduino_OTA.ino available under File > Examples > ESP8266mDNS
130
+
- Start Arduino IDE and load sketch DNS_SD_Arduino_OTA.ino available under File > Examples > ESP8266mDNS
**Note:** This sketch is available only for 1.6.5-947-g39819f0 (of July 23, 2015) and 1.6.5-1160-gef26c5f (of Sep 30, 2015) versions of platform packages installed in Arduino IDE using https://github.com/esp8266/Arduino#installing-with-boards-manager. It was removed in [#980](https://github.com/esp8266/Arduino/pull/980) from GitHub repository.
132
-
- Update SSID and password in the sketch so the module can join your Wi-Fi network
134
+
- Update SSID and password in the sketch so the module can join your Wi-Fi network
133
135

134
136
- Configure upload parameters as below (you may need to adjust configuration if you are using a different module):
135
137

@@ -155,6 +157,57 @@ Instructions below demonstrate how to configure both [Classic OTA](#classic-ota-
155
157
**Note:** To be able to upload your sketch over and over again using OTA, you need to embed OTA routines inside. Please use DNS_SD_Arduino_OTA.ino as an example.
156
158
157
159
160
+
#### Troubleshooting
161
+
162
+
If OTA update fails, first step is to check for error messages that may be shown in upload window of Arduino IDE. If this is not providing any useful hints try to upload again while checking what is shown by ESP on serial port. Serial Monitor from IDE will not be useful in that case. When attempting to open it, you will likely see the following:
163
+
164
+

165
+
166
+
This window is for Arduino Yún and not yet implemented for esp8266/Arduino. It shows up because IDE is attempting to open Serial Monitor using network port you have selected for OTA upload.
167
+
168
+
Instead you need an external serial monitor. If you are a Windows user check out [Termite](http://www.compuphase.com/software_termite.htm). This is handy, slick and simple RS232 terminal that does not impose RTS or DTR flow control. Such flow control may cause issues if you are using respective lines to toggle GPIO0 and RESET pins on ESP for upload.
169
+
170
+
Select COM port and baud rate on external terminal program as if you were using Arduino Serial Monitor. Please see typical settings for [Termite](http://www.compuphase.com/software_termite.htm) below:
171
+
172
+

173
+
174
+
Then run OTA from IDE and look what is displayed on terminal. Successful OTA process looks like below (sketch and free memory sizes as well as IP addresses depend on your particular s/w and h/w configuration):
If upload fails you will likely see errors caught by the uploader, exception and the stack dump, or both.
201
+
202
+
The most common causes of OTA failure are as follows:
203
+
* not enough physical memory on the chip (e.g. ESP01 with 512K flash memory is not enough for OTA),
204
+
* too much memory declared for SPIFFS so new sketch will not fit between existing sketch and SPIFFS – see [Update process - memory view](https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/ota_updates.md#update-process---memory-view),
205
+
* too little memory declared in Arduino IDE for your selected board (i.e. less than physical size).
206
+
207
+
For more details regarding flash memory layout please check [File system](https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md).
208
+
For overview where new sketch is stored, how it is copied and how memory is organized for the purpose of OTA see [Update process - memory view](https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/ota_updates.md#update-process---memory-view).
209
+
210
+
158
211
#### ArduinoOTA
159
212
160
213
1. Upload and install the following software:
@@ -183,7 +236,7 @@ Updates described in this chapter are done with a web browser that can be useful
183
236
184
237
### Implementation Overview
185
238
186
-
Updates with a web browswer are implemented using ```ESP8266HTTPUpdateServer``` class together with ```ESP8266WebServer``` and ```ESP8266mDNS``` classes. The following code is required to get it work:
239
+
Updates with a web browser are implemented using ```ESP8266HTTPUpdateServer``` class together with ```ESP8266WebServer``` and ```ESP8266mDNS``` classes. The following code is required to get it work:
187
240
188
241
setup()
189
242
@@ -222,10 +275,10 @@ You can use another module if it meets “Flash chip size is 2x the size of the
222
275
223
276
2. Prepare the sketch and configuration for initial upload with a serial port.
224
277
- Start Arduino IDE and load sketch WebUpdater.ino available under File > Examples > ESP8266HTTPUpdateServer.
225
-
- Update ssid and pass in the sketch so the module can join your Wi-Fi network.
278
+
- Update SSID and password in the sketch so the module can join your Wi-Fi network.
226
279
- Open File > Preferences, look for “Show verbose output during:” and check out “compilation” option.
227
280
228
-

281
+

229
282
230
283
**Note:** This setting will be required in step 5 below. You can uncheck this setting afterwards.
231
284
@@ -315,7 +368,7 @@ For the simple updater the server only needs to deliver the binary file for upda
315
368
##### Advanced updater
316
369
317
370
For advanced update management a script needs to run at the server side, for example a PHP script.
318
-
At every update request the the ESP sends some information in HTTP headers to the server.
371
+
At every update request the ESP sends some information in HTTP headers to the server.
319
372
320
373
Example header data:
321
374
```
@@ -329,7 +382,7 @@ Example header data:
329
382
[HTTP_X_ESP8266_VERSION] => DOOR-7-g14f53a19
330
383
```
331
384
332
-
With this information the script now can check if a update is needed. It is also possible to deliver different binaries based on the MAC address for example.
385
+
With this information the script now can check if an update is needed. It is also possible to deliver different binaries based on the MAC address for example.
0 commit comments