cancel
Showing results for 
Search instead for 
Did you mean: 

WS2812B with STM8s003

Erik1
Associate

Hello, I have bought an STM8s003 board and would like to use it to control ws2812B LEDs. But the libraries I have used with other controllers e.g. FastLED are not compatible with the STM8s003. Do you have any idea how I can solve this? I would prefer to be able to continue using the Arduino IDE as before.

7 REPLIES 7
Erik1
Associate

I have found a librarie but one date is lost:

https://github.com/thielj/FastLED-STM8/tree/master

FastLED/platforms/stm8/hal/iostm8.h

Peter BENSCH
ST Employee

Welcome @Erik1, to the community!

Since it is a library from Github (forked the project from FastLED) that has nothing to do with STMicroelectronics, you would have to ask the developer there, but he doesn't seem to want to be approached. I suspect that one of the files STM8S003F3.h or STM8S003K3.h needs to be copied to stm8/hal and renamed to iostm8.h.

Hope that helps?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Andrew Neil
Evangelist III

@Erik1 wrote:

 Do you have any idea how I can solve this? I would prefer to be able to continue using the Arduino IDE as before.


Three options:

  1. Understand how the existing libraries (eg FastLED) work, and port that to STM8;
  2. Find a library for STM8;
  3. Create STM8 code by working from first principles:
    http://www.8052mcu.com/forum/read/160143 

 


@Erik1 wrote:

I would prefer to be able to continue using the Arduino IDE as before.


Seems there is some Arduino support for STM8:

https://www.google.com/search?q=Arduino+core+available+for+STM8 

 


@Erik1 wrote:

I have found a librarie but one date is lost:

https://github.com/thielj/FastLED-STM8/tree/master

FastLED/platforms/stm8/hal/iostm8.h


Did you follow the instructions for getting help with that library?

AndrewNeil_0-1715087399417.png

 

Andrew Neil
Evangelist III

Does it have to be WS2812B ?

eg, APA102 or SK9822 use a standard SPI connection - so you wouldn't have to mess about with bit-banging the proprietary critical timing of WS2812B ...

Michal Dudka
Senior III

Regardless of what environment or microcontroller you use there is one elegant solution - use SPI MOSI signal (ignore SCK). Imagine you have SPI running at 8MHz. When you send value 0b01110000 SPI generate positive pulse with duration 3*125ns (375ns) and followed by negative value with duration (5)*125ns(625ns). Which is legal WS2812 bit with value "0". If you want to send "1" bit, then you simply send value 0b01111100 (625ns in High + 375ns in Low). By this method you can overcome problems with precise "delays" and moreover you can also pack two WS2812 bits into one SPI byte (!). For example 3MHz SPI can generate 0b0100  (333ns pulse, 999ns space) + 0b0110  (666ns pulse, 666ns space).

 

Indeed - have done this on an nRF chip!

Same approach can also be used for some other "bit-bang" applications; eg, it has been done with the Maxim/Dallas 1-Wire(TM) protocol ...