ESP8266-01 difference between flashing and running a program

Thread Starter

zazas321

Joined Nov 29, 2015
628
Hey. I am new to ESP8266 wifi module. My end goal is to be able to control a remote Xbee devices that is connected to Arduino. To control a device I would have to connect a relay and set a digital pins to high to turn on relay.

First of all, I want to do an ESP excersise to just simply control LED through a web server that is connected directly to one of the Arduino digital pins. I did some research and found that in order to use ESP8266 , it must be flashed. I have an FTDI serial to USB adapter that I am planning to use to flash my ESP8266.
https://www.iot-experiments.com/flashing-esp8266-esp01/. I use this website as A guide. So in order to flash ESP module, GPIO pin should be low, while the module is reseting.

There is one thing that I do not understand. What does 'flashing' actually mean? Do I just do it once or everytime I want to upload a new code?

Can i upload a code to my ESP8266 after I flash it with my ftdi adapter?
 

MrChips

Joined Oct 2, 2009
21,650
Every microcontroller requires program code. This is the set of instructions that makes the MCU do the job that it is asked to do.
"Flash" is a type of memory that is not lost when the power is turned off and on again.
"Flashing" refers to the process to put the program code into this special memory.
Once the code is in flash memory you can use the module without any need to reprogram the module.

The code that has been stored in the flash memory has the instructions to control the LED. Commands are transmitted to the ESP8266 to select when to turn on or off the LED. The on/off sequence is not in the ESP8266. The on/off commands are sent wirelessly to the ESP8266 from an external controller.

There is no need to upload more code once the initial code has been uploaded. This code is sometimes referred to as "firmware". The only reason for uploading new firmware is when you need to correct, fix, modify or upgrade the firmware.
 

Thread Starter

zazas321

Joined Nov 29, 2015
628
Thank you for your quick response. Let me clarify: First of all, I would connect my ESP8266 to an ftdi adapter and plug it into my PC. Then I would upload a code(pressing reset and GPIO buttons) to it to host a web server and set digital pin to high when button is clicked. Once I 'flash' the program, I can plug my FTDI adapter out of the PC and connect my ESP8266 to arduino instead. Now, as soon as I power the circuit, the ESP8266 will start running the code that I previously uploaded using FTDI?

What would happen if I press reset button and GPIO button again? Would it get rid off the code then? Or the only way to get rid off the code is to reprogram the module?
 

MrChips

Joined Oct 2, 2009
21,650
No. Pressing RESET button does not erase your code.
Pressing RESET has the same effect as unplugging the power and reapplying the power.
 

Thread Starter

zazas321

Joined Nov 29, 2015
628
So everytime I want to program my ESP8266 I have to program it through FTDI? Most tutorials I have seen online people use FTDI adapter to program it but very few use Arduino ? Why is that?
 

MrChips

Joined Oct 2, 2009
21,650
So everytime I want to program my ESP8266 I have to program it through FTDI? Most tutorials I have seen online people use FTDI adapter to program it but very few use Arduino ? Why is that?
I don't know. I have not used the ESP8266.
People will usually give examples of what they have done before and confirmed to work for them.
 
Top