ts100 soldering iron firmware written in Rust
- STM32F103T8U6
- OLED M00881
- Datasheet (pdf)
- SSD1306Z driver IC
- I²C address: 0x3c
- Accelerometer MMA8652FC
- Datasheet (pdf)
- I²C address: 0x1d
- TMP36GRTZ
- Datasheet (pdf)
- used for cold junction compensation for the thermocouple in the tip
- nice application note from TI on thermocouple and cold junction (pdf)
The SWD interface is exposed as 4 solder pads at the bottom of the CPU board.
- VCC (NC)
- GND (NC)
- SWCLK (blue wire)
- SWDIO (red wire)
I added a little bit of kapton tape in between the CPU and main board before assembling to minimize the damage if the solder connection breaks.
It's probably a good idea to backup the original firmware including the (horrible) bootloader. After connecting an ST-Link programmer you can use openocd to dump the flash.
Start openocd:
% openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg
Open On-Chip Debugger 0.9.0 (2017-03-07-13:28)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.245003
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Dump the firmware:
% telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> dump_image ts100_orig.bin 0x08000000 0xffff
dumped 65535 bytes in 1.386794s (46.149 KiB/s)
>
- Rust nighly
- OpenOCD
- GNU ld
- GDB
- Xargo
% rustup default nightly
% rustc -V
rustc 1.21.0-nightly (f774bced5 2017-08-12)
% sudo apt-get install binutils-arm-none-eabi gdb-arm-none-eabi openocd
% arm-none-eabi-ld -V | head -n1
GNU ld (2.28-5+9+b3) 2.28
% arm-none-eabi-gdb -v | head -n1
GNU gdb (7.12-6+9+b2) 7.12.0.20161007-git
% openocd -v 2>&1 | head -n1
Open On-Chip Debugger 0.9.0 (2017-03-07-13:28)
% cargo install xargo
% xargo -V
xargo 0.3.8
cargo 0.22.0-nightly (7704f7b1f 2017-08-09)
% rustup component add rust-src
% git clone https://github.com/wose/ts100.git
% cd ts100/firmware
% xargo build --release
Connect the soldering iron to the ST-Link programmer and start openocd
:
% openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg
Start gdb
in another terminal. The included .gdbinit will
connect to openocd and flash the chip when gdb
is started.
% arm-none-eabi-gdb target/thumbv7m-none-eabi/release/firmware
Licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.