STM32duino - joric/ts80player GitHub Wiki

This is the official STM32 Arduino platform, the easiest way to start. And it works with TS80!

Setup

Add this URL to File-Preferences-Additional Boards Manager URL (separate URLs with a comma):

Then search for "stm" in the Boards Manager and install "STM32 Cores".

IDE Settings:

  • Board: "Generic STM32F1 Series"
  • Board part number: "Generic F103T8"
  • Upload method: "Maple DFU Bootloader 2.0"

Display works as 128x64 i2c with standard Adafruit_SSD1306 samples without any changes. You just need to install Adafruit_GFX and Adafruit_SSD1306 libraries.

Bootloader settings

These settings are mostly for TS80 and the default TS80 bootloader. If you don't have TS80 you may download the bootloader here: TS80-Bootloader.hex and flash to the STM32 development board of your choice. This bootloader only accepts .hex files with user code starting from 0x4000. To jump to bootloader, connect pin B1 to ground and power cycle the board.

Edit %LOCALAPPDATA%\Arduino15\packages\STM32\hardware\stm32\1.9.0\boards.txt:

build.preferred_out_format=hex

Edit %LOCALAPPDATA%\Arduino15\packages\STM32\hardware\stm32\1.9.0\platform.txt:

GenF1.menu.upload_method.dfu2Method.build.flash_offset=0x4000
tools.maple_upload.upload.pattern="{path}/{cmd}" {serial.port.file} {upload.altID} {upload.usbID} "{build.path}/{build.project_name}.hex"

Use Sketch->Export Compiled binary to save hex in the sketch folder. Upload via USB drive bootloader, make sure it renames to RDY, power cycle the iron.

Semi-automatic uploading with TS80 bootloader is also possible, just edit uploading script in the library folder. You still need to hold Button A (PB1) on reset to open USB drive.

Edit %LOCALAPPDATA%\Arduino15\packages\STM32\tools\STM32Tools\1.4.0\tools\win\maple_upload.bat:

set tmpBinFilePath=%4
set tmpBinFilePath=%tmpBinFilePath:/=\%
echo COPY %tmpBinFilePath% E:\
copy %tmpBinFilePath% E:\

Firmware

This basic sketch drives pin PA6 both on Bluepill and TS80:

// #define LEDPIN     PC13 // Blue Pill LED
#define LEDPIN     PA6 // PWM_OUT (TS80 heater pin)

extern "C" void SystemClock_Config(void) {
  // there's no external clock on TS80, we need this handler empty
}

void setup() {
  pinMode(LEDPIN, OUTPUT);
}

void loop() {
  static uint8_t flag;
  digitalWrite(LEDPIN, flag ? HIGH : LOW);
  flag ^= 1;
  delay(50);
}