Reply to topic  [ 4 posts ] 
STM8S103F3 Development Board (HCDVBD0034) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 633
Post STM8S103F3 Development Board (HCDVBD0034)

This development/breakout board (HCDVBD0034) is based around the ST Microelectronics S103F3P6 microcontroller. STM8 microcontrollers are an ultra low cost solution to embedded control. This development board provides convenient access to the devices I/O pins via standard 2.54mm pitch headers (require soldering). Besides providing access to most of the microcontrollers I/O, there is additionally a microUSB connector for powering from a USB port, and a standard ST SWIM programming/emulation header that allows for programming or debugging using a compatible programmer such as our low cost ST-Link compatible USB programmer (HCDVBD0016). An on-board 3.3V regulator provides power to the board supplied via the 5V USB or 5V header pins. The ST tool chain (STVD) is available as a free download from the ST website and is fully compatible with this board. There are also additional third party tools such as the Cosmos ANSI C compiler (8K limited) and the SDCC (Small Device C Compiler) which can be downloaded for free. Links to these tools are provided at the bottom of this post.


Key Features
16 MHz advanced STM8 core with Harvard architecture and 3-stage pipeline
Extended instruction set
Program memory: 8 Kbytes Flash; data retention 20 years at 55 °C after 10 kcycles
Data memory: 640 bytes true data EEPROM; endurance 300 kcycles
RAM: 1 Kbytes
2.95 to 5.5 V operating voltage
Flexible clock control, 4 master clock sources:
Low power crystal resonator oscillator
External clock input
Internal user-trimmable 16 MHz RC
Internal low power 128 kHz RC
Clock security system with clock monitor
Power management:Low power modes (wait, active-halt, halt) Switch-off peripheral clocks individually
Permanently active,low consumption power-on and power-down reset
Nested interrupt controller with 32 interrupts
Up to 27 external interrupts on 6 vectors
Advanced control timer: 16-bit, 4 CAPCOM channels, 3 complementary outputs, dead-time insertion and flexible synchronization
16-bit general purpose timer, with 3 CAPCOM channels (IC, OC or PWM)
8-bit basic timer with 8-bit prescaler
Window watchdog, independent watchdog timers
UART with clock output for synchronous operation, Smartcard, IrDA, LIN master mode
SPI interface up to 8 Mbit/s
I2C interface up to 400 Kbit/s
10-bit, ±1 LSB ADC with up to 5 multiplexed channels, scan mode and analog watchdog
16 I/Os on a 20-pin package including 12 high sink outputs
Highly robust I/O design, immune against current injection
96-bit unique ID key for each device


Example 'Blink' Program:

