Hardware design for test device
datasheets - all the datasheets for parts used
docs - documents about this project
firmware - the code for testing and supporting the hardware
hardware - the schematics and PCB designs
models - Contains 3D models for project
photos - image from the project as it progresses
productions - files used for manufacturing that are generated from the stuff in hardware
The Firmware is split into 4 categories. Management, User Interface, Security, and Network.
The management chip is responsible for uploading firmware to the stm32 - main chip and the esp32 network chip using a ch340 usb chip.
The management chip receives commands from the usb communication that informs it what chip we are currently uploading.
ui
chip and then net
chip. Accepts commands.ui
chip upload mode. (STM32f05)net
chip upload mode. (ESP32S3)ui
and network chips are transmitted back to the usb interface. This is uni-directional from the management chip to the computer. However, all commands work during this mode. In the future sending messages to the ui
and net
chip will be supportedui
chip.net
chip.ui
chip into normal mode, holds the net
chip in reset mode, and allows for serial communication to the ui
chip.net
chip into normal mode, holds the ui
chip in reset mode, and allows for serial communication to the net
chip.The User Interface chip is where most of the processing takes place. It utilizes a STM32F405 chip empowered by the STM HAL Library. To generate the baseline HAL Library code and Makefile, ST's CubeMX was used.
Target Overview
all
- Builds the target bin, elf, and binary files and uploads the code to the User Interface chip. Output firmware/build/ui
compile
- Builds the target bin, elf, and binary. Output firmware/build/ui
upload
- Uploads the build target to the User Interface chip using the STM32_Programmer_CLI with serial usb-c uploading. See Installation for instructions on installing the STM32_Programmer_CLI.
upload_swd
- Uploads the build target to the User Interface chip using the STM32_Programmer_CLI with swd uploading. See Installation for instructions on installing the STM32_Programmer_CLI.
program
- Runs the compile target, then the upload target.
monitor
- Opens a serial communication line with the management chip in debug mode using screen.
py_monitor
- Opens a serial communication line with the management chip with a python script that allows for sending of commands.
openocd
- Opens a openocd debugging instance. See Installation for instructions on installing openocd.
info
- Displays the build path, include files, object files, dependencies and vpaths used by the compiler.
dirs
- Makes all directories required for by the Makefile to compile and upload.
clean
- Deletes the firmware/build/ui directory.
Source code
All source code for the User Interface can be found in firmware/ui and firmware/shared_inc. Adding C/C++ files in firmware/ui/src and firmware/ui/inc does not require any changes in the makefile.
Making a shared header between chips should be added into firmware/shared_inc.
At any point if you're including or using any additional STM32 HAL library files such as stm32f4xx_hal_sd.h
then you must add the respective source file stm32f4xx_hal_sd.c
to HAL C Sources line ~50 in firmware/ui/Makefile.
Additionally, any new Assembly source files need to be added to the ASM sources line ~77 in firmware/ui/Makefile.
The network chip is responsible for all communications between servers and the entire board. The network chip communicates with the UI chip via UART serial communication.
We are leveraging the esp-idf framework.
Target Overview
all
- Runs the compile
and upload
targets.
compile
- Compiles the net code using the command idf.py compile
upload
- Uploads the net code by first sending a command to the mgmt chip to put the board into net upload mode. Then uses esptool.py upload
program
- Runs the compile target, then the upload target.
monitor
- Opens a serial communication line with the management chip in debug mode using screen.
py_monitor
- Opens a serial communication line with the management chip with a python script that allows for sending of commands.
clean
- Deletes the firmware/net/build directory.
Source code
All source code for the network chip can be found in firmware/net
and firmware/shared_inc
.
WIP
Very basic server that echo's the message it receives.
Located in firmware/tools
Requirements
pip install py_serial
This monitor can be used by the following command:
python monitor.py \[port] \[baudrate]
ex.
python monitor.py /dev/ttyUSB0 115200
The following tools are used for Management and User Interface.
Make [required]
Make is used for compiling and uploading automation for each chip firmware.
Debian
sudo apt install make
Windows
Download make.exe from Source Forge
Save it to C:/bin or where-ever you want it. Then add the location to the your path.
Open the start search, and type env
. Select "Edit the system environment variables"
Click "Environmental Variables..."
Under "System Variables"
find the "Path"
entry, click "Edit..."
button.
Click the "New"
button and enter DRIVE:\path\to\make_location
You may need to restart your system after changing your system path.
MacOS
brew install make
ARM GNU Toolchain [required]
Debian
sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi
Windows
MacOS
STM32 Programmer CLI [required]
The STM32 Programmer CLI comes packages with the STM32 Cube Programmer. You'll need to download and install The STM32 Cube Programmer and add the STM32_Programmer_CLI binary to your path.
https://www.st.com/en/development-tools/stm32cubeprog.html
Debian
Open your .bashrc
file:
sudo nano ~/.bashrc
Add the following line to the .bashrc
file
export PATH="$PATH:/path/to/stm_cube_programmer/bin"
NOTE - If you are getting an error saying that libusb needs permission to write usb, then you'll need to do an additional step.
/path/to/stm_cube_programmer/Drivers/rules
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", SYSFS{idVendor}=="3748", \
MODE="0666", \
GROUP="plugdev"
cp /path/to/stm_cube_programmer/Drivers/rules/*.* /etc/udev/rules.d/
Windows
Open the start search, and type env
. Select "Edit the system environment variables"
Click "Environmental Variables..."
Under "System Variables"
find the "Path"
entry, click "Edit..."
button.
Click the "New"
button and enter DRIVE:\path\to\stm_cube_programmer\bin
You may need to restart your system after changing your system path.
MacOS
OpenOCD [optional]
Open On Chip Debugger, created by Dominic Rath, is a debugging software that can be used with micro-controllers to run debugging tools and stepping through code.
Debian
Run the following command:
sudo apt install openocd gdb-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
If you don't have python3.8 installed, which is used for arm-none-eabi-gdb, then you'll need to install it
sudo add-apt-repository ppa:deadsnakes/ppa
apt update
sudo apt install python3.8
Windows
Download the appropriate zip for your system https://openocd.org/pages/getting-openocd.html
Open the start search, and type env
. Select "Edit the system environment variables"
Click "Environmental Variables..."
Under "System Variables"
find the "Path"
entry, click "Edit..."
button.
Click the "New"
button and enter DRIVE:\path\to\openocd\bin
You may need to restart your system after changing your system path.
MacOS
Run the following commands in a terminal to install openocd
brew update
brew install open-ocd --HEAD
This project leverages the usage of the Arduino Library for the network chip.
The following tools are used for the Network.
Make [required]
Make is used for compiling and uploading automation for each chip firmware.
Debian
sudo apt install make
Windows
Download make.exe from Source Forge
Save it to C:/bin or where-ever you want it. Then add the location to the your path.
Open the start search, and type env
. Select "Edit the system environment variables"
Click "Environmental Variables..."
Under "System Variables"
find the "Path"
entry, click "Edit..."
button.
Click the "New"
button and enter DRIVE:\path\to\make_location
You may need to restart your system after changing your system path.
MacOS
brew install make
esp-idf [required]
Debian
Windows
MacOS