<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>flash &#8211; Squix &#8211; TechBlog</title>
	<atom:link href="https://blog.squix.org/tag/flash/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.squix.org</link>
	<description></description>
	<lastBuildDate>Thu, 09 Dec 2021 08:14:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.8</generator>
<site xmlns="com-wordpress:feed-additions:1">121913304</site>	<item>
		<title>ESP8266: flashing the lua firmware and running some code</title>
		<link>https://blog.squix.org/2014/12/esp8266-flashing-lua-firmware-and.html</link>
					<comments>https://blog.squix.org/2014/12/esp8266-flashing-lua-firmware-and.html#respond</comments>
		
		<dc:creator><![CDATA[Daniel Eichhorn]]></dc:creator>
		<pubDate>Sun, 07 Dec 2014 12:22:00 +0000</pubDate>
				<category><![CDATA[Common]]></category>
		<category><![CDATA[ESP8266]]></category>
		<category><![CDATA[esptool]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[lua]]></category>
		<guid isPermaLink="false">http://blog.squix.org/2014/12/07/esp8266-flashing-lua-firmware-and/</guid>

					<description><![CDATA[After you setup your ESP8266 module as described here you can go on and write Arduino code that talks to the ESP8266 or even flash new firmware directly on the device. Someone has put together a firmware which allows you to send lua code to the ... <p><a class="read-more btn btn-secondary" href="https://blog.squix.org/2014/12/esp8266-flashing-lua-firmware-and.html">Read More</a></p>]]></description>
										<content:encoded><![CDATA[<div dir="ltr" style="text-align: left;">After you setup your ESP8266 module as described <a href="https://blog.squix.org/2014/12/esp8266-using-seeeduino-to-talk-to.html">here</a> you can go on and write Arduino code that talks to the ESP8266 or even flash new firmware directly on the device. Someone has put together a firmware which allows you to send <a href="http://www.lua.org/start.html">lua</a> code to the module and run it through the serial console. This is a nice way to get started with programming the module directly instead of using an Arduino intermediary. This post describes how you can flash a new firmware on the module.</p>
<h3 style="text-align: left;">Getting the wiring right</h3>
<div class="separator" style="clear: both; text-align: center;"><a style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;" href="https://i0.wp.com/blog.squix.org/wp-content/uploads/2014/12/ESP8266_pinout.png?ssl=1"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/blog.squix.org/wp-content/uploads/2014/12/ESP8266_pinout.png?w=730&#038;ssl=1" border="0" /></a></div>
<div>Make sure you already have the wires setup as described in the previous <a href="https://blog.squix.org/2014/12/esp8266-using-seeeduino-to-talk-to.html">post</a>. Now the module needs to be put in a ready-to-flash-firmware state.</div>
<div>
<ol style="text-align: left;">
<li>Add a wire between GPIO0 pin and the Ground pin (GND)</li>
<li>Now reset the module be quickly connecting the RST pin to the GND pin (in my case the blue LED flashes quickly)</li>
</ol>
</div>
<h3 style="text-align: left;">Getting the flash tool ready</h3>
<div>In order to write new firmware to the module you&#8217;ll need to use a tool, the serial console isn&#8217;t helpful in this case.</div>
<div>
<ol style="text-align: left;">
<li>Download the esptool.py from <a href="https://github.com/themadinventor/esptool">here</a>.</li>
<li>Make it executable and run it with ./esptool.py &#8211;help. On my Mac OS X machine I got an error, that the serial library is nowhere to be found. Because of this I had to
<ol>
<li>
<div class="p1">
<pre>brew install python</pre>
</div>
</li>
<li>
<pre>pip install pyserial
</pre>
</li>
<li>make sure that you will use the python installed by brew</li>
</ol>
</li>
<li>Download the lua firmware from <a href="https://github.com/nodemcu/nodemcu-firmware/tree/master/0.9.2/512k-flash">here</a> (the nodemcu_512k.bin file)</li>
<li>Find out the port your FTDI controller or your Seeeduino is connected to. In my case I used the Arduino IDE to find the port and make sure no console is currently connected to the Arduino</li>
<li>Replace tty.usbserial-A901LKQM with your actual com-port
<pre>esptool.py --port /dev/tty.usbserial-A901LKQM write_flash 0x000000 nodemcu_512k.bin</pre>
</li>
<li>Remove the connection between GPIO0 and GND</li>
<li>Reset the module again by connecting RST quickly to GND</li>
</ol>
</div>
<div>
<h3 style="text-align: left;">Running Lua examples on the module</h3>
</div>
<div>
<ol style="text-align: left;">
<li>Open a serial console and connect it with your Arduino or FTDI controller. I opened the console in the Arduino IDE and set the baud rate to <b>9600</b></li>
<li>Run enter this Lua code into the console (you may have to enter it line by line):
<pre>print(wifi.sta.getip())
--0.0.0.0
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","password")
print(wifi.sta.getip())
--192.168.18.110
</pre>
</li>
<li>Run more examples from <a href="https://github.com/nodemcu/nodemcu-firmware#start-play">here</a></li>
</ol>
<h3 style="text-align: left;">Update 2015-01-04</h3>
</div>
<div>I had some problems with the stability of the ESP8266 chip. It would reboot randomly and quite soon I suspected the power supply. After I switched from the Seeeduino 3.3V power to this power supply, those problems went away:</div>
<div><a href="https://www.banggood.com/MB102-2-Channel-3_3V-5V-Breadboard-Power-Supply-Module-White-Breadboard-Dedicated-Power-Module-MB-102-Solderless-Bread-Board-p-1524894.html?p=0P21061109440201501M" target="_parent" rel="noopener"><img data-recalc-dims="1" fetchpriority="high" decoding="async" src="https://i0.wp.com/i00.i.aliimg.com/wsphoto/v0/1718017194_1/Special-promotions-1lot-MB102-Breadboard-Power-Supply-Module-3-3V-5V-830-Tie-Point-Breadboard-Excellent.jpg_220x220.jpg?resize=283%2C320" width="283" height="320" />Breadboard Power Supply Module 3.3V/5V</a></div>
<h3 style="text-align: left;">Links</h3>
<div>
<ul style="text-align: left;">
<li><a href="http://playground.boxtec.ch/doku.php/wireless/esp8266">How to use the esptool to write firmware</a></li>
<li><a href="https://github.com/themadinventor/esptool">esptool</a> for flashing firmware</li>
<li><a href="https://github.com/nodemcu/nodemcu-firmware#start-play">Lua Examples</a></li>
<li><a href="https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en">Available commands</a></li>
</ul>
</div>
</div>
<div>Advertisement:</div>
<div>
<p><a href="http://s.click.aliexpress.com/e/VR72vzrbI" target="_parent" rel="noopener"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/i00.i.aliimg.com/wsphoto/v0/2030821422/-font-b-ESP8266-b-font-font-b-Serial-b-font-font-b-Port-b-font.jpg_220x220.jpg?w=730" />ESP8266 Serial Port WIFI</a></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.squix.org/2014/12/esp8266-flashing-lua-firmware-and.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">75</post-id>	</item>
	</channel>
</rss>
