Skip to content

FastLED does not work on STM32/BluePill  #744

Closed

Description

@AndKe

Arduino 1.8.8 , FastLED current master, the LED strip is working fine with this library on a Atmega328:

On a BluePill , STM32F103C8 , with STM32duino bootloader, I tried the example "ColorPalette"
changed only "#define LED_PIN"

to 17 as "PA7" is not recognized
then tried PB5 , (recognized).
no LED activity.

Activity

  1. focalintent commented on Feb 23, 2019

    @focalintent
    Contributor

    FYI, the stm32 support is very loose - I don’t actually have any stm32 hardware to test with, outside of the photon, and so mostly have been relying on what other folks supply for the code - especially for things like pin/port mapping.

  2. AndKe commented on Feb 23, 2019

    @AndKe
    Author
  3. AndKe commented on Feb 27, 2019

    @AndKe
    Author

    I have tried both to address port as PB5 or "41" - no success.
    I've also checked with oscilloscope, and there is no save output on any pins,
    This is a map of what works , and what not:
    (existing port/pins) OK(pins recognized) "not"= pins not recognized
    //PA 0...7,13,14 OK=2,3,4,13,14 (not 0,1,5...7)
    //PB 0..15 OK=0...6 14,15 (not 7..12)
    //PC 13,14,15 OK=13,14,15

    Example: "PA2" works, "PA6" does not.
    This tells me that it is likely, that the pin defines for "Blue Pill" does not apply as expected here: https://github.com/FastLED/FastLED/blob/master/platforms/arm/stm32/fastpin_arm_stm32.h#L107

    nor do I see anything that defines "STM32F1"

    andre@loke:~/Downloads/FastLED-master$ grep -inr "STM32F1"
    led_sysdefs.h:22:#elif defined(STM32F10X_MD) || defined(STM32F1)
    platforms/arm/stm32/led_sysdefs_arm_stm32.h:16:#elif defined (STM32F1)
    platforms/arm/stm32/fastpin_arm_stm32.h:61:#elif defined(STM32F1)
    platforms/arm/stm32/fastpin_arm_stm32.h:107:#if defined(STM32F1) // Generic STM32F103 aka "Blue Pill"
    platforms/arm/stm32/fastpin_arm_stm32.h:152:#endif // STM32F1
    platforms.h:22:#elif defined(STM32F10X_MD) || defined(STM32F1)

  4. changed the title [-]Does not work on STM32[/-] [+]Does not work on STM32 : BOUNTY US$40 for making it work.[/+] on Mar 1, 2019
  5. changed the title [-]Does not work on STM32 : BOUNTY US$40 for making it work.[/-] [+]FastLED does not work on STM32/BluePill : BOUNTY US$40 for making it work.[/+] on Mar 17, 2019
  6. stujamac commented on Apr 9, 2019

    @stujamac

    So I have had the same issue, it seems to be a simple issue in that the pins are defined wrongly in "fastpin_arm_stm32.h".
    _DEFPIN_ARM is being called with the physical pin number as parameter 1, whereas it should be the required Arduino pin that it will be aliased as.
    Am testing on a Maple Mini and all seem to work now I have got the defines straightened out. As mentioned above

  7. Abhyudaya98 commented on Sep 6, 2019

    @Abhyudaya98

    Arduino 1.8.8 , FastLED current master, the LED strip is working fine with this library on a Atmega328:

    On a BluePill , STM32F103C8 , with STM32duino bootloader, I tried the example "ColorPalette"
    changed only "#define LED_PIN"

    to 17 as "PA7" is not recognized
    then tried PB5 , (recognized).
    no LED activity.

    I was dealing with the same issue of getting WS2812B leds work with my blue pill using the fastLED library. I found a quick fix to this issue - I set the variant to be STM32F103CB (20k RAM, 128k flash) instead of (20k RAM, 64k flash) in the tools menu of the Arduino IDE - which helped me bypass the error messages. You can venmo me if this works 🤑

  8. berylleigh commented on Sep 10, 2019

    @berylleigh

    I have it working.

    I have used fastpin_arm_stm32.h from here: https://github.com/13rac1/FastLED-STM32. I simply replaced the existing file in FastLED\platforms\arm\stm32 with the one from the stm32 fork git. The pin mapping that works looks like this (though get the file as the formatting didn't copy correctly):

    `#if defined(STM32F1)
    #define _RD32(T) struct _gen_struct ## T { static attribute((always_inline)) inline gpio_reg_map* r() { return T->regs; } };
    #define _IO32(L) _RD32(GPIO ## L)

    _IO32(A); _IO32(B); _IO32(C); _IO32(D);

    #define MAX_PIN PB1

    _DEFPIN_ARM(PB11, 11, B);
    _DEFPIN_ARM(PB10, 10, B);
    _DEFPIN_ARM(PB2, 2, B);
    _DEFPIN_ARM(PB0, 0, B);
    _DEFPIN_ARM(PA7, 7, A);
    _DEFPIN_ARM(PA6, 6, A);
    _DEFPIN_ARM(PA5, 5, A);
    _DEFPIN_ARM(PA4, 4, A);
    _DEFPIN_ARM(PA3, 3, A);
    _DEFPIN_ARM(PA2, 2, A);
    _DEFPIN_ARM(PA1, 1, A);
    _DEFPIN_ARM(PA0, 0, A);
    _DEFPIN_ARM(PC15, 15, C);
    _DEFPIN_ARM(PC14, 14, C);
    _DEFPIN_ARM(PC13, 13, C);
    _DEFPIN_ARM(PB7, 7, B);
    _DEFPIN_ARM(PB6, 6, B);
    _DEFPIN_ARM(PB5, 5, B);
    _DEFPIN_ARM(PB4, 4, B);
    _DEFPIN_ARM(PB3, 3, B);
    _DEFPIN_ARM(PA15, 15, A);
    _DEFPIN_ARM(PA14, 14, A);
    _DEFPIN_ARM(PA13, 13, A);
    _DEFPIN_ARM(PA12, 12, A);
    _DEFPIN_ARM(PA11, 11, A);
    _DEFPIN_ARM(PA10, 10, A);
    _DEFPIN_ARM(PA9, 9, A);
    _DEFPIN_ARM(PA8, 8, A);
    _DEFPIN_ARM(PB15, 15, B);
    _DEFPIN_ARM(PB14, 14, B);
    _DEFPIN_ARM(PB13, 13, B);
    _DEFPIN_ARM(PB12, 12, B);
    _DEFPIN_ARM(PB8, 8, B);
    _DEFPIN_ARM(PB1, 1, B);

    #define SPI_DATA BOARD_SPI1_MOSI_PIN
    #define SPI_CLOCK BOARD_SPI1_SCK_PIN

    #define HAS_HARDWARE_PIN_SUPPORT

    #endif`
    fastpin_arm_stm32.zip

  9. AndKe commented on Mar 7, 2020

    @AndKe
    Author

    I have been trying to make it work on STM32 Core, not the stmduino, as STM32 Core is significantly better/more developed.

  10. SWAT10101 commented on Jun 24, 2020

    @SWAT10101

    hello, guys, I have this code and I can't verify to STM32F103C everything ok but when I set DATA_PIN to A1, I got this error but when I change the board to UNO It works find.
    Also, I try to use this library but when set pin A1 I got this error message
    Adalight_WS2812:25:47: error: wrong number of template arguments (2, should be 1) FastLED.addLeds<NEOPIXEL, A1>(leds, NUM_LEDS); exit status 1 'A1' was not declared in this scope
    Is this library support board, Is there any way to run this code on the board?

    Capture

  11. added a commit that references this issue on Aug 1, 2025
  12. vishwamartur commented on Aug 11, 2025

    @vishwamartur
    Contributor

    @AndKe
    Sir how to claim this bounty

  13. AndKe commented on Aug 11, 2025

    @AndKe
    Author

    Oh, hello - it would require time travel. I had a project that could use that >6 years ago. :(

  14. changed the title [-]FastLED does not work on STM32/BluePill : BOUNTY US$40 for making it work.[/-] [+]FastLED does not work on STM32/BluePill [/+] on Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions