Close

STM8S001J3: a Low-Cost Alternative to the ATtiny85

A project log for eForth for cheap STM8S gadgets

Turn cheap modules from AliExpress into interactive development kits!

thomasThomas 08/12/2017 at 14:3115 Comments

ST offers a new STM8S device: the STM8S001J3 in an SO8N package. It's more powerful than the ATtiny85: same Flash, double the RAM, less EEPROM, better peripherals (ADC, 1x8bit+2x16bit timers, UART, I2C and half an SPI), and at a price of $0.20 it's much cheaper than the ATtiny85. It's even cheaper than the ATtiny13!

It has another advantage: there is an interactive (untethered) Forth for it! The dataasheet is very similar to that of the STM8S003F3P6, and I hope to receive samples soon. There is a new Wiki page with a feature comparison of different STM8S Low Density Devices. The bottom line is this: other than the pin count there aren't many differences!

The reason for the somewhat confusing list of pin properties is that multiple GPIOs are bonded to a pin (with the exception of pin 6). When GPIOs are used in parallel, pin8 can drive up to 80mA within the spec of the device!

One can argue that compared with 8pin AVR chips it has one pin less to play with (Vcap), but NRST (reset) obviously isn't needed for in-circuit-programming, and on the ATtiny85 side working without the RESET/dW feature isn't really fun. An untethered Forth for the ATtiny85 could settle the score but I couldn't find any.

For most applications the STM8003F3P6 is a better choice ($0.24@10pcs), but SO8N is so much easier to solder that it ranks high in the gadget rating ;-)

Discussions

Richard Aplin wrote 09/11/2017 at 23:46 point

Oohhohoho that's awesome for my gig; very timely news thankyou!

  Are you sure? yes | no

richard wrote 09/06/2017 at 01:02 point

I'm feeling numb after thinking about this. I was about to bit bang something in assembler on an ATtiny15 to load a microwave PLL with a different frequency for 10GHz use. Easy enough to do. But a tethered 8 pin micro running forth instead just stalls my though process. Has anyone found an online source for these chips yet?

  Are you sure? yes | no

Richard Aplin wrote 09/11/2017 at 23:48 point

mouser/digikey in stock right now

  Are you sure? yes | no

[deleted]

[this comment has been deleted]

Thomas wrote 08/27/2017 at 15:18 point

The maximum STM8S00x timer clock frequency is the CPU clock (e.g. HSI 16MHz).

I'm not an ATtiny25/45/85 expert but 64MHz seems to be "slightly" out of spec. There are many examples in the net that demonstrate the ATtiny85 can be configured to do that but I wouldn't bet my job on it.

  Are you sure? yes | no

Thomas wrote 08/28/2017 at 05:23 point

64MHz timer clock is pretty impressive for an 8bit µC. The ATtiny85 appears to be a good fit for analog signal processing, provided that the coarse digitalization is compensated by some noise in the signal path, and matching filter design.
Since the STM8S001 provides two capable 16bit timer units (plus a simple 8bit timer). Applications that require 16bit PWM resolution are better served with any of the low-cost STM8S.

  Are you sure? yes | no

Thomas wrote 08/28/2017 at 17:41 point

Agreed, it's horses for courses: not an replacement, but a more or less suitable alternative :-)

Of course, depending on the requirements the STM8S can be a little viable (or desirable) alternative to AVR, e.g. one might mangage to bit-bang USB with an STM8S but as the core uses pipelining, 32bit operant fetch, and variable instructions length (from 1 to 5 bytes) it won't be easy.

  Are you sure? yes | no

Lars Brinkhoff wrote 08/27/2017 at 06:41 point

Here's a Forth for ATtiny2313:

https://wiki.forth-ev.de/doku.php/attiny

I'm guessing it shouldn't be hard to adapt for the '85.


  Are you sure? yes | no

Thomas wrote 08/27/2017 at 11:19 point

MikroForth for the ATtiny2313 is much like xForth: there is neither compiler nor interpreter on the target. Forth code gets interpreted/compiled, and a hex file appears. The hex file can then be programmed into the µC with the help of a bootloader, and then tested in burn-and-learn fashion.

A tethered Forth would provide interactive features, and an untethered Forth (e.g. AmForth or STM8EF) is completely self-contained.

  Are you sure? yes | no

K.C. Lee wrote 08/22/2017 at 04:47 point

Your link for https://github.com/TG9541/stm8ef/wiki is missing a colon

  Are you sure? yes | no

Thomas wrote 08/23/2017 at 01:58 point

Thanks! There was a nice HTTP://HTTPS:// in the href attibute ;-)

  Are you sure? yes | no

jaromir.sukuba wrote 08/13/2017 at 07:10 point

This IC actually has the STM8S003 chip bonded to SOIC-8 frame. The same chip, just watch out for pins conflict, as multiple chip pads are shorted-bonded to single pin.

  Are you sure? yes | no

Thomas wrote 08/22/2017 at 03:20 point

Maybe it's the same chip but at least it's a different revision. The UART1_TX option on PA3 is new, and at least the STM8Sx003 samples I tested don't support that mapping  (yet).

  Are you sure? yes | no

Richard Aplin wrote 09/11/2017 at 23:48 point

handily that's exactly what I want..   Great move by STM, I'm such a fan of that chip; so incredibly cheap yet really quite capable

  Are you sure? yes | no

Thomas wrote 09/12/2017 at 05:17 point

I also think that the STM8S001J3M3 is a fine little chip!
I've now got the STM8S "UART1 Half-Duplex" feature working. The STM8S001J3M3 has this feature on PD5 (pin8), or on PA3 (pin5) (after setting OPT2 bits 0:1). However, there is no NRST, "access to PD1/SWIM" needs to be carefully managed, and using single-wire communication on pin8 solves this problem. I'm now fine-tuning e4thcom support for this use case.

  Are you sure? yes | no

jaromir.sukuba wrote 09/12/2017 at 08:30 point

I received a few samples before those chips were available in online shops. I spent a few days with them, testing GDB for STM8 and others. I wrote my remarks here https://hackaday.io/project/27250-mcu-how-tos-reviews-rants/log/66992-stm8s001j3-the-good-the-bad-and-the-ugly

GDB how-to is in works.

  Are you sure? yes | no