I recently bought two barebones ESP8266 boards (https://www.sparkfun.com/products/13678). I've heard they're a bit of a pain to get working, and am experiencing this first hand...
After playing around with them out of the box for a bit, I was able to get the AT firmware working and connected to my network. Now, I am trying to write my own firmware. I have installed the Arduino cores (from https://github.com/esp8266/Arduino) and am successfully compiling and uploading the basic blink example sketch (pin 1/TX blue LED). However, it seems like my code is never being run.
Hardware
I am using an Arduino as a USB/Serial converter (with a logic level converter). This seems to be working okay, on account of the fact that I can upload programs without an issue. I can also use esptool.py to read the MAC address, etc.
I am using a standalone 3.3V regulator (not Arduino builtin), powered from Arduino 5V. I think this is giving me a stable enough power supply. I also have decoupling caps on the 5V line, before the regulator, and on the 3.3V line, next to the ESP.
- chip enable connected to 3.3V
- reset connected to button
- GPIO2 pulled high through a 1kΩ
- GPIO0 pulled low (for bootloader mode)
Symptoms
With a serial monitor open to 74880 baud, I press the reset button:
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
From my research, the first boot mode value being 1 suggests that the ESP is properly in UART bootloader mode.
I can then upload my sketch. The blue LED blinks, Arduino IDE uploads my sketch, no problems. The following appears on the serial monitor (at 115200 baud):
len 1384, room 16
tail 8
chksum 0xef
csum 0xef
csum err
ets_main.c
I don't know if there is any useful information here.
Settings
I'm wondering if my settings are wrong. Here is what I have: (most are defaults)
- Board: Generic ESP8266 Module
- Upload Speed: 115200
- CPU Freq: 80 MHz
- Crystal Freq: 26 MHz
- Flash Size: 1M (no SPIFFS) [I have the 1M version; confirmed with esptool.py flash_id.]
- Flash Mode: DIO [I'm not too sure about this one, but I tried the other ones]
- Flash Freq: 40 MHz
- Reset Method: None [I've got a button that I press before upload]
- Debug port: Disabled
- Debug level: None
- IwIP: v2 Lower Memory
- VTables: Flash
- Exceptions: Enabled
- Builtin LED: 1 [I also tried 0 and 2]
- Erase Flash: Only sketch [I'm not doing any Wifi stuff yet]
and the sketch is:
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(1000); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
}