STM8 Core

RogerClark
Thu Jun 29, 2017 5:06 am
Guys

I see there is some interest in the STM8 processor, with Armduino porting their core to this (8 bit) architecture, so I thought it was worth making a section of this even though its not a STM32 device, and is quite a different type of device.

I just received a couple of these

“STM8S103F3P6 ARM STM8 Minimum System Development Board Module For Arduino” boards from eBay, for $1 each.

Image

PS. I love the way the eBay vendors add the word “Arduino” to the end of virtually everything, even if there is not an Arduino core for such a device ;-)


zoomx
Thu Jun 29, 2017 6:26 am
I bought 2 differents boards, the most common blue one with STM8S103F3P6 and another that is red, it is lesser common and use an STM8S003F3P6. As I wrote earlier, my metal STLINK dongle didn’t work but the Baite model instead worked perfectly. Then I used SDCC but compiled only a blink example.

[RogerClark – Thu Jun 29, 2017 5:06 am] –
PS. I love the way the eBay vendors add the word “Arduino” to the end of virtually everything, even if there is not an Arduino core for such a device ;-)

But it simplifies the search! Using the single word Arduino you find a lot of results that are interesting. Try to search using ARM, you will get a looot of results that are not useful.


RogerClark
Thu Jun 29, 2017 6:47 am
[zoomx – Thu Jun 29, 2017 6:26 am] –

But it simplifies the search! Using the single word Arduino you find a lot of results that are interesting. Try to search using ARM, you will get a looot of results that are not useful.

True.

I got some other interesting stuff in the post, including some IR time of flight distance measuring modules, but I’ll need to post that to my Postbag ;-)


vargham
Thu Jun 29, 2017 7:25 am
But why? STM8 is obsolete, isn’t it?
Almost the same (package and price), but 32 bit and more peripherals:

https://www.aliexpress.com/item/STM32F0 … 17601.html

Ten ICs:
https://www.aliexpress.com/item/Free-sh … 90554.html

It is dirt cheap.


RogerClark
Thu Jun 29, 2017 8:09 am
For some reason the STM8 still seems really popular with manufacturers

Possibly its he knock down price.

I think STM8 has sold 3 billion of them and still get massive sales figures

Lots of low end devices still use them.

Personally, I’ll mainly be using the STM32 but some devices I want to reverse engineer and modify have STM8’s in them


racemaniac
Thu Jun 29, 2017 9:22 am
i’m starting to be happy again i once ordered some cheap tiny stm8 boards. might end up doing something with them after all XD.
looking forward to this :)

dannyf
Thu Jun 29, 2017 10:02 am
STM8 is obsolete, isn’t it?

it is indeed obsolete, in terms of specs.

it is anything but obsolete, in terms of its market share.


RogerClark
Thu Jun 29, 2017 10:30 am
[racemaniac – Thu Jun 29, 2017 9:22 am] –
i’m starting to be happy again i once ordered some cheap tiny stm8 boards. might end up doing something with them after all XD.
looking forward to this :)

I think some people are working on the Armduino core to get it to work on the STM8, and have some success

I’m not sure whether the STM8 is arm or not, so perhaps the name of that core does not suit this use, but the name doesnt matter that much ;0)


zmemw16
Thu Jun 29, 2017 10:49 am
from ds
Core: ARM® 32-bit Cortex®-M0 CPU, frequency up to 48 MHz

srp

oops, followed links above :oops:


ahull
Thu Jun 29, 2017 11:06 am
http://www.st.com/content/ccc/resource/ … 226640.pdf

Looks like it only sips a few mA when it is running. There appears to be a low power version that sips even less.


dannyf
Thu Jun 29, 2017 11:59 am

I’m not sure whether the STM8 is arm or not

Stm8 is not based on arm cortex m at all. Good old 6502 instead.


zoomx
Thu Jun 29, 2017 12:20 pm
It is an 8 bit MCU but the instruction set seems to me totally different from the 6502 one, the architecture is Harward, it has DMA (Atmega328 does not), the A/D is 12bit instead of the usually 10. It’s not that bad.

ag123
Thu Jun 29, 2017 4:50 pm
me too, i found those sub $1 mcus + boards somewhat ‘irresistible’ and got 2 pieces :lol:
the good thing about stm8s is that i think st-link v2 can be used to program those, hence this would be at least a piece of shared ‘dongle’ with stm32.
i’m yet to even start learning about it.
unfortunately, i think the currently the available open sourced c compiler sdcc didn’t seem quite as ‘industrial strength’ as arm gcc compilers
http://sdcc.sourceforge.net/
debugging is also a problem in linux as it doesn’t use SWD

