I have designed a custom ESP8266 board which has a voltage regulator circuit which accepts upto 6V supply and provides sufficient current to the ESP8266, 4M flash and a PCB antenna trace.
The GPIO pin settings to accommodate boot mode and execution mode are as follows:
GPIO15 pin of ESP8266 --> connected to ground
GPIO0 pin of ESP8266 --> brought out to toggle between gnd and floating
GPIO2 pin of ESP8266 --> by default connected to 3.3V through a pull up resistor 1.58K.
Arduino IDE settings when flashing the firmware:
Device: Generic ESP8266
Flash size: 512 MB with 64KB SPIFFS (Note if I make the Flash size option as 4MB with 64K SPIFFS then my ESP device crashes and never recovers), Can you explain why this happens? Can you explain what is SPIFFS? ).
Flash Mode: DIO
Flash Frequency: 40 MHz
CPU Frequency: 80 MHz
Reset Method: ck
Upload Speed: 115200
Programmer : AVRISP mkII
Debug Port: Serial1
Debug Level: WiFi + core
After I flash the program, the code starts pushing data to the cloud. Sometimes, it works effectively posting continuously to the cloud for about 11 hrs. But other times, the ESP has flaky connections. It just prints dots forever. To debug this, I asked the ESP print the following values:
RSSI: -55 to -39 db (when connected and not connected. )
WiFi status: 3 = WL_connected
The program structure is similar to the example code in arduino etc. The WiFi.begin() initiates the connection, WiFi.status() checks if the status is 3 and gets the IP address. Then the sensor gets activated, measures a value -- then makes a TCP packet. The TCP client checks if the connection is established or not. This sometimes gives no connection even when the WiFi.status ==3 (WL_connected). While the Wifi.status==3, all pings to the ESP from a computer on the network are failing so no layer 3 communication. My next step is to try to capture the communication between the ESP and the AP with Wireshark.
Any recommendations on how to debug or at what to look at first ?
Thanks
Yavor