/SCAN2000_STM32_Firmware

The firmware for the STM32 microcotroller of the SCAN2000 v1.x replacement card

Primary LanguageCGNU General Public License v3.0GPL-3.0

Build firmware

Keithley SCAN2000 STM32 SSR Replacement Firmware

This repository contains the firmware for the Keithley SCAN2000 STM32 SSR replacement PCB found here. Do note, this firmware only works with the 1.x revision of the PCB that uses an STM32 microcontroller.

Contents

Description

The source code is based on the project by George Christidis. It uses CubeMX instead and it makes use of the STM32 HAL labraries instead of the low-level libraries. It can be built using a Makefile.

Installation

Two options to upload the firmware are detailed below. One uses the STM32CubeProgrammer programmer with a GUI and is provided by ST. The other option uses the open souce toolkit stlink and does the upload via the command line. The latter is recommended and simpler to use when building the binaries from the sources because both compiling and uploading can be done via the same Makefile script.

STM32CubeProgrammer

To flash the SMT32G0, I use an ST-Link programmer along with STM32CubeProgrammer.

To flash the firmware to the microcontroller do the following:

  1. If you want to build the firmare from its sources, you will need the gcc-arm-none-eabi compiler. Using Ubuntu, this can be done via apt.
sudo apt install gcc-arm-none-eabi
  1. Open a terminal and go to the source code folder. Compile the code using the Makefile. In Linux type
make

Alternatively use the pre-compiled firmware found here.

  1. Power the MCU via the 5V pin. It should draw about 40 mA @ 5V and the Power led should be lit.
  2. Connect the ST-link programmer via the header provided on the PCB.
  3. Open STM32CubeProgrammer and press connect
  4. Now open load the .hex file and press download. STM32CubeProgrammer should report success and the board current should now drop to < 10 mA.
  5. In the STM32CubeProgrammer window press disconnect. The board power typically increases by 1 mA.
  6. Disconnect the ST-Link.
  7. Reset the MCU. The Activity led now should flash three times to signal a successful boot. The board should now draw about 13-15 mA during idle and only the power LED should be lit.

stlink

Alternatively, you can use the open souce toolkit stlink which also requires the ST-Link programmer, but programming can be done from the CLI.

  1. If you want to build the firmare from its sources, you will need the gcc-arm-none-eabi compiler. Using Ubuntu, this can be done via apt.
sudo apt install gcc-arm-none-eabi stlink-tools
  1. Open a terminal and go to the source code folder. Compile the code using the Makefile. In Linux type
make
  1. Power the MCU via the 5V pin. It should draw about 40 mA @ 5V and the Power led should be lit.
  2. Connect the ST-link programmer via the header provided on the PCB.
  3. Open a terminal and go to the source code folder. Type
make upload

The Activity led should now flash three times to signal a successful boot.

  1. Disconnect the ST-Link.
  2. The board should now draw about 13-15 mA during idle and only the power LED should be lit.

Compiled Binaries

A compiled version can be found on the the releases page.

Debugging

If you want to read back what the MCU is doing, hook up a TTL to USB converter to the TX and GND pins. I use a Waveshare Industrial USB TO TTL Converter, but any of the cheap Ebay FT232RL modules works. The parameters are 115200 baud, 8 bits, no parity, 1 stop bit.

To configure a Linux tty, type the following commands. Do make sure to change the tty to your tty. This example uses /dev/ttyUSB5.

stty -F /dev/ttyUSB5 115200 cs8 -cstopb -parenb echo -echoe -echok -echoctl -igncr -icanon

Related Repositories

See the following repositories for more information

Keithley SCAN2000 Hardware: https://github.com/PatrickBaus/SCAN2000/tree/1.1.1

Versioning

I use SemVer for versioning. For the versions available, see the tags available for this repository.

  • MAJOR versions in this context mean a breaking change to the external interface like changed commands or functions.
  • MINOR versions contain changes that only affect the inner workings of the software, but otherwise the performance is unaffected.
  • PATCH versions do not add, remove or change any features. They contain small changes like fixed typos.

License

This project is licensed under the GPL v3 license - see the LICENSE file for details