oh the other thing is i think it runs on 3.3v, hence there’d be no issues related to 3.3v-5v interfacing with stm32
my thoughts are that these may make good i2c devices

actually i’m thinking of using it for a 4×4 keypad, for a normal ‘digital’ way of doing 4×4 keypads u’d need 8 pins (4 input, 4 output) for the scans, using 8 pins on a maple mini / blue pill is a sin, u’d run out of pins sooner once u do that :lol:
but if we have stm8s as a ‘co-processor’ e.g. handle the keypad, but it could do more than that, we can reduce a good fraction of i/o functions to a mere 2 pins on i2c, we could have the stm8s handle keypad + rotrary encoder & even some basic analog stuff & even drive motors


Pito
Thu Jun 29, 2017 5:57 pm
This types of cpu’s are not C friendly (6 registers and 20 addressing modes..). Best to program it in asm :)

stevestrong
Thu Jun 29, 2017 7:16 pm
I think I will stick to AVR when it goes to 8 bit, I still have a couple of ATmega328p chips laying around.

ahull
Thu Jun 29, 2017 7:50 pm
Two for a dollar sixty eight shipped. That is almost cheaper than I can buy the USB connector for. Sadly I don’t currently have the time to play with them otherwise I would…

ag123
Fri Jun 30, 2017 3:36 am
i actually didn’t have an AVR :P
i’ve been pondering about it but i’m thinking that interfacing between 3.3v stm32 to 5v AVR is a hassle, i’ve been looking around for cheap 3.3v 8 bit mcus & i’d think stm8s is one of those which in addition can be programmed from the same st-link-v2 dongle, this saves various other accessories needed to program it

there are occasions that i struggle between deciding on using basic logic blocks e.g. those 74hcxx 40xx stuff, but those ‘chips’ would almost always need several different components for a particular use case. e.g. for a 4×4 keypad i can use either a multiplexer, decoder (e.g. 4-16 multiplexer) or 2 sets of shift registers (4 bits output, 4 bits input) to reduce the interfacing pin counts to stm32, and there are still necessity to set aside additional pins for clocks, output control etc, the end result is that pin counts interfacing with stm32 is not really reduced

to reduce the true pin counts interfacing with stm32 a ‘co-processor’ would really do that using only 2 i2c pins and the ‘co-processor’ is not limited to a single function device. this would really help to reduce component counts vs using basic logic blocks

of course the other way is to use the somewhat pricier ‘high density’ stm32 devices which can really reduce component counts to just the mcu alone


RogerClark
Fri Jun 30, 2017 3:40 am
I still have some AVR’s but havent used them for ages.

More and more peripherals are now 3.3V, which makes the AVR boards harder to use as I need level converters (voltage dividers at the bare minimum)

I did still use an AVR a while ago as I needed a I2C slave, but we should now be able to do that with ST’s core.


ag123
Fri Jun 30, 2017 3:51 am
the thing about a lot of those 3.3v devices e.g. stm32 is that it can run on batteries, an extreme of which is that u’d only need 2×1.5v AA or AAA batteries to power say a maple mini/blue pill, no regulators, no any ‘special’ circuits needed, just connect 2 AA batteries and it runs. for 5v devices i’d guess a lot of them would likely need 4x AA or AAA batteries and i’m not sure if 6v is ok for those mcus

it makes a lot of difference where portability goes


RogerClark
Fri Jun 30, 2017 3:56 am
Yes.

3V operation is attractive.

Its just a shame that they are not supposed to be to tolerate the 3.7 (or max 4.2V) from Lipo

I think the practice they would probably work OK at 3.7V but its beyond the spec


ag123
Fri Jun 30, 2017 4:04 am
among the ‘tricks’ for using 4.2v lipo i think is to use those cheap diodes with a 0.6-0.7v forward voltage.
https://www.newark.com/pdfs/techarticle … sBrchr.pdf
https://www.diodes.com/assets/Datasheets/ds28002.pdf
it would take just 2 pieces in series to get 3v from a 4.2v LIPO,or perhaps it may even be possible to make do with just a single diode
alternatively, we could simply connect an LDO or use the existing one on MM/BP

RogerClark
Fri Jun 30, 2017 4:42 am
Yes.

I use diodes a lot ;-)


zoomx
Fri Jun 30, 2017 5:50 am
[Pito – Thu Jun 29, 2017 5:57 pm] –
This types of cpu’s are not C friendly (6 registers and 20 addressing modes..). Best to program it in asm :)

I programmed only two MCU in asm, ST6 and ST9, some decades ago. ST6 didn’t had a flash but a UV erasable memory. They where the first MCU that I used. ST6 was popular in Italy because an italian magazine, Nuova Elettronica, published a course for it with many examples and a beautiful asm skeleton to start.
The magazine had a particular style of schematic drawings that is still used by Pighixxx http://www.pighixxx.com for his schematics.


