ESP8266 modules are $3 Wi-Fi boards targeting IoT applications that can be used in standalone mode, or connected to another MCU based board. But what if you don’t actually need Wi-Fi, but instead require a tiny board to control a few GPIOs? Arduino Pro mini can be used for this, but it costs about $10 on Sparkfun, and it’s certainly cheap enough for most projects. Switching to Aliexpress, you can get Arduino Pro mini clones for about $2, and a bit less in 10 pieces quantities. But you can get even cheaper and add a micro USB port with STMicro STM8S based boards that can be found for 5.5 CNY (Less than $1) on Taobao.com, or – once oversea shipping is factored in – about $1.60 to $1.70 on BuyInCoins, or Aliexpress without headers, and the version with headers sells for about $2 or more.
Let’s check the board specifications:
- MCU – STMicro STM8S103F3P6 8-bit MCU @ 16 MHz, with 1KB SRAM, 8KB flash, and 640 bytes EEPROM
- USB – micro USB port for power
- 2x 10-pin (2.54 mm) with access to 3.3V (out), 5V (in), GND, GPIOs, I2C, UART, SPI, ADC, and PWM (TIM2).
- 4-pin debug header (SWIM)
- Misc – Reset button, Power and user (test) LED.
- Power Supply – 5V via micro USB, or 4.4 – 15V input via -/+ through holes.
- Dimensions – 3cm x 1.8cm
Sometimes boards sold on Chinese website have zero documentation and tools, but that one has some documents, tools, and source code. It’s
I could find three files:
- STM8系列程序资料.zip – Datasheet, schematics, and code samples for STVP and IAR
- STM8软件工具.zip – With ST Visual Programmer (STVP) and IAR development tool (Windows only), as well as ST-Link drivers.
- STM8其他资料.zip – Some other documents including university papers, datasheets, and getting started guide (All in Chinese), as well as some other example projects.
So everything seems there, but it won’t be as easy to use as the Arduino boards. [Update: As mentioned in comments the MCU does not have a USB interface, so the micro USB is only for power, and you’ll need an extra ST-Link debug board to program the boards]
Thanks to Onebir for the tip.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
“micro USB port for power and programming”
I think the USB port is for power only given that the MCU doesn’t support USB and the data lines are not connected on time schematic.
Yes, you’re right. So programming must be done via the Single Wire Interface with something like ST-LinkV2 then: http://www.ebay.com/itm/ST-LINK-V2-CN-STM8-STM32-JTAG-SWD-SWIM-In-circuit-Debugger-Programmer-Emulator-/261064535942
@Jean-Luc Aufranc (CNXSoft)
Or that one, for just $5.99: http://www.aliexpress.com/store/product/STLINK-V2-STM8-STM32-emulator-programmer-mini-STLINK-downloader/524881_1446941850.html
@Jean-Luc Aufranc (CNXSoft)
Thanks. When are you going to do a writeup on linkit connect?
There is also SDCC support for this chip.
And you can also find it at Electrodragon.
No onchip usb in there, but i think i saw some vusb code somewhere on hackaday.
Never heard about it. But maybe tomorrow if I can find enough information. It looks like it’s not been announced yet, but they have some docs up already.
Yep, SDCC supports the STM8.
I did not know SDCC -> http://sdcc.sourceforge.net/
So that means STM8s code can be built on Linux too.
As for programming tools, that might work I assume -> https://github.com/texane/stlink
Electro dragon link is here:
@Jean-Luc Aufranc (CNXSoft) http://www.seeedstudio.com/wiki/Linkit_Connect_7681
Or you could get this stm8 discovery board, it have st link 2 inside.
What tools are needed? I don’t think Arduino tools build for STM8 target.
8KB of Flash may be too small. Arduino ATmega328P has 32kB
Windows or Linux tools. It’s explained in the post and comments.
The STM8 links to the baidu site above don’t seem to work. Sent me to error page saying ‘downloads are cancelled’.
Are there are other links to development tools for these inexpensive STM boards?
I wrote some basic (led counter incrementing once per second, Whetstone and Dhrystone benchmarks) tutorials for stm8 development on Linux with the sdcc compiler:
So far there are only versions for two boards, but when I find time, I’ll add more.
Your STM8S Board Schematics is wrong: The Test LED is between Ports D3 und B5. You can see it on your own photos.
True! I also had some headache with electrodragon supplied schematic! It doesn’t match with my board which has LED on PB5 whereas in the electrodragon’s and above schematic it is shown PD3
You can write asm code for any STM7-8 with windows ST Visual Develop and debug with an STLinkV2 which is a matter of 3-4$ (just use native ST assembly toolchain). To use C source with ST Visual Develop and take benefith of the debug process i don’t know any toolchain except Raisonance and Cosmic solutions which are paid ones (but highly professional). You can also compile C code using sdcc on any operating system that supports it. There are also many ide supporting it. To upload/burn software, there is a free ST Visual Programmer for Windows and on linux/osx you… Read more »
I just discovered that the Cosmic toolset is free up to 8Kb
i tried for a while to build a hex disassembler but i am so mad that st won’t tell me how to get the stvd disassemble window to disassemble hex. or anything!!! hive me inspiration or help or sometyhing. p.s. i have the stlink and can write hex to the mcu and retrieve writen hex from the mcu. i just want to disassemble it so i can debug it
@jonathan scott james
I’m not sure about the Windows tools, I’ve only used Linux -> http://www.cnx-software.com/2015/04/13/how-to-program-stm8s-1-board-in-linux/
But I have not tried to disassemble the hex, but it looks like something GNU tools would be able to do.
This STM8 dev board is amazing. I selected it for my Internet Of Things Platform.
It’s an open Hardware + Open Software project on Github. You’ll find there samples for the free development environment (IAR) for RGB leds, temperature sensor, nRF24L01p radio module,…
A comparison of 4 current (mid 2016) C compilers for the STM8 can be found at:
How about £0.51 delivered !
You cannot buy a first class stamp for that amount in UK.
All the links are chinese?