[SOLVED]Issues running on ESP8266MOD(NODEMCU board)

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
MostlyHarmless
Posts: 163
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by MostlyHarmless » Fri Dec 06, 2019 9:53 pm

dps wrote:
Fri Dec 06, 2019 9:11 pm
hmm, whenever i try to erase the flash, it tells me that its not supported. Here is the output:

Code: Select all

┌─[✗]─[dps@silversurfer]─[~]
└──╼ $esptool --port /dev/ttyUSB0 erase_flash
esptool.py v2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Enabling default SPI flash mode...
Erasing flash (this may take a while)...

A fatal error occurred: ESP8266 ROM does not support function erase_flash.
That doesn't look right. I get:

Code: Select all

(venv36) [wieck@jupiter ~]$ esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 2c:f4:32:3c:b3:ce
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 9.7s
Hard resetting via RTS pin...
(venv36) [wieck@jupiter ~]$ 
Definitely different chip types, but any chance you could update your esptool to version 2.8? Your version looks a bit dated.


Regards, Jan

User avatar
dps
Posts: 51
Joined: Mon Oct 28, 2019 9:37 pm

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by dps » Fri Dec 06, 2019 10:12 pm

hmm, ill try. I havent learned how to use Python on Linux yet, and when ive tried to use it i guess i was using packages that conflicted with each other and.... yeah, it was all messed up. so I ended up just using the esptool that is packaged in the standard Ubuntu repos. Ill see if i can get a backport from a newer release of Ubuntu, and install it like that

User avatar
dps
Posts: 51
Joined: Mon Oct 28, 2019 9:37 pm

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by dps » Fri Dec 06, 2019 10:14 pm

when installing something on Linux with pip or pip3, which should i use and should i use the --user flag, and would that solve the package conflicts? or should i try to figure out how to setup a virtual env of some kind, and install this all in that?

User avatar
MostlyHarmless
Posts: 163
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by MostlyHarmless » Fri Dec 06, 2019 10:29 pm

Virtualenv all the way. As you can see from my prompt in the quoted output I did that in my Python 3.6 environment. CentOS 7 still uses Python 2.7 as system default.

When setup right virtualenv lets you easily switch between Python versions per terminal.

User avatar
dps
Posts: 51
Joined: Mon Oct 28, 2019 9:37 pm

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by dps » Fri Dec 06, 2019 10:31 pm

alright just did it, with 3.6. created a test env and activated it. so if i install esptool.py here, would i always have to be in this directory to use it, and with the env activated?

User avatar
dps
Posts: 51
Joined: Mon Oct 28, 2019 9:37 pm

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by dps » Fri Dec 06, 2019 10:35 pm

Hey! check it out! erasing the flash worked! so i guess the idea for me is, ill just use this env for uPython, and create others as need when i learn more about python in general. now, lets see if the firmware being upload with this new (2.8) version of esptool. brb

User avatar
dps
Posts: 51
Joined: Mon Oct 28, 2019 9:37 pm

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by dps » Fri Dec 06, 2019 10:38 pm

it works! Nice! thank you man! So, i guess the solution (for anyone looking for it) is to erase the flash first, and then upload. If youre having trouble erasing your flash, try updating your esptool to a newer version!

Ciao!

User avatar
MostlyHarmless
Posts: 163
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by MostlyHarmless » Fri Dec 06, 2019 10:44 pm

dps wrote:
Fri Dec 06, 2019 10:31 pm
alright just did it, with 3.6. created a test env and activated it. so if i install esptool.py here, would i always have to be in this directory to use it, and with the env activated?
Sourcing the <venv-name>/bin/activate changes your $PATH and other environment variables. Your working directory doesn't matter, you are always using that venv from there on in that terminal. You can have multiple terminals open, each using a different venv and Python version at the same time.

What you should NOT do from there on is cut+paste stuff that does "sudo pip blah ...", because that will still hit your system globals. Since you are in a Python virtual env, that lives inside your $HOME, you have permission to use pip install to install stuff in that venv. The whole point of virtual envs is that any unprivileged user can have as many as they want, and that each of them can contain a different set of Python packages installed in different versions, using a different version of Python.


Regards, Jan

User avatar
MostlyHarmless
Posts: 163
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by MostlyHarmless » Fri Dec 06, 2019 10:47 pm

dps wrote:
Fri Dec 06, 2019 10:38 pm
it works!
Magic! 8-)

User avatar
MostlyHarmless
Posts: 163
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: Issues running on ESP8266MOD(NODEMCU board)

Post by MostlyHarmless » Fri Dec 06, 2019 10:57 pm

dps wrote:
Fri Dec 06, 2019 10:38 pm
So, i guess the solution (for anyone looking for it) is to erase the flash first, and then upload.
Keep in mind that erase_flash also erases what is on the filesystem. Any uploaded files (boot.py, main.py, whatever.py) will be gone. Any files created by your firmware will be gone.

In other words, you do not want to make erase+flash your standard procedure. The micropython build system (at least for esp8266 and esp32) has separate build targets "erase" and "deploy" for that reason.


Regards, Jan

Post Reply