RogerClark
Fri Jun 30, 2017 7:15 am
Its been a long long time since I did any assembler. ;-)

I think possibly on the Z80 or 6502


Pito
Fri Jun 30, 2017 8:33 am
ST6 was popular in Italy..
.. and ST started as SGS Microelettronica..
The ST8 architecture is “similar” to the 65xx/68xx and 65/68 are known for lacking a good C. All developments in past were mostly made in asm..

zoomx
Fri Jun 30, 2017 8:57 am
I don’t understand.
Here it is the STM8 CPU programming manual
http://www.st.com/content/ccc/resource/ … 161709.pdf
at page 10 is written
The Analog to Digital Converter uses a sample and hold technique. It has 12-bit resolution.

Pito
Fri Jun 30, 2017 9:06 am
Only STM8L and STM8AL chips have got 12bit ADC. See the parameter finder
http://www.st.com/en/microcontrollers/s … tId=SC1244

zoomx
Fri Jun 30, 2017 9:18 am
[Pito – Fri Jun 30, 2017 8:33 am] –
.. and ST started as SGS Microelettronica..

Before was SGS-Ates Componenti elettronici S.p.A. It was here
https://www.google.it/maps/@37.4389452,15.0645871,18z
in the same place of the new bigger factory they do research and production but no MCU. Many years ago they produced components for CFL lamps.
I still have an old ATES transistor somewhere.

[Pito – Fri Jun 30, 2017 9:06 am] –
Only STM8L and STM8AL chips have got 12bit ADC.

The programming manual don’t say that ADC can be 10 or 12 bit, it say only 12. Maybe because it is the programming manual and no one read it.


Pito
Fri Jun 30, 2017 9:33 am
Last time I read a programming manual carefully was in summer ’82 – it was 1 page A4 with all 8080 instructions listed :lol:
Even so my first asm code crashed as I was using 8085 :)

zmemw16
Fri Jun 30, 2017 12:44 pm
the 328 supply voltage v frequency graph does allow operation at 3v3 most likely around 8MHz, istr illicit operation at 10MHz being reported. :D
somewhere i’ve dozen or so 3v3 nano, mini or similar without usb needing a usb/serial block.
stephen

dannyf
Fri Jul 07, 2017 12:43 am
ST is said to introduce STM8S001 soon, a 8pin device. Maybe a good replacement for 12F675.

MarkB
Mon Jul 17, 2017 5:47 pm
I’ve been playing with STM8 a bit over the past year and thought I might add a few observations.

1) I wouldn’t call STM8 “obsolete” as it’s one of the newest 8-bit microcontroller families on the market. It also seems to be very widely used.

2) Peripheral set is very similar to the STM32 line. This is helpful for those who might want to move back and forth between the 32 and 8 bit world.

3) The core runs at 1.8 V. This gives relatively low power at full speed, that is, the guaranteed clock speed does not roll off with voltage as does AVR. The MCU will tolerate a wide range of input voltage (2.95 – 5.5 V for STM8S) which is nice for running off unregulated battery. STM8L runs at lower voltage (1.65 – 3.6V). The I/O pin voltage are relative to Vdd.

4) Software/community support isn’t anywhere near comparable to Arduino / AVR or for that matter PIC or MSP and so forth. I started with one of the commercial (but free for personal use with size restrictions that aren’t relevant for the value-line STM8 products) compilers from IAR and have used the STM/COSMIC compiler as well. Both are full featured commercial grade products with a steep learning curve, but include (via STLINK) in circuit debugging tools, simulators, and such.

5) SDCC the open source compiler supports STM8 but documentation is pretty thin and it’s hard to find example code. There is no open source support for debugging tools, but there are recent rumors of a project to do so.

6) I’ve lately been playing with an eForth port https://github.com/TG9541/stm8ef/wiki that supports compile to flash, interrupts, a periodic background task, “software serial”, and “board support packages” for a number of cheap Chinese STM8 boards. As “hacker projects” go the code and documentation are quite good.

7) I haven’t used it, but there exists an Arduino-like library for STM8/SDCC that is supposed to allow programming using Arduino paradigms. https://github.com/tenbaht/sduino/blob/ … s/index.md Edit 2 (better link for Sduino): https://tenbaht.github.io/sduino/

Edit for addition observations per previous post:
a) There’s no such thing as 8-bit ARM regardless of what eBay vendors say.

b) There are STM8 variants that have DMA, but the low-end STM8S103F3 or STM8S003F3 boards common on eBay don’t have DMA.

