Low cost STM8S103F3P6 Board – Review and Getting Started Guide

STM8 series has already captured a large share of 8 Bit controller market in Industry. It is also gaining popularity in DIY community all over world, all credit goes to great features of this family, plenty of documentation and low cost Discovery Kits by ST Microelectronics. There are also many ultra low cost minimum system boards available on Ebay, Ali Express, Amazon etc. I picked some of these boards recently from this Indian vendor. These boards costs less than Rs. 150 and puts all I/O on PCB headers, power supply, reset switch, SWIM connector and a test LED connected to Port B.5.

STM8S103F3P6 Minimum system Board

STM8S103F3P6 Minimum system Board

 Board Features
  1. SWIM Connector
  2. Voltage Regulator [3V3 - AMS1117]
  3. Micro USB connector to power the board over USB, SmartPhone Charger
  4. All Pin Outs
  5. Power LED
  6. USER LED, Connected to PB.5
  7. RESET Switch
Schematic
Schematic for STM8S103F3P6 Dev Board

Schematic for STM8S103F3P6 Dev Board

Programming

Programming this low cost board is exactly similar to programming STM8S Discovery board. I have already covered Tutorial on Getting Started with STM8S Discovery. Only trick is, this low cost board doesn’t have ST-Link so we need an external ST-Link for STM8 to program this board. One can use a STM8S/ STM8SVL Discovery board as ST-Link V2 to program this board. Standard ST-Link V2 can also be used to program this board.

  • Some modification are needed on Discovery boards to use them as STM8 ST-Link. Open Solder Bridges SB1 and SB2 near SWIM connector to use STM8S Discovery as STM8 ST-Link.
STM8S as ST-Link

STM8S as ST-Link

STM8 Discovery as ST-Link Programmer

STM8 Discovery as ST-Link Programmer

Using STM8S/ STM8L Discovery as ST-Link can program only STM8 Series of MCUs while standard ST-Link V2 can program and debug both STM8 and STM32 MCUs.

ST Link V2 for STM32 and STM8

ST Link V2 for STM32 and STM8

 Software Tools for Windows
  1. STVPGo to STVP Tutorial
  2. STVDGo to STVD Tutorial
  3. Cosmic CompilerCosmic Compiler + STVD Tutorial

Choose STM8S103F3P as Device in STVP and STVD.

Code
  1. #include“stm8s.h”
  2.  
  3. void myDelay(void);
  4.  
  5. void myDelay()
  6. {
  7.        int i,j;
  8.        for(i=0;i<1000;i++)
  9.        {
  10.             for(j=0;j<100;j++);
  11.         }
  12. }
  13.  
  14. main()
  15. {
  16.         GPIOB->DDR |=0×20;// PB.5 as Output
  17.         GPIOB->CR1 |=0×20;// PB.5 as Push Pull Type Output  
  18.         while(1)
  19.          {
  20.                        GPIOB->ODR |=1<<5;// PB.5 = 1
  21.                        myDelay();
  22.                        GPIOB->ODR &=~(1<<5);// PB.5 = 0
  23.                        myDelay();
  24.          }
  25. }
  26.  

Compile this program using STVD and Cosmic Compiler and burn the .s19 file onto STM8S103F3P device using STVP. Test LED connected to PB.5 should blink with a constant delay.

Connections

Connections

About author

Devesh Samaiya

Chief Tinkerer at Lonely Night Projects

7 Comments

  1. vaibhav August 7, 2015 at 11:27 pm

    thx :) keep doing good wrok

  2. Max March 30, 2016 at 4:55 pm

    Hi,

    so if GPIOB->DDR|=0×20 is for PB5, which one is then for PB3? I don’t undertand why it is “0×20″ and not “0×05″?

    Greetings

  3. Ravi October 5, 2016 at 8:28 am

    This post was very helpful. Thanks for this. Keep doing this. :)

  4. Ravi October 5, 2016 at 10:00 am

    Hi Max,

    For PB3 it will be 0×08. Explained below
    PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0
    0 0 0 0 1 0 0 0

    Y 0×20? Explained below
    PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0
    0 0 1 0 0 0 0 0

  5. Andrew November 13, 2016 at 4:45 pm

    Hi Max,
    The 0x in 0×20 indicates the value is in hexadecimal format. In binary it would be 0b00100000. You can see now that the 1 is in the 6th position which corresponds to port 5 when you consider the first port (position) is port 0.

    So instead of 0×20 you could write 0b00100000 (binary) or 32 (decimal). All the same. You just need to know what system you are working in.

    Good luck.

    Andrew

  6. Gary April 3, 2017 at 10:08 pm

    The link to “Cosmic Compiler – Cosmic Compiler + STVD Tutorial” is invalid – please fix ti or remove it.

    Thank you!

    • Devesh Samaiya April 22, 2017 at 10:08 am

      Thanks for pointing it out. I have changed it to correct one.
      Keep Experimenting!

Leave a reply

Your email address will not be published. Required fields are marked *

31 − 25 =