Breakout Boards

sbridger edited this page Jul 11, 2018 · 24 revisions

Breakout boards, demo boards, and prototyping oriented products like Arduino, are a good way for exploring a µC architecture, for testing new design ideas, and for software-hardware integration test in a so called PiL test (an alternative is using "virtual hardware", e.g. the one used in Build and Test Automation).

The configurations MINDEV for "STM8S Low Density" devices (e.g. STM8Sx03F3, STM8Sx03K3), or "STM8S Medium, Density" devices (e.g. STM8S005K6, STM8S105K4) in the binary releases will work for most, if not all, STM8S breakout boards. There is initial support for "STM8S High Density" (e.g. STM8S207RB) and "STM8L Medium Density" (STM8L051F3). The binary releases also contain configurations with a 2-wire serial interface: STM8S001J3, and SWIMCOM for "STM8S Low Density" (e.g. STM8Sx03F3, or STM8Sx03K3).

However, it's easy to make other configurations (e.g. serial communication, I/O-support, Forth features).

Getting Started

For ordering from Chinese suppliers set aside about $4.00 for a breakout board, an STLink V2 programmer, a "TTL serial interface", a mini breadboard, and some patch wires. Budget delivery from China takes anywhere from 14 to 60 days. Depending on how patient you are, ordering from local suppliers may be worth the premium.

You can also start with one of the supported STM8S Value Line Gadgets, or with an STM8 Discovery board (which also provides an ST-LINK interface). For the serial console the serial interface of many Arduino boards, and USB interfaces for certain historic mobile phones will also work (e.g. Siemens S35).

Programmer TTL-Serial-Interface Breadboard Patch Wires
Programmer TTL-Serial Breadboard Patch Wires
  • an STM8S103F3P6 breakout board (if not bundled with the board add some single row pin headers)
  • a cheap USB ST-Link-V2 dongle ($1.80), or any STM8S/STM32 ST Discovery Board
  • a USB to "TTL" RS232 dongle, e.g. a CH340 or a PL2303 clone ($0.50 to $0.80)
  • a solderless breadboard, e.g. 170 or 400 points ($0.40 to $1.00), and jumper wires ($0.70 to $1.10)

For testing time critical routines (e.g. interrupt driven communication) a cheap logic analyzer with Sigrok is useful.

For flashing the binary under Linux or Windows please refer to Flashing the STM8 on the STM8S Programming page.

STM8S103F3P6 Breakout Board

For experimenting with STM8S003F3 peripherals a STM8S103F3 breakout board is a "must-have". The common $0.60 boards provide the following features:

  • STM8S103F3P6 (8K Flash, 1K RAM, 640 bytes EEPROM), no crystal
  • 4 Pin SWIM target interface (connects 1:1 to the ST-LINK SWIM connector)
  • a reset switch
  • a Micro USB connector for power supply (with 3.3V regulator, and blue or red "power LED")
  • red LED on port B5 for "blinking LED experiment"

STM8S003F3P6 breakout

Serial Interface

The MINDEV binary in the binary release bundle uses the UART port for communication:

Pin STM8S103F3P6 Port Connect to
2 PD5 serial interface "TTL" RxD
3 PD6 serial interface "TTL" TxD
7 GND serial interface "GND"

Alternatively the SWIMCOM image which provides half-duplex communication through STM8S003F3P6 pin17 (SWIM/PD1) can be used (see section Other Target-Boards).

Limitations of common STM8S103F3P6 Breakout Boards

  • for battery powered devices it might be necessary to remove the 3.3V regulator, and the power LED. When using an ST-LINK adapter for power supplying only 3.3V may be used (otherwise the 3.3 V regulator on the backside of the board will overheat!).
  • when the I2C interface on ports B4 and B5 is used, the LED at B5 may have a negative impact on the bus performance.

Simple Demo

The LED is mapped to bit0 of the OUT! word. A simply "blinky" for the console might look like this:

\ Blinky using the background task
\ type "0 BG !" to stop the task
: blinky TIM $40 AND 0= OUT! ;
' blinky BG !

Please refer to STM8 eForth Programming and to STM8 eForth Background Task for your next steps. For interactive programming e4thcom is recommended.

Building MINDEV

To build STM8 eForth for this target run make BOARD=MINDEV flash.

STM8S105K4T6 Breakout Board

Breakout boards with STM8S Medium Density devices, e.g. STM8S105K4T6, are available from about $1.60. They can be used as a cheap alternative to the STM8S105C6T6 based STM8S Discovery board. Medium Density devices provide substantially more memory (and, depending on the package more GPIOs) than the Low Density STM8Sx03.

