summaryrefslogtreecommitdiff
path: root/how_to_flash_lolin_nodemcu_v3.html
blob: 609753114903af59c909a3682aeca1fb213d6e89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="author" content="aki">
<meta name="tags" content="tutorial, flash, nodemcu, firmware, nodemcu">
<meta name="published-on" content="2020-06-29T17:58:00+02:00">
<meta name="last-modified-on" content="2023-01-06T17:55:00+01:00">
<link rel="icon" type="image/png" href="favicon.png">
<link rel="stylesheet" type="text/css" href="style.css">

<title>How to Flash LOLin NodeMCU v3</title>

<header>
<nav><a href="https://ignore.pl">ignore.pl</a></nav>
<time>29 June 2020</time>
<h1>How to Flash LOLin NodeMCU v3</h1>
</header>

<article>
<p>Republishing old content. This is from when I bought and flashed my first NodeMCU clone (perhaps "loose
implementation"?) of NodeMCU v3 called LOLin v3.
<p>This little board is using CH340 TTL to USB converter, so if you happen to work on Windows you must make sure you
have the driver installed beforehand. Mentioned chip is quite common, and I've seen it on various Arduino, so there is
a high chance that you already have it.
<p>Without further notes, here is the specification:</p>
<table>
<tr><th>Baud rate<th>Flash mode<th>Flash size<th>Flash frequency
<tr><td>9600     <td>QIO       <td>4MiB      <td>40MHz
</table>
<p>You will need a combined firmware binary. If you are compiling it by yourself, I suggest using one of the development
branches. If you don't have environment set up there are online building services available e.g.
<a href="https://nodemcu-build.com/">NodeMCU custom builds</a>.
<p>To write the firmware use e.g. <a href="https://github.com/espressif/esptool">esptool</a>:</p>
<pre>
$ esptool.py --port <u>/dev/ttyUSB0</u> --baud 9600 erase_flash
$ esptool.py --port <u>/dev/ttyUSB0</u> --baud 9600 write_flash \
  --flash_mode qio --flash_size 4MB --flash_freq 40m \
  0x00000 <u>combined-firmware-file.bin</u>
</pre>
<p>To test it you can connect to it with e.g. <code>screen</code>:</p>
<pre>
$ screen <u>/dev/ttyUSB0</u> 115200
</pre>
<p>Or use your favourite terminal emulator:</p>
<pre>
$ st -l <u>/dev/ttyUSB0</u> 115200
</pre>
<img src="how_to_flash_lolin_nodemcu_v3-1.png" alt="nodemcu drawing">
<p>In case the device does not appear. Check whether appropriate module (usually ch341) is loaded with:
<pre>
$ lsmod | grep -i ch34.
ch341                  28672  0
</pre>
<p>To check if it was compiled:
<pre>
$ zgrep -i CH34. /proc/config.gz
CONFIG_USB_SERIAL_CH341=m
</pre>
<p>If you want a non-root user to be able to flash and use it, assign system appropriate group. Usually it's
<u>serial</u> but it is not a requirement. You can check what group user needs by simply looking at the file
permissions:
<pre>
$ ls -l <u>/dev/ttyUSB0</u>
crw-rw---- 1 root <b>uucp</b> 188, 0 Jan  6 17:16 /dev/ttyUSB0
$ sudo usermod -aG <u>uucp</u> <u>user</u>
</pre>
<p>If flashing fails with <code>Write timeout</code>, you can try tweaking baud rate.
</article>
<script src="https://stats.ignore.pl/track.js"></script>