This project contains all the control code for the QRET propulsion sub team's static hot fire setup.
This project is intended to be opened in VSCode. When you first open the project, install the recommended extensions that pop up in the bottom right.
To run this project you should be running Python3.11.x, with an isolated virtual environment. See python docs for help setting up a virtual environment.
To install all the required packages to work as a developer on this code, run: pip install -e .
in the ./prop-teststand directory. This installs the listed requirements in the pyproject.toml file.
The boards that have been currently purchased for the PROP stand are ESP32-S3 boards with the N16R8 chip on them. They are technically listed as ESP32-S3-DevKitC1s (a dev kit made by Espressif), but we bought cheap clones of these off of amazon. The link we bought them from is here. The N16R8 chip has 16MB of flash and 8MB of Pseudo Static RAM (PSRAM) with the ram configured as Octal SPI RAM (OSRAM) allowing higher data transfer rates then other SPI formats (QSPI, or SPI).
The current plan for this project is to have it operate in Micropython. This may change as we test out our final installation but this is the quickest way to get the code running right now. The steps are as follows:
- Download the generic ESP32S3 Octal SPIRAM binary file (.bin) from the official micropython site for the ESP32. As of writing this, the most recent version is ESP32_GENERIC_S3-SPIRAM_OCT-20241025-v1.24.0.bin
- This generic build only has flash size configured for 8MB. Since we are using a chip with 16MB flash, we need to update the build. To do this, use the mp-image-tool-esp32 library (install with:
pip install mp-image-tool-esp32
) and run the following command:mp-image-tool-esp32 .\ESP32_GENERIC_S3-SPIRAM_OCT-20241025-v1.24.0.bin -f 16M --resize vfs=0
This will re-configure the micropython build to accept 16MB of flash and resize vfs to account for our chip - Install the esptool python library (
pip install esptool
) to be able to flash firmware to the ESP32. - Plug in your ESP32 and put the board into boot mode by pressing and holding the boot button (button closest to USBC ports) and pressing the reset button (button closest to heat spreader) once.
- Check the port the device connected to. It will appear as a USB serial device. Run the command "
esptool --port COMXX erase_flash
", where COMXX is something like COM3, to clear out whatever is currently in flash. - Run the command "
esptool --chip esp32s3 --port COMXX write_flash -z 0 . FILEPATH.bin
" where COMXX is the COM port the device is connected to and FILEPATH is the path to the micropython image with the updated flash memory. The-z
option tells the command to not try and detect the flash chip as we've already specified the size and the0
parameter tells the script to start writing at the 0x0000 memory address (as specified in the official ESP32s3 micropython setup documentation) - IMPORTANT: Press the reset button on the board (button closest to the big metal heat spreader on our boards) to pull the board out of boot mode and into its normal operational mode. When you do this, the COM port the device is assigned to will most likely change (e.g. COM3 for the memory flashing and COM4 in normal operation).
- In the REPL for the ESP32 run
import esp
thenesp.flash_size()
. You should see something around 16777216 as the return value. This means you installed the correct 16MB flash image.
The best tool to work with micropython that I've found is mpremote
. This library is one of the developer requirements for this project and should be installed correctly if you followed through the environment setup above.
Some useful micropython commands:
Command | Description |
---|---|
mpremote |
Connects to first available serial device and opens REPL by default. Equivalent to "mpremote |
mpremote connect port:COMXX |
Connects to serial device on specified com port. Shorthand is "mpremote cXX |
mpremote run <file.py> |
Runs a script from your computer's filesystem. Prints any output to outside terminal. |
mpremote fs |
Prefix to give access to filesystem management commands |
mpremote fs ls |
Lists files currently in the root directory of the microcontroller |
mpremote fs cp <localFile> : |
Copies local file into the root directory of the microcontroller |
The full documentation on using mpremote can be found here