The board shown below has the following features:

  • STM8S105K4T6 (16K Flash, 2K RAM, 1K EEPROM)
  • 8MHz crystal (or 16MHz HSI)
  • 4 Pin SWIM target interface (same pin-out as the ST-LINK SWIM connector)
  • serial interface via PD5 and PD6
  • blue LED on PE5 (low active, mapped to bit0 of OUT!) [Discovery board PD0][#STM8S105K4T6 Discovery Board]
  • reset switch
  • Micro USB connector for power supply (with 3.3V regulator, red "power LED")

STM8S105K4

@barewires wrote about his experience with STM8EF on a similar STM8S105K4 breakout-board here.

STM8S-Discovery Board

STM8S Discovery board manual

  • STM8S105C6T6 (16K Flash, 2K RAM, 1K EEPROM)
  • 16MHz crystal (or 16MHz HSI)
  • STLINK built in, with 4 Pin SWIM target interface
  • serial interface via PD5 and PD6
  • blue LED on PD0 (low active, mapped to bit0 of OUT!) [Breakout board and firmware uses PE5]
  • reset switch
  • Micro USB connector for power supply (with 3.3V regulator, red "power LED")

Serial RX CN4-11 PD5 TX CN4-10 PD6

If you power externally (eg. from the USB-Serial adaptor), not the usb on the discovery STLink, then after programming, remove links SB1,SB2 next to SWIM connector.

1 $5011 0 B!   \  PD0 is output in DDR
0 $500F 0 B!   \ led ON (low)
1 $500F 0 B!   \ led off

Redefine OUT! for Simple Demo

: OUT! 1 $5011 0 B! 0= NEGATE $500F 0 B! ; \\redefine OUT!

Serial Interface

The STM8S105K4 binary in the binary release bundle uses the UART port for communication:

Pin STM8S105K4 Port Fn Connect to Pin STM8S105C6 Discovery Bd
13 PD5 TX serial interface "TTL" RxD 46 CN4-10
14 PD6 RX serial interface "TTL" TxD 47 CN4-11
1 GND serial interface "GND"

Building STM8S105K4

For building STM8 eForth for this target run make BOARD=STM8S105K4.

Homemade STM8S003F3P6 Breakout Board

Using standard TSSOP breakout PCBs it's fairly simple to make plain STM8S003F3 boards (e.g. for experimenting with battery operation and power saving modes). At quantities of 10, a breakout board can be made with parts for $0.35.

Homemade STM8S003F3 Breakout

The pads on the 1.27mm TSOP side can be cut in the middle, and used as pads for soldering the capacitors. Pin 8 can be removed from the pin header to prevent short-circuiting the internal supply voltage of the µC core (Vcap).

Pin TSOP Pin STM8S003F3P6 circuit component note
17 4 NRST - VSS 100nF 0603 0805 in photo
14 7 VSS thin wire
13 8 VCAP - VSS 1µF 0603
12 9 VDD - VSS 100nF 0603 0805 in photo

For the units in the photo the following parts were used:

# Component lot of $/piece
1 STM8S003F3P6 10 0.22
1 PCB TSSOP20 10 0.09
2 100nF ceramics capacitor 0603 100 0.01
1 1uF ceramics capacitor 0603 100 0.01
0.5 40 pin 2.54mm header 10 0.03

Power Supply and ICP Programming

To program the MINDEV binary in the binary release bundle with an ST-LINK/V2 interface use the following pins:

Pin STM8S003F3P6 Port Connect to
4 NRST ST-LINK/V2 NRST
7 VSS ST-LINK/V2 GND or 0V
9 VDD ST-LINK/V2 5V or 2.9V to 5.5V
18 PD1/SWIM ST-LINK/V2 SWIM

Serial Interface

The MINDEV binary uses the UART port for communication

Pin STM8S003F3P6 Port Connect to
2 PD5 serial interface "TTL" RxD
3 PD6 serial interface "TTL" TxD
7 GND serial interface "GND"

Custom STM8 eForth board configurations can use any GPIO (or any two GPIOs on the same GPIO group) as a serial interface.

Homemade STM8S001J3M3 Breakout Board

The STM8S001J3M3 is the latest member of the STM8S low density family. As described here it behaves very much like an STM8S003x3 chip with 1 to 4 GPIOs bonded to the same pin. Out of 8 pins, 3 are used for the power supply (Vss, Vdd, and Vcap, and since NRST was sacrificed, 5 pins are connected to GPIOs.

ST provided a reference design in the form of a small breakout board.

One of the PCBs, and two STM8S001J3M3 controllers were provided for testing. Populating the breakout board is simple (2 pcs 1µF 0603 and 1 pcs 100nF 0603 are required):

stm8s001j3m3-breakout

However, it's also possible to use a standard SO8N to 8pin DIP converter PCB for experimenting with the STM8S001J3M3:

stm8s001j3m3-breakout-dip8

In order to protect the chip from short circuit, pin3 was removed from the header, and a 1µF capacacitor was soldered beween the free pad of pin3 (Vcap) and pin2 (Vss). A 100nF 0603 capacitor was soldered between a coper trace to Vdd (pin4) and the SO8N pad of pin2 (Vss).

Serial Interface

It's possible to use the STM8S001J3M3 with the CORE or the MINDEV binary, but that's not recommended: as soon as pin8 operates as UART1_TX it's no longer possible to access PD1/SWIM for programming the chip. Although it's possible to disable the UART, and thus regain access to PD1/SWIM, it's much safer to use the SWIMCOM binary.

An even better option is the STM8S001J3.ihx binary which uses UART1_TX in bi-directional half-duplex mode (2-wire mode). With the recommended 2-wire communication circuit, and a good serial interface adapter (e.g. PL2303, not CH340/CH341), this provides full console operation, e.g. with picocom, or e4thcom.

Pin STM8S001J3M3 Port Connect to
2 GND serial interface "GND"
8 PD1,PD5 SWIM, serial interface "TTL" RxD/TxD

It's also possible to remap UART1_TX to pad5 PA3, which can be done using the OPT! word in the library.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.