c) Minimal circuit configuration for STM8S is MCU and 3 capacitors (Vdd bypass, Reset, and Vcap (1.8V core voltage)) using internal oscillator.


zoomx
Tue Jul 18, 2017 6:46 am
@MarkB
thanks for your review!

dannyf
Thu Jul 20, 2017 10:10 am
used the STM/COSMIC compiler as well.

STVD is a dog, ugly as hell.

there is an unlimited cosmic available on github. the morality of using it may be questionable to some, however.

I use IAR. it is simple, intuitive and very utilitarian as well. the beauty of it is that you can use the same IDE across most MCUs that I touch. couldn’t have been happier with it.


RogerClark
Fri Jul 21, 2017 10:33 pm
Can you post the link to the compiler on GitHub

I looked on STMs website about the compiler for STM8 and it seemed to be a free download, of what I presume is the compiler from Cosmic.

I looked on Cosmic’s site and the STM8 compiler was available for free download, however there was some wierd legal stuff about it being only a 1 year license, albeit which they said was renewable.

I dont know if the compiler checks the date and time or whether the license duration is just from a legal standpoint.

BTW. Cosmic seem to have a compiler for the STM32 as well, but as STM official use gcc e.g. That’s what the CubeMX is compatible with, I don’t know who would use the Cosmic compiler for STM32


LightningStalker
Sat Nov 04, 2017 3:39 pm
I made a little breadboard pill board, more of a breakout board really, for my project with the STM8L152C6T. Feel free to do what you want with it. The traces are kind of ugly, mostly autorouter, but I was in a hurry. Also there is no regulator onboard. It was mostly copied from the STM8L discovery.
https://easyeda.com/LightningStalker/ST … d69f4df7ea

RogerClark
Sat Nov 04, 2017 8:23 pm
[LightningStalker – Sat Nov 04, 2017 3:39 pm] –
I made a little breadboard pill board, more of a breakout board really, for my project with the STM8L152C6T. Feel free to do what you want with it. The traces are kind of ugly, mostly autorouter, but I was in a hurry. Also there is no regulator onboard. It was mostly copied from the STM8L discovery.
https://easyeda.com/LightningStalker/ST … d69f4df7ea

Thanks for posting…

I few forum members have some $1.50 STM8 boards, bought from eBay (from China), but I don’t think anyone , me included is actively using them for a project.


LightningStalker
Sun Nov 05, 2017 2:51 pm
I was attracted to it because of the price, pincount, LSO support, and the built-in LCD driver. I don’t like the instruction timing, but hopefully that is inconsequential with the use of timers.

evildave_666
Mon Nov 06, 2017 1:58 am
[RogerClark – Sat Nov 04, 2017 8:23 pm] –

[LightningStalker – Sat Nov 04, 2017 3:39 pm] –
I made a little breadboard pill board, more of a breakout board really, for my project with the STM8L152C6T. Feel free to do what you want with it. The traces are kind of ugly, mostly autorouter, but I was in a hurry. Also there is no regulator onboard. It was mostly copied from the STM8L discovery.
https://easyeda.com/LightningStalker/ST … d69f4df7ea

Thanks for posting…

I few forum members have some $1.50 STM8 boards, bought from eBay (from China), but I don’t think anyone , me included is actively using them for a project.

I’ve been using the dollar STM8S103 boards for running servos & PWMing LEDs on a model kit. All the work has been done with bare-metal direct register twiddling with SDCC though. I might try and rewrite it at some point using the Sduino libraries.


dannyf
Sun Nov 12, 2017 2:32 pm
the dollar STM8S103 boards

I have loads of ghetto STM8S003Fs on pcb adapters, working just fine. They came to me at like 30c/chip. likely the least expensive brand-name MCUs.


minime
Sun Feb 10, 2019 12:27 am
i am interested to port this interesting regulator b3606 to stm8 arduino core , how to create a pwm output by varying both frequency and duty cycle ?

https://github.com/Lucast85/b3603


RogerClark
Sun Feb 10, 2019 12:43 am
I presume that board uses a STM8..

Do you know which version of STM8 it is, and whether it can be reprogrammed.. Some STM8 can only be programmed once


minime
Sun Feb 10, 2019 5:11 am
it is MCU is STM 8S003F3

https://www.eevblog.com/forum/reviews/b … -be-fatal/

yes I understand that , as i just solder new ones so i do not lose the original software ” is there away to recover it”, i still can reflash the same one on board no problem with st-link to get it working but looking to have it working with i2c or spi better than the limiting rs232 also the LEDs are not working.
with the updated firmware, thought to having it using arduino core much better if i can find examples how to use i2c and with 2 pwm (freq/duty cycle) to control the voltage and and current.


Leave a Reply

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