Skip to content

Conversation

vishwamartur
Copy link
Contributor

@vishwamartur vishwamartur commented Jul 31, 2025

Summary

This PR fixes the STM32F1 pin mapping issue reported in #744, which prevented FastLED from working on Blue Pill and other STM32F1 boards.

Problem

The issue was that FastLED's pin definition selection logic was too restrictive, causing most STM32F1 boards to fall back to broken legacy pin definitions that use arbitrary Arduino pin numbers instead of proper STM32 pin names like PA7, PB5, etc.

Users experienced:

  • Compilation errors when using STM32 pin names like PA7
  • No LED activity even when compilation succeeded
  • Need for manual workarounds or file replacements

Solution

Expanded the USE_NEW_STM32_PIN_DEFINITIONS condition in src/platforms/arm/stm32/fastpin_arm_stm32.h to include all common STM32F1 board definitions:

// Before (restrictive)
#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_MAPLE_MINI) || ...

// After (comprehensive)
#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_MAPLE_MINI) || ... || defined(__STM32F1__) || defined(STM32F1) || defined(STM32F103C8) || ...

Changes

  • ✅ Expanded pin definition selection to cover all STM32F1 variants
  • ✅ Enables proper recognition of STM32 pin names (PA7, PB5, PC13, etc.)
  • ✅ Fixes both compilation errors and runtime pin mapping issues
  • ✅ Backward compatible with existing working configurations
  • ✅ No breaking changes

Testing

Verified that:

  • USE_NEW_STM32_PIN_DEFINITIONS is now properly defined for STM32F1 boards
  • Pin names mentioned in the original issue are now available
  • The fix works with multiple STM32F1 macro definitions

Impact

This fix resolves the core issue preventing FastLED from working on:

  • Blue Pill STM32F103C8 boards
  • Other STM32F1 variants using STM32duino
  • Generic STM32F103 configurations

Users can now use FastLED on STM32F1 boards with standard syntax:

FastLED.addLeds<NEOPIXEL, PA7>(leds, NUM_LEDS);  // Now works!
FastLED.addLeds<WS2812, PB5, GRB>(leds, NUM_LEDS);  // Now works!

Related Issues

Fixes #744 - FastLED does not work on STM32/BluePill ($40 bounty issue)

Checklist

  • Code follows the project's coding standards
  • Changes are backward compatible
  • Fix addresses the root cause of the issue
  • No breaking changes introduced
  • Tested with multiple STM32F1 configurations

- Expand USE_NEW_STM32_PIN_DEFINITIONS condition to include all STM32F1 variants
- Fixes pin mapping for Blue Pill and other STM32F1 boards
- Enables proper recognition of STM32 pin names like PA7, PB5, PC13
- Resolves compilation errors and non-functional pin assignments
- Backward compatible with existing working configurations

The legacy pin definitions used incorrect Arduino pin numbers instead of
STM32 pin names, causing FastLED to fail on most STM32F1 boards. This
fix ensures all STM32F1 boards use the correct pin definitions from
fastpin_arm_stm_new.h instead of the broken legacy definitions.

Fixes FastLED#744
@zackees
Copy link
Member

zackees commented Aug 1, 2025

all in one commit too.

Nice.

@zackees zackees merged commit 1480e8a into FastLED:master Aug 1, 2025
5 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FastLED does not work on STM32/BluePill
2 participants