-
Notifications
You must be signed in to change notification settings - Fork 221
Updated ESP32 README.md installation instructions #155
Conversation
Some gotchas that I discovered while installing and flashing.
esp32/README.md
Outdated
```bash | ||
$ pip install pyserial | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the dependency on pyserial comes from the ESP IDF, since esptool.py uses it. So at the very least this paragraph should be in the section above about setting up the toolchain, but ideally it would already be part of the ESP IDF documentation (is it?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put this in based on where I've seen the error. I could get up to this point without having pyserial installed, but then make
for ESP32 threw an error. I can move it up to the ESP IDF if you prefer.
The ESP IDF docs do mention pyserial (http://esp-idf.readthedocs.io/en/latest/get-started/linux-setup.html?highlight=pyserial) but apt-get will just install for the system python (2.7 on my debian machine). If you're installing with a non-default python it doesn't help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do a pip install esptool
, which is what I'd recommend, it'll automatically pull pyserial in from pypi. Ditto if you do clone the repo and pip install -e esptool
...
However, the micropython-esp32/esp32/Makefile
calls esptool.py
by path straight from the esptool package, without installing it, so the usual python installation stuff doesn't get called and the deps don't get resolved.
Possible resolutions:
- Add instruction to run
pip install pyserial
so that dep will be installed from pypi. - Add instruction to run
pip install esptool
to install the whole thing from pypi - Add instruction to run
python $ESPIDF/components/esptool_py/esptool/setup.py install
to install from local tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can double check this, but I'm pretty sure that I didn't have esptool installed when I built and flashed my board at the sprints - just pyserial. Not sure what's going on there, maybe the build is using the one in the ESP IDF? If esptool is useful later on then it might still make sense to install it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, exactly, 'esptool' is a submodule so it's there in the file $ESPIDF/components/esptool_py/esptool/esptool.py
, and can just get run from there. Normally, though, you'd "install" it by running the setup.py, which would go get the dependencies as well. Because we're skipping that step though ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I worked it out, sorry for the confusion. I've updated the PR to remove pyserial and install esptool instead.
@@ -126,7 +138,7 @@ You can get a prompt via the serial port, via UART0, which is the same UART | |||
that is used for programming the firmware. The baudrate for the REPL is | |||
115200 and you can use a command such as: | |||
```bash | |||
$ picocom /dev/ttyUSB0 | |||
$ picocom -b 115200 /dev/ttyUSB0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it definitely needs the baudrate parameter here, thanks!
Changed pyserial to install esptool, moved it into the ESPIDF section.
Regarding the bit about pyserial: if you look at the ESP IDF instrutions for Linux at http://esp-idf.readthedocs.io/en/latest/get-started/linux-setup.html it does actually say that you need to install pyserial for the IDF to work. So, instead of adding this extra paragraph, I think it would be more appropriate to make it more explicit that one must follow all the ESP IDF instructions. |
Yes, they install it with this line: But if you're running a non-system/apt Python (eg. python 3.6 on debian like I am), then those instructions don't work: the default (2.7) Python will get pyserial instead, and the build will break. Maybe I could include an explicit "If you're running a non-system python then you might see this error ('can't import pyserial') and need to |
Yes, that's true, but in that case you already have a non-standard set up and would then hopefully know how to fix issues like missing Python libraries. Right? |
Hopefully. but it also looks possible if you're using apt python 3 (there's also a python3-serial). I just thought it better for the first build and install to be super clear with zero potential blockers if possible. |
Clarified the issues with Espressif's pyserial/esptool install instructions.
Thanks for updating the PR. Merged with very minor changes in 7a8be51 |
Some gotchas that I discovered while installing and flashing.