Skip to content

Commit

Permalink
upy in esp32
Browse files Browse the repository at this point in the history
  • Loading branch information
sasilva1998 committed Dec 23, 2019
1 parent f237ae7 commit 5cdfdba
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
Binary file added esp32-idf4-20191220-v1.12.bin
Binary file not shown.
122 changes: 122 additions & 0 deletions install_upy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Flashing MicroPython in esp32 \n",
"\n",
"In order to get MicroPython in esp32 it is needed to have python installed and a package called esptool, which can be installed by using the following command: `sudo pip3 install esptool`. \n",
"\n",
"If esptool is already installed, first it is needed to `erase_flash` the esp32 with esptool in case the microcontroller already had another firmware inside, ere you have to specify the port in which you esp32 is, in my case it would be `/dev/ttyUSB0`."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"esptool.py v2.6\n",
"Serial port /dev/ttyUSB0\n",
"Connecting....\n",
"Chip is ESP32D0WDQ6 (revision 1)\n",
"Features: WiFi, BT, Dual Core, Coding Scheme None\n",
"MAC: 30:ae:a4:0f:65:b8\n",
"Uploading stub...\n",
"Running stub...\n",
"Stub running...\n",
"Erasing flash (this may take a while)...\n",
"Chip erase completed successfully in 0.6s\n",
"Hard resetting via RTS pin...\n"
]
}
],
"source": [
"!esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Once it is clean inside of any firmware, you can begin to flash uPy. For that you must have downloaded the esp32 firmware from [MicroPython main page](micropython.org). In the last part of the command, the location of the firmware must be specified, in this case the firmware taken is in the same place as this notebook and we are flashing 1.12 version of uPy."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"esptool.py v2.6\n",
"Serial port /dev/ttyUSB0\n",
"Connecting....\n",
"Chip is ESP32D0WDQ6 (revision 1)\n",
"Features: WiFi, BT, Dual Core, Coding Scheme None\n",
"MAC: 30:ae:a4:0f:65:b8\n",
"Uploading stub...\n",
"Running stub...\n",
"Stub running...\n",
"Changing baud rate to 460800\n",
"Changed.\n",
"Configuring flash size...\n",
"Auto-detected Flash size: 4MB\n",
"Compressed 1408512 bytes to 894711...\n",
"Wrote 1408512 bytes (894711 compressed) at 0x00001000 in 20.4 seconds (effective 552.8 kbit/s)...\n",
"Hash of data verified.\n",
"\n",
"Leaving...\n",
"Hard resetting via RTS pin...\n"
]
}
],
"source": [
"!esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 esp32-idf4-20191220-v1.12.bin"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If everything returned is the same as this notebook, then you are all set and ready to program with uPy! If what you have is a esp8266, you should use one of the following commands:\n",
"- `esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20170108-v1.8.7.bin`\n",
"- `esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect -fm dio 0 esp8266-20170108-v1.8.7.bin`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit 5cdfdba

Please sign in to comment.