2024-05-04 04:21 AM
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.
2024-05-04 06:27 AM
I have found a librarie but one date is lost:
https://github.com/thielj/FastLED-STM8/tree/master
FastLED/platforms/stm8/hal/iostm8.h
2024-05-07 05:59 AM
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
2024-05-07 06:06 AM
@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:
@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
2024-05-07 06:10 AM
@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?
2024-05-07 06:17 AM
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 ...
2024-05-14 01:42 AM
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).
2024-05-14 01:47 AM
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 ...