/* FILE:    STM8S103F3_Blink_Example
   DATE:    30/03/17
   VERSION: 0.1
   AUTHOR:  Andrew Davies

A simple blink example that will flash an LED connected to
port B pin 5 on and off continuously. This program has been
written specifically for our development board HCDVBD0032.

You may copy, alter and reuse this code in any way you like,
but please leave reference to in your
comments if you redistribute this code. This software may
not be used directly for the purpose of selling products
that directly compete with Hobby Components Ltd's own range
of products.


#include "STM8S103F3P.h"

   unsigned int d;
   PB_DDR = 1 << 5; //Set port B pin 5 to an output
   PB_CR1 = 1 << 5; //Set port B pin 5 to a push-pull
   while (1)
      for (d = 0; d < 40000; d++); //Delay ~ 1 second

      PB_ODR |= 1 << 5;   //Set port B pin 5 high
      for (d = 0; d < 40000; d++); //Delay ~ 1 second
      PB_ODR &= ~(1 << 7); //Set port B pin 7 low

Software Tools:

Development tools can be downloaded from the ST website here: ... 807/SS1747

A direct link to the STVD development environment is available for download here: ... 7/PF210567

And the STVP programming software is available for download here: ... 7/PF210568

A free 8K limited version of the Cosmos C compiler which is supported by the STVD development environment is available for download here: ... m_eval.exe
We recommend installing the Cosmos C compiler before installing the STVD development environment.

Alternatively SDCC (Small Device C Compiler) is a free compiler that is compatible with the STM8 microcontrollers and can be downloaded here:


When trying to use the debug feature in the STVD development environment I get the following error: gdi-error [40201]: can't access configuration database

Go to C:\Program Files (x86)\STMicroelectronics\st_toolset\stvd\dao\ and install the ST Toolset.msi

If you are running 64 bit versions of Windows 8/10 and installing the toolset above did not resolve the problem open up a DOS command prompt in admin mode and issue the following two commands:

Regsvr32 /u "C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL"
Regsvr32 "C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL"

Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

Thu Apr 20, 2017 2:40 pm

Joined: Wed Aug 21, 2013 7:38 am
Posts: 14
Post Re: STM8103F3 Development Board (HCDVBD0034)
With a RaspberryPi 3 (Now works on a PI Zero W) I have had some success reading the flash and eeprom.
The part number is actually STM8 S 103F3 :oops:

sudo apt-get update
sudo apt-get install -y sdcc screen
sdcc --version

SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/TININative/ds400/hc08/s08/stm8 3.4.0 #8981 (Jul 11 2014) (Linux)
published under GNU General Public License (GPL)

git clone
cd ~/stm8flash/
sudo make
sudo make install
sudo apt-get install
ls /usr/bin/stm8flash

//The next sample lines reads -r the 8K flash and 640 byte eeprom using ST-LINK V2 programmer SWIM
sudo ./stm8flash -c stlinkv2 -p stm8s103?3 -s flash -r flashfilename.hex
sudo ./stm8flash -c stlinkv2 -p stm8s103?3 -s eeprom -r eepromfilename.bin

MINDEV is the miniature development system.
Get MINDEV.ihx from as file

//This writes -w the stm8S with the Forth OS.
sudo ./stm8flash -c stlinkv2 -p stm8s103?3 -s flash [b]-w[/b] MINDEV.ihx

//Now pull the stlinkv2 programmer and disconnect.

//eForth is now operational! from a RaspberyPi3 or Pi Zero W, using mini-USB as 5 volt power and an HC UART dongle for communications; PD5 Green PC-RXD, PD6 White PC-TXD, Black ground of course. Red +5 v is left unconnected for now until I confirm VDD pinouts.
screen is a USB terminal.
dmesg to see which USB port is active after plugging dongle in.
usb 1-1.2.3: pl2303 converter now attached to ttyUSB0

screen /dev/ttyUSB0 9600
stm8eForth v2.2 it says always use <enter> after the dot.
4 3 * . <enter> 12 ok

: square DUP * . ;
5 square 25 ok

The word square is volatile in RAM. COLD re-initializes the sysytem and stops tasks. RESET erases all added words.
To put it in non-volatile-memory:
: crlf EMIT 10 EMIT 13 ;
: square DUP * . crlf ;
: cube DUP 2DUP * * * . crlf ;
- switch back to run mode. This code will survive a power cycle as it is now burned into flash.

WORDS -lists all words - system words in uppercase, so added words best to be in lowercase
10 square <enter> 100 ok
9 square 81 ok
10 cube 1000 ok

Blink LED PB5 in the background: 128 is $80 is 80Hex
: blinktask TIM 128 AND IF 1 ELSE 0 THEN OUT! ;
' blinktask BG !

Crtl-h is the backspace.

The code mentioned elsewhere is more elegant and the hex value 0B ( 0000 1011 ) has inactive bits (low turns on the LED) and
I think that this is a way to run PWM in the background. Multitasking is not a feature but a simple hardware background task is.

: blinky TIM $0B AND 0= OUT! ;
' blinky BG !
0 BG ! /to stop flashing
to stop Timer

The 8 K flash is taken up with < 5 K eForth OS. This leaves a lot of room for expansion. The MINDEV.ihx file on a Pi equates to
wc MINDEV.ihx
  158   158 11846 MINDEV.ihx
on eForth the true beauty and simplicity of Reverse Polish Notation is inherent when compared to CAS
( 11846 - ( 158 * 12 ) ) / 2 = 4975
 11846 158 12 * - 2/ . <enter> 4975

: intelhex 12 * - 2/ . ;
11846 158 intelhex 4975 ok
bytes using eForth

Rosetta spacecraft and Philae lander were launched in 2004 and arrived at Comet 67/P 10 years later. Both had significant instrumentation running on Forth. This alone is reason enough to abandon Windows / Mac and get with the 70's.

My hatred of Windows (and Mac) should not deter anyone from using the HC links and ST Microelectronics IDE and software, third-party tools, even HyperTerm or Putty. Putting an Airbus A380 cockpit on the back of a mosquito and saying how much you like flying is only meant to get more people back from the Dark Side. By all means, buy a board and interface and programmer from HC and learn Forth.


Last edited by barewires on Sat May 27, 2017 3:00 am, edited 19 times in total.

Sun May 21, 2017 2:17 pm
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 629
Post Re: STM8S103F3 Development Board (HCDVBD0034)
Thanks, I've now corrected the error in the title.

Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Mon May 22, 2017 5:24 pm

Joined: Sat May 13, 2017 12:43 pm
Posts: 3
Post Re: STM8S103F3 Development Board (HCDVBD0034)
Barewires, that looks cool! So SDDC and STM8FLASH actually run on a RaspPi? This means that people with a Windows PC should have no problems using the embedded STM8 Forth on the github site (just use a RasPi)!

Thinking about it, boards like the HCDVBD0034 are a good choice for RaspPi I/O expansion, or as a system watchdog. Compared with an Arduino IDE the Forth is a featherweight - no need to run edit-compile-flash loops :-) Building an interfacing between the STM8 and the RaspPi through SPI or I2C should also be possible.

Wed May 24, 2017 7:10 pm
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to &
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD