diff --git a/basics/README.md b/basics/README.md index f26089c..4a54242 100644 --- a/basics/README.md +++ b/basics/README.md @@ -2,50 +2,12 @@ The first `boot.py` will be executed when the interpreter starts. This file should contain only code associated with configuration. Then `main.py` will run. It is within this `main.py` that you will place your entry point code. -## Setting the AMPY_PORT variable. - -All of the commands below specify a serial port in their execution. We can use the `AMPY_PORT` environmental variable in our terminal session to avoid having to specify this port everytime. - -``` -export AMPY_PORT=/dev/cu.SLAB_USBtoUART -``` - -## Uploading files with Ampy - -First review the list of commands that the `ampy` tool provides. - -``` -ampy --help -``` -We can view the contents of the current file system: - -``` -ampy --port /serial/port ls -``` - -We can execute a command immediately on a connected board: - -``` -ampy --port /serial/port run test.py -``` - -We can also upload the code directly to the board. Notice we are passing the upload path after the file in our current directory. So, this command is placing our test.py file on the board in a file under the root dir named `main.py`. -``` -ampy --port /serial/port run test.py /main.py -``` - -We can pull the file from the board to our current working directory if we'd like so: - -``` -ampy --port /serial/port get main.py ./dirp.py -``` - - ## Connecting to a micropython board using screen on a Mac ``` screen /dev/cu.SLAB_USBtoUART 115200 ``` + To detach from a screen session first press `Ctrl-A` then `Ctrl-D`. To resume a detach session use: @@ -65,7 +27,7 @@ import gc import os def df(): - + s = os.statvfs('//') return ('{0} MB'.format((s[0]*s[3])/1048576)) @@ -88,15 +50,19 @@ esptool.py --port /dev/cu.SLAB_USBtoUART erase_flash ``` For an ESP32-S3 + ``` esptool.py --chip esp32-s3 --port /dev/cu.SLAB_USBtoUART erase_flash ``` + 2. If you have external spi ram (4MB) you want to use the spiram bin. + ``` esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 460800 write_flash -z 0x1000 ./binaries/esp32-idf4-20210202-v1.14.bin ``` For an ESP32-S3 + ``` esptool.py --chip esp32-s3 --port /dev/cu.SLAB_USBtoUART --baud 460800 write_flash -z 0x0000 ./binaries/GENERIC_S3_SPIRAM-20220117-v1.18.bin ```