1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

ESP.restart() doesn't work, typo fixes (#2216)

New FAQ item: ESP.restart() doesn't work
Write up review / typo fixes
This commit is contained in:
Krzysztof 2016-07-04 04:46:04 +02:00 committed by Ivan Grokhotkov
parent 31a72cebb0
commit dd1a7e91b8
4 changed files with 60 additions and 49 deletions

View File

@ -28,7 +28,7 @@ Example boards with USB to serial converter build in, that will make your initia
![Example boards with integrated USB to serial converter](pictures/a01-example-boards-with-usb.png)
If you are using a Generic ESP8266 module, separate USB to serial converter and connect them by yourself, please make sure you have the following tree things right:
If you are using a Generic ESP8266 module, separate USB to serial converter and connect them by yourself, please make sure you have the following three things right:
1. Module is provided with enough power,
2. GPIO0, GPIO15 and CH_PD are connected using pull up / pull down resistors,
3. Module is put into boot loader mode.
@ -58,9 +58,9 @@ In order to troubleshoot "espcomm_sync failed" error, please proceed step by ste
![Board selection](pictures/a01-board-selection.png)
Basing on selected board type Arduino IDE will apply specific "reset method" to enter the board into boot-loading mode. Reset methods are board specific. Some boards do not have the h/w in place to support reset by Arduino IDE. If this is the case, you need to enter such board into boot loading mode manually.
Basing on selected board type, Arduino IDE will apply specific "reset method" to enter the board into boot loading mode. Reset methods are board specific. Some boards do not have the h/w in place to support reset by Arduino IDE. If this is the case, you need to enter such board into boot loading mode manually.
4. Upload may be also failing due to too high speed. If you have long or poor quality USB cable, try reducing selection under Upload Speed.
4. Upload may be also failing due to too high speed. If you have long or poor quality USB cable, try reducing selection under *Upload Speed*.
![Serial speed selection](pictures/a01-serial-speed-selection.png)
@ -77,7 +77,7 @@ In order to troubleshoot "espcomm_sync failed" error, please proceed step by ste
ets Jan 8 2013,rst cause:2, boot mode:(1,7)
```
If you see similar message but different values then decode them using [Boot Messages and Modes](../boards.md#boot-messages-and-modes). The key information is contained in first digit of the boot mode message as shown below.
If you see similar message but different values then decode them using [Boot Messages and Modes](../boards.md#boot-messages-and-modes). The key information is contained in first digit / three right-most bits of the boot mode message as shown below.
![Decoding of boot mode](pictures/a01-boot-mode-decoding.png)
@ -85,11 +85,11 @@ In order to troubleshoot "espcomm_sync failed" error, please proceed step by ste
> Note: Without having this step right you will not be able to upload your module over a serial port.
2. You have confirmed that module is in boot loading mode but upload still fails. If you are using external USB to serial converter then check of operates correctly by looping it back. This is quite simple check. Just connect TX and RX of your converter together like on picture below. Then open Serial Monitor and type some characters. If everything is fine, then you should see what you type immediately printed back on the monitor. For ESP integrated with USB to serial converter this check may involve breaking some PCB traces. I would not do it unless being desperate. Instead try step below.
2. You have confirmed that module is in boot loading mode but upload still fails. If you are using external USB to serial converter, then check if it operates correctly by looping it back. This is quite simple check. Just connect TX and RX of your converter together like on picture below. Then open Serial Monitor and type some characters. If everything is fine, then you should see what you type immediately printed back on the monitor. For an ESP with USB to serial converter on board, this check may involve breaking some PCB traces. I would not do it unless being desperate. Instead try steps below.
![USB to serial converter loop back](pictures/a01-usb-to-serial-loop-back.png)
3. Next step to try, if not done already, is checking detailed debug messages. Go to File > Preferences, enable *Show verbose output during: upload* and try uploading again. For successful upload this log should look similar to example shown below:
3. Next step to try, if not done already, is checking detailed debug messages. Go to *File > Preferences*, enable *Show verbose output during: upload* and try uploading again. For successful upload this log should look similar to example shown below:
```
C:\Users\Krzysztof\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.8/esptool.exe -vv -cd ck -cb 115200 -cp COM3 -ca 0x00000 -cf C:\Users\KRZYSZ~1\AppData\Local\Temp\build7e44b372385012e74d64fb272d24b802.tmp/Blink.ino.bin
@ -152,7 +152,7 @@ In order to troubleshoot "espcomm_sync failed" error, please proceed step by ste
flush complete
```
This log may be longer depending on number of connection attempts made by esptool. Analyze it for any anomalies to configuration you have selected in Arduino IDE, like different serial port, reset method, baud rate, etc. Resolve all noted differences.
Upload log may be longer depending on number of connection attempts made by esptool. Analyze it for any anomalies to configuration you have selected in Arduino IDE, like different serial port, reset method, baud rate, etc. Resolve all noted differences.
### Reset Methods
@ -161,7 +161,7 @@ If you got to this point and still see ``` espcomm_sync failed ```, then now you
Connect scope or logic analyzer to GPIO0, RST and RXD pins of the ESP to check what's happening.
Then compare your measurements with what is shown on wave-forms collected for circuits below. They document two standard methods of resetting ESP8266 for upload, that you can select in Arduino IDE - [ck](#ck) and [nodemcu](#nodemcu).
Then compare your measurements with wave-forms collected for circuits below. They document two standard methods of resetting ESP8266 for upload, that you can select in Arduino IDE - [ck](#ck) and [nodemcu](#nodemcu).
#### Ck
@ -170,15 +170,17 @@ Circuit below has been prepared to collect wave-forms for ck reset method ([get
![Sample circuit to check ck method](pictures/a01-circuit-ck-reset.png)
Wave-forms below show voltage signals on GPIO0 and RST pins of the ESP board when uploading the firmware. Close up of ck reset method signal sequence at the beginning of upload is shown below.
The following wave-forms below show voltage signals on GPIO0 and RST pins of the ESP board when uploading the firmware.
Close up of ck reset method signal sequence at the beginning of upload is shown below.
![Reset Method: ck, close up at the beginning of upload](pictures/a01-reset-ck-closeup.png)
Next picture shows complete upload of blink.ino example at 921600 baud. This is quite high speed so the upload takes only about 8s.
Next picture shows complete upload of [Blink.ino](https://github.com/esp8266/Arduino/blob/master/libraries/esp8266/examples/Blink/Blink.ino) example at 921600 baud. This is quite high speed, so the upload takes only about 8s.
![Reset Method: ck, complete upload](pictures/a01-reset-ck-complete.png)
Please note that when esptool is not able to initialize upload at the first time, then it retries reset procedure. Case of one such retry is shown on waveform below.
Please note that when esptool is not able to initialize upload at the first time, then it retries reset procedure. Case of one such retry is shown on wave-form below.
![Reset Method: ck, complete upload](pictures/a01-reset-ck-complete-1-retry.png)
@ -196,7 +198,7 @@ trying to connect
read 0, requested 1
```
Presented circuit has one important limitation when it comes to work with Arduino IDE. After opening Serial Monitor (Ctrl-Shift-M), both RTS and DTR lines are permanently pulled down. As RTS line is connected to REST input of ESP, the module is hold in reset state / not able to run. Therefore after uploading module, you need to disconnect both lines or use different serial terminal program that is not pulling down RTS and DTR lines. Otherwise the module will get stuck waiting for releasing the REST signal.
Presented circuit has one important limitation when it comes to work with Arduino IDE. After opening Serial Monitor (Ctrl-Shift-M), both RTS and DTR lines are permanently pulled down. As RTS line is connected to REST input of ESP, the module is hold in reset state / not able to run. Therefore after uploading module, you need to disconnect both lines or use different serial terminal program that is not pulling down RTS and DTR lines. Otherwise the module will get stuck waiting for releasing the REST signal and you will see nothing on the Serial Monitor.
As for different serial terminal program you can check Arduino IDE add-on [Serial Monitor for ESP8266]((https://github.com/esp8266/Arduino/issues/1360)) developed by user [@mytrain](https://github.com/mytrain) and discussed in [#1360](https://github.com/esp8266/Arduino/issues/1360).
@ -215,33 +217,33 @@ Close up of voltage signals on GPIO0 and RST pins at the beginning of firmware u
![Reset Method: nodemcu, close up at the beginning of upload](pictures/a01-reset-nodemcu-closeup.png)
Please note that the reset sequence takes about 10x shorter comparing to [ck](@ck) reset (about 25ms vs. 250ms).
Please note that the reset sequence is about 10x shorter comparing to [ck](@ck) reset (about 25ms vs. 250ms).
Next picture covers complete upload of blink.ino example at 921600 baud. Except for difference of the reset signal sequence, the complete upload looks similar to that of [ck](@ck).
Next picture covers complete upload of [Blink.ino](https://github.com/esp8266/Arduino/blob/master/libraries/esp8266/examples/Blink/Blink.ino) example at 921600 baud. Except for difference of the reset signal sequence, the complete upload looks similar to that of [ck](@ck).
![Reset Method: nodemcu, complete upload](pictures/a01-reset-nodemcu-complete.png)
A sample wave-form below shows another upload of blink.ino example at 921600 baud but with two reset retries.
A sample wave-form below shows another upload of [Blink.ino](https://github.com/esp8266/Arduino/blob/master/libraries/esp8266/examples/Blink/Blink.ino) example at 921600 baud, but with two reset retries.
![Reset Method: nodemcu, reset retries](pictures/a01-reset-nodemcu-complete-2-retries.png)
If you are interested how noodemcu reset method is implemented, so it does not pull to ground RTS and DTR lines once you open Serial Monitor in Arduino IDE, then check circuit below.
If you are interested how noodemcu reset method is implemented, then check circuit below. As indicated it does not pull to ground RTS and DTR lines once you open Serial Monitor in Arduino IDE.
![Implementation of noodemcu reset](pictures/a01-nodemcu-reset-implementation.png)
It consists of two transistors and resistors that you can locate on NodeMCU board on right. On left you can see complete circuit and the truth table how RTS and DTR signals of the serial interface are translated to REST and GPIO0 on the ESP. For more details please refer to [nodemcu](https://github.com/nodemcu/nodemcu-devkit) repository on GitHub.
It consists of two transistors and resistors that you can locate on NodeMCU board on right. On left you can see complete circuit and the truth table how RTS and DTR signals of the serial interface are translated to RST and GPIO0 on the ESP. For more details please refer to [nodemcu](https://github.com/nodemcu/nodemcu-devkit) repository on GitHub.
### I'm Stuck
Hopefully at this point you were able to resolve ``` espcomm_sync failed ``` issue and now enjoy quick and reliable uploads of your ESP modules.
If this is still not the case then review once more all discussed steps in the checklist below.
If this is still not the case, then review once more all discussed steps in the checklist below.
**Initial Checks**
* [ ] Is your module connected to serial port and visible in IDE?
* [ ] Is connected device responding to IDE? What is exact message in debug window?
* [ ] Have you selected correct ESP module type in "Board" menu? What is the selection?
* [ ] Have you selected correct ESP module type in *Board* menu? What is the selection?
* [ ] Have you tried to reduce upload speed? What speeds have you tried?
**Advanced Checks**
@ -264,17 +266,19 @@ If you are stuck at certain step, then post this list on [ESP8266 Community Foru
### Conclusion
With variety of available ESP8266 modules and boards as well as possible connection methods troubleshooting of upload issues may take several steps.
With variety of available ESP8266 modules and boards, as well as possible connection methods, troubleshooting of upload issues may take several steps.
If you are beginner use boards with integrated power supply and USB to serial converter. Check carefully message in debug window and act accordingly. Select your exact module type in IDE and try to adjust upload speed. Check is board is indeed entering boot loading mode. Double check your USB to serial converter. Analyze detailed upload log for inconsistencies with IDE settings.
If you are a beginner, then use boards with integrated power supply and USB to serial converter. Check carefully message in debug window and act accordingly. Select your exact module type in IDE and try to adjust upload speed. Check if board is indeed entering boot loading mode. Check operation of your USB to serial converter with loop back. Analyze detailed upload log for inconsistencies with IDE settings.
Double check your confection diagram and wave-form for consistency with selected reset method.
Verify your connection diagram and wave-form for consistency with selected reset method.
If you get stuck ask [community](http://www.esp8266.com/) for support providing summary of all completed checks.
If you get stuck, then ask [community](http://www.esp8266.com/) for support providing summary of all completed checks.
![Test stand used during checking of ck reset method](pictures/a01-test-stand.jpg)
Test stand used for checking of ck reset method is shown above. No any ESP module has been harmed during preparation of this FAQ item.
Test stand used for checking of ck reset method is shown above.
No any ESP module has been harmed during preparation of this FAQ item.
[FAQ list :back:](readme.md)

View File

@ -21,11 +21,11 @@ title: Frequently Asked Questions / Troubleshooting
### Introduction
Your ESP is self restarting. You do not know why and what to do about it.
Your ESP is self restarting. You don't know why and what to do about it.
Do not panic.
In most of cases ESP provides enough clues on serial monitor that you can interpret to pin down the root cause. The first step is then checking what ESP is saying on serial monitor when it crashes.
In most of cases ESP provides enough clues on serial monitor, that you can interpret to pin down the root cause. The first step is then checking what ESP is saying on serial monitor when it crashes.
### What ESP has to Say
@ -38,16 +38,16 @@ Before rushing to copy and paste displayed code to Google, reflect for a while o
* Does ESP restart on random basis, or under certain conditions, like serving a web page?
* Do you see always the same exception code and stack trace or it changes?
* Does this issue occur with unmodified standard example code (File > Examples)?
* Does this issue occur with unmodified standard example code (Arduino IDE > *File > Examples*)?
If restarts are random or the exception code differs between restarts then the problem may be caused by h/w. If the issue occurs for standard examples and stable [esp8266 / arduino](https://github.com/esp8266/Arduino) core, them the issue is almost certainly caused by h/w.
If restarts are random or the exception code differs between restarts, then the problem may be caused by h/w. If the issue occurs for standard examples and stable [esp8266 / arduino](https://github.com/esp8266/Arduino) core, them the issue is almost certainly caused by h/w.
### Get Your H/W Right
If you suspect the h/w, before troubleshooting the s/w, make sure to get your h/w right. There is no much sense in diagnosing the s/w if you board is randomly crashing because of not enough power, missing boot strapping resistors or loose connections.
If you are using generic ESP modules please follow [recommendations](Generic ESP8266 modules) on power supply and boot strapping resistors.
If you are using generic ESP modules, please follow [recommendations](Generic ESP8266 modules) on power supply and boot strapping resistors.
For boards with integrated USB to serial converter and power supply, usually it is enough to connect it to an USB hub that provides standard 0.5A and is not shared with other USB devices.
@ -61,9 +61,9 @@ You have verified that the ESP h/w is healthy but it still restarts. This is how
There are two typical scenarios that trigger ESP restarts:
* **Exception** - when code is performing [illegal operation](https://github.com/esp8266/Arduino/blob/master/doc/exception_causes.md), like trying to write to non-existent memory location.
* **Watchdog** - if code is [locked up](https://en.wikipedia.org/wiki/Watchdog_timer) staying too long in a loop or processing some task so vital processes like Wi-Fi communication are not able to run.
* **Watchdog** - if code is [locked up](https://en.wikipedia.org/wiki/Watchdog_timer) staying too long in a loop or processing some task, so vital processes like Wi-Fi communication are not able to run.
Please check below how to recognize exception and watchdog scenarios and what to do about it.
Please check below how to recognize [exception](#exception) and [watchdog](#watchdog) scenarios and what to do about it.
#### Exception
@ -72,14 +72,14 @@ Typical restart because of exception looks like follows:
![Exception cause decoding](pictures/a02-exception-cause-decoding.png)
Start with looking up exception code in the [Exception Causes (EXCCAUSE)](https://github.com/esp8266/Arduino/blob/master/doc/exception_causes.md) table to understand what kind of issue is it. If you have no clues what it's about and where it happens, then use [Arduino ESP8266/ESP32 Exception Stack Trace Decoder](https://github.com/me-no-dev/EspExceptionDecoder) to find out in which line of application it is triggered. Please refer to [Check Where the Code Crashes](#check-where-the-code-crashes) point below for a quick example how to do it.
Start with looking up exception code in the [Exception Causes (EXCCAUSE)](https://github.com/esp8266/Arduino/blob/master/doc/exception_causes.md) table to understand what kind of issue it is. If you have no clues what it's about and where it happens, then use [Arduino ESP8266/ESP32 Exception Stack Trace Decoder](https://github.com/me-no-dev/EspExceptionDecoder) to find out in which line of application it is triggered. Please refer to [Check Where the Code Crashes](#check-where-the-code-crashes) point below for a quick example how to do it.
#### Watchdog
ESP provides two watchdog timers (wdt) that observe application for lock up.
* **Software Watchdog** - provided by [SDK](http://bbs.espressif.com/viewforum.php?f=46) that is part of [esp8266 / arduino](https://github.com/esp8266/Arduino) core loaded to module together with your application.
* **Software Watchdog** - provided by [SDK](http://bbs.espressif.com/viewforum.php?f=46), that is part of [esp8266 / arduino](https://github.com/esp8266/Arduino) core loaded to module together with your application.
* **Hardware Watchdog** - build in ESP8266 hardware and acting if software watchdog is disabled for too long, in case it fails, or if it is not provided at all.
Restart by particular type of watchdog is clearly identified by ESP on serial monitor.
@ -88,15 +88,15 @@ An example of application crash triggered by software wdt is shown below.
![Example of restart by s/w watchdog](pictures/a02-sw-watchdog-example.png)
Restart by the software watchdog is generally easier to troubleshoot since log includes the stack trace. The trace can be then used to find particular line in code where it wdt has been triggered.
Restart by the software watchdog is generally easier to troubleshoot since log includes the stack trace. The trace can be then used to find particular line in code where wdt has been triggered.
Reset by hardware watchdog timer is show on picture below.
Reset by hardware watchdog timer is shown on picture below.
![Example of restart by h/w watchdog](pictures/a02-hw-watchdog-example.png)
Hardware wdt is the last resort of ESP to tell you that application is locked up (if s/w wdt timer is disabled or not working).
Please note that for this type of h/w initialized restart there is no stack trace to help you identify the place in code where the lockup has happened. In such case, to identify the place of lock up, you need to rely on debug messages like ``` Serial.print ``` distributed across the application. Then by observing what was the last debug message printed out before restart, you should be able to narrow down part of code firing the h/w wdt reset. If diagnosed application or library has debug option then switch it on to aid this troubleshooting.
Please note that for restarts initialized by h/w wdt, there is no stack trace to help you identify the place in code where the lockup has happened. In such case, to identify the place of lock up, you need to rely on debug messages like ``` Serial.print ``` distributed across the application. Then by observing what was the last debug message printed out before restart, you should be able to narrow down part of code firing the h/w wdt reset. If diagnosed application or library has debug option then switch it on to aid this troubleshooting.
### Check Where the Code Crashes
@ -105,7 +105,7 @@ Decoding of ESP stack trace is now easy and available to everybody thanks to gre
Installation for Arduino IDE is quick and easy following the [installation](https://github.com/me-no-dev/EspExceptionDecoder#installation) instructions.
If you don't have any code to troubleshooting yet, use the example below:
If you don't have any code for troubleshooting, use the example below:
```
void setup()
@ -128,7 +128,7 @@ Upload this code to your ESP (Ctrl+U) and start Serial Monitor (Ctrl+Shift+M). Y
![Decode the stack trace, steps 1 and 2](pictures/a02-decode-stack-tace-1-2.png)
Now paste the stack trace to Exception Decoder's window. At the bottom of this window you should see a list of decoded lines of sketch you have just uploaded to your ESP. On the top of the list, like on the top of the stack trace, there is reference to the last line executed just before the software watchdog timer fired causing the ESP's restart. Check the number of this line and look it up on the sketch. It should be the line ``` Serial.println("Let's provoke the s/w wdt firing...") ```, that happens to be just before ``` while(true) ``` that made the watchdog fired (ignore the lines with comments, that are discarded by compiler).
Now paste the stack trace to Exception Decoder's window. At the bottom of this window you should see a list of decoded lines of sketch you have just uploaded to your ESP. On the top of the list, like on the top of the stack trace, there is a reference to the last line executed just before the software watchdog timer fired causing the ESP's restart. Check the number of this line and look it up on the sketch. It should be the line ``` Serial.println("Let's provoke the s/w wdt firing...") ```, that happens to be just before ``` while(true) ``` that made the watchdog fired (ignore the lines with comments, that are discarded by compiler).
![Decode the stack trace, steps 3 through 6](pictures/a02-decode-stack-tace-3-6.png)
@ -141,7 +141,7 @@ Armed with [Arduino ESP8266/ESP32 Exception Stack Trace Decoder](https://github.
Using the procedure above you should be able to troubleshoot all the code you write. It may happen that ESP is crashing inside some library or code you are not familiar enough to troubleshoot. If this is the case then contact the application author by writing an issue report.
Follow the guidelines on issue reporting provided by the author of code.
Follow the guidelines on issue reporting that may be provided by the author of code in his / her repository.
If there are no guidelines, include in your report the following:
@ -149,7 +149,7 @@ If there are no guidelines, include in your report the following:
* [ ] Your exact hardware configuration including the schematic
* [ ] If the issue concerns standard, commercially available ESP board with power supply and USB interface, without extra h/w attached, then provide just the board type or link to description
* [ ] Configuration settings in Arduino IDE used to upload the application
* [ ] Error log & messages produced by the application, enable debugging for more details
* [ ] Error log & messages produced by the application (enable debugging for more details)
* [ ] Decoded stack trace
* [ ] Copy of your sketch
* [ ] Copy of all the libraries used by the sketch
@ -159,11 +159,11 @@ If there are no guidelines, include in your report the following:
With plenty of ESP module types available, several versions of libraries or [esp8266 / Arduino](https://github.com/esp8266/Arduino) core, types and versions of O/S, you need to provide exact information what your application is about. Only then people willing to look into your issue may be able to refer it to configuration they have. If you are lucky, they may even attempt to reproduce your issue on their equipment. This will be far more difficult if you are providing only vague details, so somebody would need to ask you to find out what is really happening.
On the other hand if you flood you issue report with hundreds lines of code, you may also have difficulty to find somebody willing to analyze it. Therefore reduce your code to the bare minimum that is still causing the issue. It will help you as well to isolate the issue and pin done the root cause.
On the other hand if you flood your issue report with hundreds lines of code, you may also have difficulty to find somebody willing to analyze it. Therefore reduce your code to the bare minimum that is still causing the issue. It will help you as well to isolate the issue and pin done the root cause.
### Conclusion
Do not be afraid to troubleshoot ESP exception and watchdog restarts. [Esp8266 / Arduino](https://github.com/esp8266/Arduino) core provides detailed diagnostics that will help you pin down the issue. Get your h/w right before diagnosing the s/w. Use [ESP Exception Decoder](https://github.com/me-no-dev/EspExceptionDecoder) to find out where the code fails. If you do you homework and still unable to identify the root cause, enter prepare the issue report. Provide enough details. Be specific and isolate the issue. Then ask community for support. There are plenty of people that like to work with ESP and willing to help with your problem.
Do not be afraid to troubleshoot ESP exception and watchdog restarts. [Esp8266 / Arduino](https://github.com/esp8266/Arduino) core provides detailed diagnostics that will help you pin down the issue. Before checking the s/w, get your h/w right. Use [ESP Exception Decoder](https://github.com/me-no-dev/EspExceptionDecoder) to find out where the code fails. If you do you homework and still unable to identify the root cause, enter the issue report. Provide enough details. Be specific and isolate the issue. Then ask community for support. There are plenty of people that like to work with ESP and willing to help with your problem.
[FAQ list :back:](readme.md)

View File

@ -19,14 +19,14 @@ title: Frequently Asked Questions / Troubleshooting
### Introduction
You would like to use this Arduino library with ESP8266 and it does not perform. It is not listed among [libraries verified to work with ESP8266](../doc/libraries.md#other-libraries-not-included-with-the-ide). You could not find any evidence on internet that it is compatible.
You would like to use this Arduino library with ESP8266 and it doesn't perform. It is not listed among [libraries verified to work with ESP8266](../doc/libraries.md#other-libraries-not-included-with-the-ide). You couldn't find any evidence on internet that it is compatible.
What are the odds to make it working?
### Identify the Issues
Start with looking for the symptoms that it is not compatible with ESP8266. Ideally use example sketches provided with the library. Then list all the issues you are able to identify.
Start with looking for all the symptoms that it is not compatible with ESP8266. Ideally use example sketches provided with the library. Then list all the issues you are able to identify.
You are likely to see one or more of the following:
* Compilation drops errors
@ -45,7 +45,7 @@ If library author is unable to provide support, then assess the chances of fixin
*Issue:* Compiler complains about usage of AVR registers (PORTx, PINx, TCR1A, etc).
*Solution:* Check if usage of registers is well localized in a few functions, try to replace GPIO registers usage with digitalRead/Write, timer registers usage with timerX_ functions. If usage of AVR registers happens all over the code, this library might not be worth the effort. Also may be worth checking if someone got the library working on ARM (Due/STM), PIC, etc. If this is the case, maybe there already is a version of the library which uses Arduino APIs instead of raw registers.
*Solution:* Check if usage of registers is well localized in a few functions, try to replace GPIO registers usage with digitalRead / digitalWrite, timer registers usage with timerX_ functions. If usage of AVR registers happens all over the code, this library might not be worth the effort. Also may be worth checking if someone got the library working on ARM (Due/STM), PIC, etc. If this is the case, maybe there already is a version of the library which uses Arduino APIs instead of raw registers.
*Issue:* Compiler complains about ``` <avr/pgmspace.h> ```.
@ -71,14 +71,14 @@ To troubleshoot resets follow FAQ item [My ESP crashes running some code](a02-my
*Solution:*: Check the usage of `int` type in the library. On AVRs integers are 16 bit, and on ESPs they are 32 bit (just like on ARM).
*Issue:* Some device with time critical control like a servo drive or a strip pf LEDs does not operate smoothly and tends to randomly changes position or displayed pattern.
*Issue:* Some device with time critical control like a servo drive or a strip pf LEDs does not operate smoothly and tends to randomly change position or displayed pattern.
*Solution:*: Check for usage of interrupts that may get in conflict with Wi-Fi activity of ESP8266. You may temporarily disable Wi-Fi communication ``` WiFi.mode(WIFI_OFF); ``` to check if it helps.
### Conclusion
Identify compatibility issues and ask library author for support. If left on your own then check for usage of controller's low level access functionality. Use [Esp Exception Decoder](https://github.com/me-no-dev/EspExceptionDecoder) if confronted with exceptions / watchdogs resets.
Identify compatibility issues and ask library author for support. If left on your own, then check for usage of controller's low level access functionality. Use [Esp Exception Decoder](https://github.com/me-no-dev/EspExceptionDecoder) if confronted with exceptions / watchdogs resets.
The good news is that the number of libraries which aren't supported on the ESP8266 is shrinking. Community of ESP8266 enthusiasts is growing. If you are unable to resolve the issues yourself, there are very good odds that you will be able to find somebody else to help you.

View File

@ -11,7 +11,7 @@ Please feel free to contribute if you believe that some frequent issues are not
### I am getting "espcomm_sync failed" error when trying to upload my ESP. How to resolve this issue?
This message indicates issue with uploading ESP module over a serial connection. There are couple of possible causes, that depend on type of your module, if you use separate USB to serial converter [:arrow_right:](a01-espcomm_sync-failed.md)
This message indicates issue with uploading ESP module over a serial connection. There are couple of possible causes, that depend on the type of your module, if you use separate USB to serial converter [:arrow_right:](a01-espcomm_sync-failed.md)
### Why esptool is not listed in "Programmer" menu? How do I upload ESP without it?
@ -36,3 +36,10 @@ The reason we cannot have more than 1MB of code in flash has to do with a hardwa
The option to choose 4M or 1M SPIFFS is to optimize the upload time. Uploading 3MB takes a long time so sometimes you can just use 1MB. Other 2MB of flash can still be used with ``` ESP.flashRead ``` and ``` ESP.flashWrite ``` APIs if necessary.
### I have observed a case when ESP.restart() doesn't work. What is the reason for that?
You will see this issue only if serial upload was not followed by a physical reset (e.g. power-on reset). For a device being in that state ESP.restart() will not work. Apparently the issue is caused by [one of internal registers not being properly updated until physical reset](https://github.com/esp8266/Arduino/issues/1017#issuecomment-200605576). This issue concerns only serial uploads. OTA uploads are not affected. If you are using ESP.restart(), the work around is to reset ESP once after each serial upload.
Ref. [#1017](https://github.com/esp8266/Arduino/issues/1017), [#1107](https://github.com/esp8266/Arduino/issues/1107), [#1782](https://github.com/esp8266/Arduino/issues/1782)