-->
Page 1 of 1

Blink example not blinking

PostPosted: Wed Mar 27, 2019 2:29 pm
by insanis
Hello guys, new user here. Hope you are doing alright. Maybe you can help me with the following issue.

I have been able to setup the Arduino IDE using board manager and upload the modified blink example below, such that GPIO 0, 1 and 2 should blink:

Code: Select all
void setup() {
  pinMode(2, OUTPUT);     // Initialize the pins as an output
  pinMode(1, OUTPUT);
  pinMode(0, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(2, LOW);   // Turn the LEDs on (Note that LOW is the voltage level
  digitalWrite(1, LOW);
  digitalWrite(0, LOW);
  // but actually the LEDs are on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(2, HIGH);  // Turn the LEDs off by making the voltage HIGH
  digitalWrite(1, HIGH);
  digitalWrite(0, HIGH);
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}


With that sketch, whatever pin is connected to the built in led should blink.

While I compile and upload, I get the following log, showing a successful upload and compile:

Code: Select allC:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Trabalho\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Trabalho\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Trabalho\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:xtal=80,vt=flash,exception=disabled,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=512K,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -ide-version=10808 -build-path C:\Users\Trabalho\AppData\Local\Temp\arduino_build_179436 -warnings=none -build-cache C:\Users\Trabalho\AppData\Local\Temp\arduino_cache_830911 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.mkspiffs.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs-2.5.0-3-20ed2b9.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-3-20ed2b9 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-3-20ed2b9.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9 -prefs=runtime.tools.esptool.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9 -prefs=runtime.tools.esptool-2.5.0-3-20ed2b9.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9 -verbose C:\Users\Trabalho\AppData\Local\Temp\arduino_modified_sketch_577673\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Trabalho\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Trabalho\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Trabalho\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:xtal=80,vt=flash,exception=disabled,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=512K,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -ide-version=10808 -build-path C:\Users\Trabalho\AppData\Local\Temp\arduino_build_179436 -warnings=none -build-cache C:\Users\Trabalho\AppData\Local\Temp\arduino_cache_830911 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.mkspiffs.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs-2.5.0-3-20ed2b9.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-3-20ed2b9 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-3-20ed2b9.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9 -prefs=runtime.tools.esptool.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9 -prefs=runtime.tools.esptool-2.5.0-3-20ed2b9.path=C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9 -verbose C:\Users\Trabalho\AppData\Local\Temp\arduino_modified_sketch_577673\Blink.ino
Using board 'generic' from platform in folder: C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0
Using core 'esp8266' from platform in folder: C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0
Detecting libraries used...
"C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/lwip2/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10808 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\cores\\esp8266" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\variants\\generic" "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436\\sketch\\Blink.ino.cpp" -o nul
Generating function prototypes...
"C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/lwip2/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10808 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\cores\\esp8266" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\variants\\generic" "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436\\sketch\\Blink.ino.cpp" -o "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/lwip2/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10808 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\cores\\esp8266" "-IC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\variants\\generic" "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436\\sketch\\Blink.ino.cpp" -o "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
cmd.exe /c rem cannot sign on windows
Using precompiled core: C:\Users\Trabalho\AppData\Local\Temp\arduino_cache_830911\core\core_a1094e49431144763e9cf26cac215a81.a
Linking everything together...
"C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-gcc" -CC -E -P -DVTABLES_IN_FLASH "C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/local.eagle.app.v6.common.ld"
"C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-gcc" -fno-exceptions -Wl,-Map "-Wl,C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/Blink.ino.map" -g -w -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static "-LC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/lib" "-LC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/ld" "-LC:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/tools/sdk/libc/xtensa-lx106-elf/lib" -Teagle.flash.512k.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/Blink.ino.elf" -Wl,--start-group "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436\\sketch\\Blink.ino.cpp.o" "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_cache_830911\\core\\core_a1094e49431144763e9cf26cac215a81.a" -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group "-LC:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436"
"C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\esptool\\2.5.0-3-20ed2b9/esptool.exe" -eo "C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0/bootloaders/eboot/eboot.elf" -bo "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/Blink.ino.bin" -bm dout -bf 40 -bz 512K -bs .text -bp 4096 -ec -eo "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/Blink.ino.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
"C:\\Users\\Trabalho\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-size" -A "C:\\Users\\Trabalho\\AppData\\Local\\Temp\\arduino_build_179436/Blink.ino.elf"
Sketch uses 258668 bytes (51%) of program storage space. Maximum is 499696 bytes.
Global variables use 26696 bytes (32%) of dynamic memory, leaving 55224 bytes for local variables. Maximum is 81920 bytes.
C:\Users\Trabalho\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9/esptool.exe -vv -cd ck -cb 115200 -cp COM9 -ca 0x00000 -cf C:\Users\Trabalho\AppData\Local\Temp\arduino_build_179436/Blink.ino.bin
esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
   setting board to ck
   setting baudrate from 115200 to 115200
   setting port from COM1 to COM9
   setting address from 0x00000000 to 0x00000000
   espcomm_upload_file
   espcomm_upload_mem
   setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   read 0, requested 1
trying to connect
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2 bytes of data
   espcomm_send_command: receiving 2 bytes of data
   espcomm_send_command: receiving 2 bytes of data
   espcomm_send_command: receiving 2 bytes of data
   espcomm_send_command: receiving 2 bytes of data
   espcomm_send_command: receiving 2 bytes of data
   espcomm_send_command: receiving 2 bytes of data
   espcomm_send_command: receiving 2 bytes of data
Uploading 262816 bytes from C:\Users\Trabalho\AppData\Local\Temp\arduino_build_179436/Blink.ino.bin to flash at 0x00000000
   erasing flash
   size: 0402a0 address: 000000
   first_sector_index: 0
   total_sector_count: 65
   head_sector_count: 16
   adjusted_sector_count: 49
   erase_size: 031000
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   setting serial port timeouts to 15000 ms
   setting serial port timeouts to 1000 ms
   espcomm_send_command: receiving 2 bytes of data
   writing flash
................................................................................ [ 31% ]
................................................................................ [ 62% ]
................................................................................ [ 93% ]
.................                                                                [ 100% ]
starting app without reboot
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2 bytes of data
closing bootloader
   flush start
   setting serial port timeouts to 1 ms
   setting serial port timeouts to 1000 ms
   flush complete



so there shouldn't be any problem....

however, I get no blinks :cry:

I use the following USB adapter, and you can see it is modded with buttons from GPIO0 and RST to GND so I can flash it

Image

I have tried resetting, plugging it in a different power supply without any luck.

Have any of you experienced something similar? Or maybe have any ideas I can try to make it work?

Re: Blink example not blinking

PostPosted: Thu Mar 28, 2019 7:38 am
by QuickFix
The ESP-01 (probably the worst board to start with when new to microcontrollers and the ESP8266) only has 4 GPIO's available:
  • GPIO0 (needed to set the ESP into programming mode at boot)
  • GPIO1 (AKA the Tx pin of the ESP)
  • GPIO2 (no special usage, but its considered safer to pull high at boot, since it doubles as the debug Tx pin)
  • GPIO3 (AKA the Rx pin of the ESP)
As far as I know the blue LED on the ESP-01 is connected to the Tx pin (GPIO1), so if you set GPIO1 to output and you toggle its state (high/low) in the loop it should blink as intended.

Please note that you might need to remove the Tx wire going to the Rx-line of your USB->UART convertor board (the convertor may be pulling it up). :idea:
This might be a bit hard, since you're using a programming board that's directly connected to the ESP using a header.

Alternatively connect a LED with a pull-up resistor to GPIO2 and toggle that in your code instead.

Re: Blink example not blinking

PostPosted: Wed Apr 03, 2019 12:06 pm
by insanis
Turns out I eventually managed to find a solution for this.

First I discovered that even though it looked like the Arduino IDE was flashing the ESP-01, it wasn't.

In order to fix it I erased the flash following this instructions using a blank bin file. I was able to erase the flash that way, however, after that I was not able to flash anything else on the ESP using the USB adapter. Whenever I tried I got a ESP8266 Chip stub error esp_stub_and_set_baud on the ESP flash download tools. NodeMCU flasher didn't work either. I eventually got to fix it by using a PL2303 USB Serial adapter and powering the ESP-01 with an external power source. It looks like I needed more current than the USB2.0 and USB3.0 ports on my notebook were capable of providing. Using this setup I was able to flash the sketch using the Arduino IDE and the LED blinked.

I also changed the baud rate of the COM ports on the device manager to 115200, because during my research I found out that this could be an issue.

Also, LED_BUILTIN was on GPIO1 on my ESP-01, not on GPIO2. I had to change it in the example.

I had some trouble finding any help online while researching about this issue, so I hope this may help others!

Re: Blink example not blinking

PostPosted: Wed Apr 03, 2019 12:14 pm
by insanis
Hey, while I am not new to microcontrollers at all, I have to agree to you. ESP-01 is not so friendly at first to use. However, that was the hardware provided to me.

After successfully flashing the sketch, I tried to use the ESP-01 with the USB adapter, and without any mods (other than the ones mentioned on the original post), it blinked without any problem.

Thanks for the reply

QuickFix wrote:The ESP-01 (probably the worst board to start with when new to microcontrollers and the ESP8266) only has 4 GPIO's available:
  • GPIO0 (needed to set the ESP into programming mode at boot)
  • GPIO1 (AKA the Tx pin of the ESP)
  • GPIO2 (no special usage, but its considered safer to pull high at boot, since it doubles as the debug Tx pin)
  • GPIO3 (AKA the Rx pin of the ESP)
As far as I know the blue LED on the ESP-01 is connected to the Tx pin (GPIO1), so if you set GPIO1 to output and you toggle its state (high/low) in the loop it should blink as intended.

Please note that you might need to remove the Tx wire going to the Rx-line of your USB->UART convertor board (the convertor may be pulling it up). :idea:
This might be a bit hard, since you're using a programming board that's directly connected to the ESP using a header.

Alternatively connect a LED with a pull-up resistor to GPIO2 and toggle that in your code instead.