Skip to content

ESP32 - No hardware SPI pins defined. #1169

Closed

Description

@kooscode

This is false, the ESP32 has hardware pins AND I am specifying the hardware SPI MOSI pin...

my test code:

CRGB leds[NUM_LEDS];
void setup() 
{
  LEDS.addLeds<WS2811, GPIO_NUM_23, GRB>(leds,NUM_LEDS);
  LEDS.setBrightness(BRIGHT_LEDS);
}

WARNINGS:

                 from src/main.cpp:3:
.pio/libdeps/esp32dev/FastLED/src/fastspi.h:135:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
 #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"```

Activity

  1. changed the title [-]ESP32 - : No hardware SPI pins defined.[/-] [+]ESP32 - No hardware SPI pins defined.[/+] on Jan 7, 2021
  2. samguyer commented on Jan 15, 2021

    @samguyer
    Contributor

    @kooscode This message is just a warning, and all it's telling you is that FastLED isn't using the SPI protocol to send the bits. We actually never use SPI to send the signal for clockless chips like the WS281x family. We should really just get rid of the warning.

  3. marmilicious commented on Jan 15, 2021

    @marmilicious
    Contributor

    I feel like we've been asked about that message many times over the years. Unless it's needs to be shown in some specific case I think removing it would be a fine idea.

  4. samguyer commented on Jan 15, 2021

    @samguyer
    Contributor
  5. kooscode commented on Jan 17, 2021

    @kooscode
    Author

    I made an issue for myself to make that message go away.

    Thank you !!

  6. stickperson commented on Oct 23, 2021

    @stickperson

    Seeing as this issue is still open, it looks like support for hardware SPI was added by #1047. I don't see any mention of the required define statements (#define FASTLED_ALL_PINS_HARDWARE_SPI or #define FASTLED_ESP32_SPI_BUS HSPI) anywhere in the documentation though.

  7. ByronAP commented on Jan 4, 2022

    @ByronAP

    Same issue as #1047 (comment) here when using ESP32 S2

  8. robertlipe commented on Aug 30, 2023

    @robertlipe
    Contributor

    @samguyer , these #pragma warnings are still there and they're still confusing people. This issue seems to have become a dumping ground for lots of unrelated things, but I think the fundamental "fastled whines about SOMETHING, no matter how I configure it" issue is still there and still valid.

    Do you still have that commit that deletes them in the queue or would you like me to prep a PR that just deletes those lines?

  9. samguyer commented on Aug 30, 2023

    @samguyer
    Contributor

    I don't have that commit information handy. But I think it's a good call. We still get a lot of questions about the warnings.

  10. robertlipe commented on Aug 30, 2023

    @robertlipe
    Contributor

    FWIW, even in my own project, I find them annoying. (My build highlights warnings and errors in red to help distinguish them from the flood of text in modern builds.) I'll prep a PR later tonight that nukes them from orbit, @samguyer .

    They were well-intentioned, but I think it'll remove user confusion and some amount of support traffic.

  11. versamodule commented on Sep 14, 2023

    @versamodule

    Using the ESP32-S3 with PlatformIO. Does not even compile for me with errors about SPI pins.

    
    Building in release mode
    Compiling .pio\build\m5stack-stamps3\src\main.cpp.o
    Compiling .pio\build\m5stack-stamps3\lib3db\SPI\SPI.cpp.o
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp: In member function 'void SPIClass::begin(int8_t, int8_t, int8_t, int8_t)':
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:87:37: error: 'SCK' was not declared in this scope
             _sck = (_spi_num == FSPI) ? SCK : -1;
                                         ^~~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:87:37: note: suggested alternative: 'SCL'
             _sck = (_spi_num == FSPI) ? SCK : -1;
                                         ^~~
                                         SCL
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:88:38: error: 'MISO' was not declared in this scope
             _miso = (_spi_num == FSPI) ? MISO : -1;
                                          ^~~~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:89:38: error: 'MOSI' was not declared in this scope
             _mosi = (_spi_num == FSPI) ? MOSI : -1;
                                          ^~~~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:90:36: error: 'SS' was not declared in this scope
             _ss = (_spi_num == FSPI) ? SS : -1;
                                        ^~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:90:36: note: suggested alternative: 'PS'
             _ss = (_spi_num == FSPI) ? SS : -1;
                                        ^~
                                        PS
    *** [.pio\build\m5stack-stamps3\lib3db\SPI\SPI.cpp.o] Error 1
    In file included from .pio/libdeps/m5stack-stamps3/FastLED/src/FastLED.h:75,
                     from src/main.cpp:5:
    .pio/libdeps/m5stack-stamps3/FastLED/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
     #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ==================================================================================== [FAILED] Took 2.79 seconds ====================================================================================
     *  The terminal process "C:\Users\Jim\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 
    
  12. glpalma commented on Sep 24, 2023

    @glpalma

    Using the ESP32-S3 with PlatformIO. Does not even compile for me with errors about SPI pins.

    
    Building in release mode
    Compiling .pio\build\m5stack-stamps3\src\main.cpp.o
    Compiling .pio\build\m5stack-stamps3\lib3db\SPI\SPI.cpp.o
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp: In member function 'void SPIClass::begin(int8_t, int8_t, int8_t, int8_t)':
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:87:37: error: 'SCK' was not declared in this scope
             _sck = (_spi_num == FSPI) ? SCK : -1;
                                         ^~~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:87:37: note: suggested alternative: 'SCL'
             _sck = (_spi_num == FSPI) ? SCK : -1;
                                         ^~~
                                         SCL
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:88:38: error: 'MISO' was not declared in this scope
             _miso = (_spi_num == FSPI) ? MISO : -1;
                                          ^~~~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:89:38: error: 'MOSI' was not declared in this scope
             _mosi = (_spi_num == FSPI) ? MOSI : -1;
                                          ^~~~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:90:36: error: 'SS' was not declared in this scope
             _ss = (_spi_num == FSPI) ? SS : -1;
                                        ^~
    C:/Users/Jim/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:90:36: note: suggested alternative: 'PS'
             _ss = (_spi_num == FSPI) ? SS : -1;
                                        ^~
                                        PS
    *** [.pio\build\m5stack-stamps3\lib3db\SPI\SPI.cpp.o] Error 1
    In file included from .pio/libdeps/m5stack-stamps3/FastLED/src/FastLED.h:75,
                     from src/main.cpp:5:
    .pio/libdeps/m5stack-stamps3/FastLED/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
     #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ==================================================================================== [FAILED] Took 2.79 seconds ====================================================================================
     *  The terminal process "C:\Users\Jim\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 
    

    I have the exact same error. I saw on another post (which I can't find right now) that defining FASTLED_ALL_PINS_HARDWARE_SPI before including the library could solve this issue, but the errors remain the same.

    The code I'm trying to use is the one found in M5Stack's StampS3 repo.

    I am trying to flash the board using PlatformIO and this is my .ini file:

    [env:m5stack-stamps3]
    platform = espressif32
    board = m5stack-stamps3
    framework = arduino
    lib_deps = fastled/FastLED@^3.6.0
    
  13. huster-songtao commented on Nov 7, 2023

    @huster-songtao

    Using the XIAO_ESP32 C3 with Arduino.

    
    ////////////////////////////////////////////////////////////////////////////////
    // Arduino SmartLed.ino
    // Copyright (C) 2023 Bot <[email protected]>
    // 
    // IDE:
    //   Arduino 2.2.1
    // Platform:
    //   esp32 3.0.0-alpha2 - https://github.com/espressif/arduino-esp32
    // Board:
    //   XIAO_ESP32 C3
    // Board Settings:
    //   USB CDC On Boot: Enabled
    //   CPU Frequency: 160MHz(WiFi)
    //   Core Debug Level: None
    //   Erase All Flash Before Sketch Upload: Disabled
    //   Flash Frequency: 80MHz
    //   Flash Mode: QIO
    //   Flash Size: 4MB(32Mb)
    //   Partition Scheme: Default 4MB with spiffs(1.2MB APP/1.5MB SPIFFS)
    //   Upload Speed: 921600
    // Libraries:
    //   elapsedMillis 1.0.6 - https://github.com/pfeerick/elapsedMillis
    
    #include "FastLED.h" 
     
    #define NUM_LEDS 364 
    #define DATA_PIN 10 
    #define LED_TYPE WS2812
    #define COLOR_ORDER RGB   
     
    uint8_t max_bright = 128;   
     
    CRGB leds[NUM_LEDS];  
    
    void setup() {
      // put your setup code here, to run once:
      LEDS.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); 
      FastLED.setBrightness(max_bright);       
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      leds[0] = CRGB::Red;      
      FastLED.show();           
      delay(50);               
    
      leds[0] = CRGB::Black;
      FastLED.show();
      delay(1000);
    }
    
    

    The code above throw exception:
    In file included from d:\Arduino\Sketchbook\libraries\FastLED\src/FastLED.h:75,
    from D:\Arduino_SmartLed\Arduino_SmartLed.ino:24:
    d:\Arduino\Sketchbook\libraries\FastLED\src/fastspi.h:157:23: note: '#pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output'
    157 | # pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    d:\Arduino\Sketchbook\libraries\FastLED\src\platforms\esp\32\clockless_rmt_esp32.cpp: In member function 'void ESP32RMTController::startOnChannel(int)':
    d:\Arduino\Sketchbook\libraries\FastLED\src\platforms\esp\32\clockless_rmt_esp32.cpp:266:29: error: 'RMTMEM' was not declared in this scope
    266 | mRMT_mem_start = & (RMTMEM.chan[mRMT_channel].data32[0].val);
    | ^~~~~~
    d:\Arduino\Sketchbook\libraries\FastLED\src\platforms\esp\32\clockless_rmt_esp32.cpp: In static member function 'static void ESP32RMTController::doneOnChannel(rmt_channel_t, void*)':
    d:\Arduino\Sketchbook\libraries\FastLED\src\platforms\esp\32\clockless_rmt_esp32.cpp:347:5: error: 'gpio_matrix_out' was not declared in this scope; did you mean 'gpio_iomux_out'?
    347 | gpio_matrix_out(pController->mPin, 0x100, 0, 0);
    | ^~~~~~~~~~~~~~~
    | gpio_iomux_out

    exit status 1

    Compilation error: exit status 1

    I must add, FastLED is a masterpiece.
    Platform: esp32 3.0.0-alpha2 - https://github.com/espressif/arduino-esp32
    Downgrading to a lower version such as 2.0.14 or 2.0.15, the problem went away.

  14. johnwargo commented on Nov 12, 2023

    @johnwargo

    @huster-songtao you should make a new issue for your problem as this thread is all about bit bang output, not the specific error you're having.

  15. 5 remaining items

  16. huster-songtao commented on Dec 11, 2023

    @huster-songtao

    @nicelight pls check your esp32, do not use 3.0.0-alpha, you can use 2.0.14. It work well for me.
    微信截图_20231211221642

    #define FASTLED_INTERNAL //remove annoying pragma messages
    #include <FastLED.h>
    

    you can add code : #define FASTLED_INTERNAL //remove annoying pragma messages

  17. zGigit commented on Feb 17, 2024

    @zGigit

    This is false, the ESP32 has hardware pins AND I am specifying the hardware SPI MOSI pin...
    my test code:

    CRGB leds[NUM_LEDS];
    void setup() 
    {
      LEDS.addLeds<WS2811, GPIO_NUM_23, GRB>(leds,NUM_LEDS);
      LEDS.setBrightness(BRIGHT_LEDS);
    }
    

    WARNINGS:

                     from src/main.cpp:3:
    .pio/libdeps/esp32dev/FastLED/src/fastspi.h:135:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
     #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"```
    

    Hi. There is the way how to deal with: Go to file ~\Documents\Arduino\libraries\FastLED\src\fastspi.h delete lines 142 -149. don't delete line 150: #endif save file. Profit

    I don't know why this warning message grinds my gears so, but here we are.

    I found nicelight's solution muy bweño callieyentay indeed. It got me 99% to this solution, so credit where due.

    Except, either the code has shifted since the time of the post, or it is possible the block they specifically removed worked to stop the message for their specific hardware. Because, while it didn't fix the issue for me, it also didn't break the code completely for me either.

    But the following instructions should fix it, irrespective of shifting code, or whichever your chip of choice:

    STEP 1:
    In ...\Arduino\libraries\FastLED\src\fastspi.h, find the block pragma message itself with cmnd F; and search for "No hardware SPI pins defined.." yada yada..

    As of v 3.6.0, the blocks to comment out are:
    a) lines 154 thru 161
    then skip a few lines that are already commented out, as well as one "#endif",
    and then comment out:
    b) 169 thru 176.

    Which altogether should leave you with:

    `/* #else

    if !defined(FASTLED_INTERNAL) && !defined(FASTLED_ALL_PINS_HARDWARE_SPI)

    ifdef FASTLED_HAS_PRAGMA_MESSAGE

    pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

    else

    warning "No hardware SPI pins defined. All SPI access will default to bitbanged output"

    endif

    endif */

    #endif

    // #if defined(USART_DATA) && defined(USART_CLOCK)
    // template<uint32_t SPI_SPEED>
    // class AVRSPIOutput<USART_DATA, USART_CLOCK, SPI_SPEED> : public AVRUSARTSPIOutput<USART_DATA, USART_CLOCK, SPI_SPEED> {};
    // #endif

    /* #else

    if !defined(FASTLED_INTERNAL) && !defined(FASTLED_ALL_PINS_HARDWARE_SPI)

    ifdef FASTLED_HAS_PRAGMA_MESSAGE

    pragma message "Forcing software SPI - no hardware SPI for you!"

    else

    warning "Forcing software SPI - no hardware SPI for you!"

    endif

    endif */

    #endif`

    Feel free to delete instead of comment out the code, I just prefer the latter (in case one day, overcome with Stockholm Syndrome I realize I've grown to miss the way my heart would palpitate as time fell away, leaving only me and the red text block of judgement that might as well have read: "your code is nothing. and it will never compile to anything."

  18. dragetd commented on Apr 10, 2024

    @dragetd

    Any news on this?

    While I am actually not how this warning can be avoided since it seems to be at macro level - I guess you do not know that I want to control a ws2812b at that time - the message could be at least updated to be less confusing…?

    No hardware SPI pins defined. All SPI access will default to bitbanged output -> No hardware SPI pins defined. All SPI access will default to bitbanged output. If you are using a clockless LED like WS281x, ???, etc., you can safely ignore this warning

    I also tried adding:

    #define FASTLED_ALL_PINS_HARDWARE_SPI
    #define FASTLED_ESP32_SPI_BUS HSPI
    

    Which gives a less confusing message at least.

  19. BCsabaEngine commented on Apr 18, 2024

    @BCsabaEngine

    Any news on this?

    While I am actually not how this warning can be avoided since it seems to be at macro level - I guess you do not know that I want to control a ws2812b at that time - the message could be at least updated to be less confusing…?

    No hardware SPI pins defined. All SPI access will default to bitbanged output -> No hardware SPI pins defined. All SPI access will default to bitbanged output. If you are using a clockless LED like WS281x, ???, etc., you can safely ignore this warning

    I also tried adding:

    #define FASTLED_ALL_PINS_HARDWARE_SPI
    #define FASTLED_ESP32_SPI_BUS HSPI
    

    Which gives a less confusing message at least.

    I have deleted the two top lines from fastspi_esp32.h :(

  20. huster-songtao commented on May 10, 2024

    @huster-songtao

    How to define SPI pins?

  21. geekasylum commented on Jul 29, 2024

    @geekasylum

    Three years on, and we still have this problem.

    In PlatformIO this "warning" causes a fatal compile error and ends compilarion (at least for me and my esp32-s3 setup).

    For those following along behind me, the work-around was posted above by @huster-songtao and is repeated here for efficiency:

    #define FASTLED_INTERNAL //remove annoying pragma messages
    #include <FastLED.h>
    

    This causes FastLED to skip over this code and appears to have resolved the issue for me, so I could move on to other things.

  22. robertlipe commented on Jul 30, 2024

    @robertlipe
    Contributor
  23. coocy commented on Aug 1, 2024

    @coocy

    Three years on, and we still have this problem.

    In PlatformIO this "warning" causes a fatal compile error and ends compilarion (at least for me and my esp32-s3 setup).

    For those following along behind me, the work-around was posted above by @huster-songtao and is repeated here for efficiency:

    #define FASTLED_INTERNAL //remove annoying pragma messages
    #include <FastLED.h>
    

    This causes FastLED to skip over this code and appears to have resolved the issue for me, so I could move on to other things.

    Thanks, this worked for me.

  24. geekasylum commented on Sep 1, 2024

    @geekasylum

    Yes, IMO this warning causes more problems than it solves, but your build should treat warnings as warnings and errors as errors, especially when you don't have right control of the code and build environment. A complier update may change warnings, for example. Building in a new OS or a new cross build would result in breakage. Both sides could improve here, IMO.

    In my case, I simply need to get a job done. I write my code and make it work and that is all I should need to do. I dont have the time, or the will to spend time leaning how a 'build environment' does its job... I only care that it does it. Anything beyond the scope of the code that I have written is maintained by others and is not my concern. I don't need to know the physics of how a hammer works in order to drive a nail. It is simply a tool that I use to get a job done... as is a build environment.

    To that end, I no longer use Platformio. It had a few other issues besides this one. I went back to the Arduino IDE, and reworked the project without depending on this library, since updates to various other things made the example code I was referring to, no longer work, so I came up with something else.

    The point is, there are others like me. We should not have to delve deep into the inner workings of our compilers just to make them 'compile' third party code.

  25. zackees commented on Sep 6, 2024

    @zackees
    Member

    I just tried to repro this case with the supplied code and everything now works fine.

  26. Yourez commented on Mar 3, 2026

    @Yourez

    5+ years. The warning still appears. Workaround

    #define FASTLED_INTERNAL //remove annoying pragma messages
    #include <FastLED.h>
    

    works for me. But does anybody intend to update the lib code?

  27. zackees commented on Mar 3, 2026

    @zackees
    Member

    Try master

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