Low cost STM8S103F3P6 Board - Review and Getting Started Guide
— July 23, 2015STM8 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.
Board Features
- SWIM Connector
- Voltage Regulator [3V3 - AMS1117]
- Micro USB connector to power the board over USB, SmartPhone Charger
- All Pin Outs
- Power LED
- USER LED, Connected to PB.5
- RESET Switch
Schematic
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.
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.
Software Tools for Windows
- STVP - Go to STVP Tutorial
- STVD - Go to STVD Tutorial
- Cosmic Compiler - Cosmic Compiler + STVD Tutorial
Choose STM8S103F3P as Device in STVP and STVD.
Code
- #include“stm8s.h”
- void myDelay(void);
- void myDelay()
- {
- int i,j;
- for(i=0;i<1000;i++)
- {
- for(j=0;j<100;j++);
- }
- }
- main()
- {
- GPIOB->DDR |=0×20;// PB.5 as Output
- GPIOB->CR1 |=0×20;// PB.5 as Push Pull Type Output
- while(1)
- {
- GPIOB->ODR |=1<<5;// PB.5 = 1
- myDelay();
- GPIOB->ODR &=~(1<<5);// PB.5 = 0
- myDelay();
- }
- }
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.








7 Comments
thx
keep doing good wrok
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
This post was very helpful. Thanks for this. Keep doing this.
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
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
The link to “Cosmic Compiler – Cosmic Compiler + STVD Tutorial” is invalid - please fix ti or remove it.
Thank you!
Thanks for pointing it out. I have changed it to correct one.
Keep Experimenting!