Skip to content

Instantly share code, notes, and snippets.

@877dev
Last active February 25, 2023 00:10
Show Gist options
  • Save 877dev/2f8cd65118757afb24b7edd6523d09f9 to your computer and use it in GitHub Desktop.
Save 877dev/2f8cd65118757afb24b7edd6523d09f9 to your computer and use it in GitHub Desktop.
Marlin 2.0.x bugfix, SKR Mini E3 v2.0 and Neopixels

(2021-04-21 version)

DESCRIPTION:

This is my experience of getting a Neopixel working with the following:

Hardware:
Ender 3 Pro
SKR mini E3 V2.0
Adafruit Neopixel stick with 8 LED's (RGB)

Software:
VSCode 1.51.1
PlatformIO IDE 2.2.1 extension
Auto Build Marlin 2.2.26 extension
Marlin bugfix 2.0.x (built 19-12-2020)
Marlin bugfix configs

DOWNLOAD FILES:

Download latest 2.0.x bugfix and extract to root e.g. D:/ (this will avoid some issues with files not being found later) https://marlinfw.org/meta/download/

Download latest configs from same page to root e.g. D:/
Open in WinRAR navigate to \config\examples\Creality\Ender-3 Pro\BigTreeTech SKR Mini E3 2.0
Drag and drop the .h config files to D:\Marlin-bugfix-2.0.x\Marlin (replace all)

COMPILE FILES:

Open VScode (ensure PlatformIO and Marlin autobuild are installed)
Open folder D:\Marlin-bugfix-2.0.x\Marlin
Build (compile) to check all ok, use btt (no 512k or usb).
Click on folder icon to get the firmware.bin
Copy to SDcard and insert into SKR to upload.

NEOPIXEL:

To enable Neopixel edit Configuration.h like this:

// Support for Adafruit NeoPixel LED driver
#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
#define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
#define NEOPIXEL_PIN PA8 // LED driving pin
//#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
//#define NEOPIXEL2_PIN 5
#define NEOPIXEL_PIXELS 8 // Number of LEDs in the strip. (Longest strip when NEOPIXEL2_SEPARATE is disabled.)
#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
#define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255)
#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup

NEOPIXEL OPTIONAL (TESTING/TROUBLESHOOTING):

https://www.makenprint.uk/3d-printing/3d-printing-guides/skr-v1-4-adding-neopixel-leds/

  1. Comment out in Configuration.h like this:
    //#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.

  2. Enable in Configuration_adv.h like this:
    #define LED_CONTROL_MENU //enable menu
    #define LED_USER_PRESET_STARTUP //enable user colour after startup test has finished

  3. Copy BTT platformio.ini over the Marlin original one:
    Save and close current folder in VScode
    Download https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3
    Optionally backup D:\Marlin-bugfix-2.0.x\platformio.ini
    Open in WinRAR and copy firmware\V2.0\Marlin-2.0.7.2-SKR-mini-E3-V2.0/platformio.ini to D:\Marlin-bugfix-2.0.x\Marlin (replace)

  4. To fix random LED colour issues such as here bigtreetech/BIGTREETECH-SKR-mini-E3#286
    Edit platformio.ini change the following line 221 (or near that):
    NEOPIXEL_LED = https://github.com/CommandoreBombardiero/Adafruit_NeoPixel
    then:
    Edit .pio\libdeps\STM32F103RC_btt\Adafruit NeoPixel\Adafruit_NeoPixel.cpp to this:

//Locate Delay.h file in your local Marlin copy: Marlin 2.0/Marlin/Marlin/src/HAL/shared/Delay.h
//and enter full path to this file below

#include <D:\Marlin-bugfix-2.0.x\Marlin\src\HAL\shared\Delay.h>

Note if using 512K build you will need to edit .pio\libdeps\STM32F103RC_btt_512K\Adafruit NeoPixel\Adafruit_NeoPixel.cpp

COMMON ERRORS AND HOW TO FIX:

Save the project after each change!

Missing files:

If get errors about missing files, try saving and rebuilding....

Sanity check:

"Sanity check errors, comment this out at your own risk!"
This is due to the Neopixel not being supported by the Marlin firmware, it is thought v2.0 boards are ok though.

To fix go to d:\marlin-bugfix-2.0.x\marlin\src\hal\stm32f1\inc\sanitycheck.h
and change like this:

#if ENABLED(NEOPIXEL_LED)
//#error "NEOPIXEL_LED (Adafruit NeoPixel) is not supported for HAL/STM32F1. Comment out this line to proceed at your own risk!"
#endif

GPIO errors:

Now get error:
".pio\libdeps\STM32F103RC_btt\Adafruit NeoPixel/Adafruit_NeoPixel.h:361:3: error: 'GPIO_TypeDef' does not name a type"

Option 1 : Edit Marlin original platformio.ini and add this line at the end of HAL/STM32F1 Common Environmental values:
custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/bigtreetech/Adafruit_NeoPixel

Option 2: Copy BTT platformio.ini over the Marlin original one:

Save and close current folder in VScode
Download https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3
Optionally backup D:\Marlin-bugfix-2.0.x\platformio.ini
Open in WinRAR and copy firmware\V2.0\Marlin-2.0.7.2-SKR-mini-E3-V2.0/platformio.ini to D:\Marlin-bugfix-2.0.x\Marlin (replace)

Neopixel not turning green at end of print:

MarlinFirmware/Marlin#17024 (comment)
Quote:
printer_event_leds has a few limitation also, the "green color" status is dependant on sdPrint.complete to know when prints are over, so printing over usb doesn't turn the led green.
Yeah it is exactly what is happening, I just put a end G-CODE on cura to tackle that: M150 R0 U50 B0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment