Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 877dev/0c91ac2179f1351a37f07b14ffbde4ee to your computer and use it in GitHub Desktop.
Save 877dev/0c91ac2179f1351a37f07b14ffbde4ee to your computer and use it in GitHub Desktop.
2023-02-15 SKR Mini E3 v2.0 & Neopixels, BL Touch (updated version)

(2023-02-15 version) - rewrite of older guide, this includes BLTouch and Neopixel stick firmware changes, start/end g-code and troubleshooting.

DESCRIPTION:

This is my process of compiling Marlin firmware for the following configuration:

Hardware:
Ender 3 Pro
SKR mini E3 V2.0
Adafruit Neopixel stick with 8 LED's (RGB)
BLTouch V3.1 (check trigger = PC14 and PWM = PA1 like mine is on SKR Mini E3 V2.0)

Software:
VSCode 1.75.1
VSCode extension PlatformIO IDE v3.0.0 VSCode extension Auto Build Marlin 2.1.45

Marlin bugfix 2.1.x (downloaded 2023-02-13) Marlin bugfix configs (downloaded 2023-02-13)

RECOMMENDED READING (NOT ESSENTIAL):

BLTouch: https://www.youtube.com/watch?v=eF060dBEnfs
or https://teachingtechyt.github.io/upgrades.html#bltouch

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

DOWNLOAD FILES:

Download latest 2.1.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 2.1.x 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.1.x\Marlin (replace all)

COMPILE FILES (TEST):

Open VScode (ensure PlatformIO and Marlin autobuild extensions are installed)
Explorer > Open Folder > D:\Marlin-bugfix-2.1.x > Select Auto Build Marlin > Build (compile) - use STM32F103RE_btt (512K)

Check all compiled successfully, a good starting point! Note we don't need this firmware.bin as it's just a template and not configured yet. Click Clean to delete.

When firmware is all configured correctly just do the following:

  • Click on folder icon to get the firmware.bin
  • Copy to SDcard and insert into SKR to upload (backup previous SDcard version if want to).

FIRMWARE CHANGES FOR BLTOUCH

CONFIGURATION.H (search, copy and replace, ignore *** lines for info only):

Enable BLTouch (uncomment):
#define BLTOUCH

Enable bilinear (uncomment only this one):

//#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR
#define  AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING

Uncomment:
#define Z_SAFE_HOMING

Comment out:
//#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

Uncomment
#define USE_PROBE_FOR_Z_HOMING

Uncomment and change pin to this:
#define Z_MIN_PROBE_PIN PC14 // 877 - PC14 is the pin for SKR mini E3 v2.0

Uncomment if not already:
#define LCD_BED_LEVELING

Set BLTouch offsets (REMEASURE TO CHECK THESE ARE CORRECT):
#define NOZZLE_TO_PROBE_OFFSET { -43.6, -6, -2.1 } //877 our measured offsets, Z can also be configured with Z offset wizard on LCD screen

Optional to change grid probe to 3 x 3 grid:

#if  EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)

// Set the number of grid points per dimension.
#define GRID_MAX_POINTS_X 3
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X

Optional to increase grid probe speed:

// X and Y axis travel speed (mm/min) between probes
#define  XY_PROBE_FEEDRATE (133*60)

Optional Homing speed vertical movement:

// Homing speeds (linear=mm/min, rotational=°/min)
#define  HOMING_FEEDRATE_MM_M { (20*60), (20*60), (4*60) } //877 not changed but for future maybe to speed up vertical homing speed. Prob won't use.

Optionally set e-steps to a know value (X, Y, Z, E):
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 94.9 } //877 added our E-steps 94.9

Optionally set PLA presets:

// Preheat Constants
#define PREHEAT_1_LABEL       "PLA"
#define PREHEAT_1_TEMP_HOTEND 210   // 877 default 185
#define PREHEAT_1_TEMP_BED     45
#define PREHEAT_1_FAN_SPEED   255 // Value from 0 to 255

CONFIGURATION_ADV.H (search, copy and replace, ignore *** lines for info only):

Uncomment:
#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping

Uncomment:
#define PROBE_OFFSET_WIZARD

Configure BLTouch probing offsets relative to bed:

#if PROBE_SELECTED && !IS_KINEMATIC   // 877 for symmetrical probing area, MUST BE LARGER THAN PROBE OFFSET!
  #define PROBING_MARGIN_LEFT 45
  #define PROBING_MARGIN_RIGHT 45
  #define PROBING_MARGIN_FRONT 15
  #define PROBING_MARGIN_BACK 15
#endif

FIRMWARE CHANGES FOR NEOPIXEL

CONFIGURATION.H (search, copy and replace, ignore *** lines for info only):

Replace whole section with this (for Neopixel strip of 8 LED's):

// Support for Adafruit NeoPixel LED driver
#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
  #define NEOPIXEL_TYPE   NEO_GRB // 877 NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
  #define NEOPIXEL_PIN     PA8       // 877 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   // 877 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

  // Support for second Adafruit NeoPixel LED driver controlled with M150 S1 ...
  //#define NEOPIXEL2_SEPARATE
  #if ENABLED(NEOPIXEL2_SEPARATE)
    #define NEOPIXEL2_PIXELS      15  // Number of LEDs in the second strip
    #define NEOPIXEL2_BRIGHTNESS 127  // Initial brightness (0-255)
    #define NEOPIXEL2_STARTUP_TEST    // Cycle through colors at startup
  #else
    //#define NEOPIXEL2_INSERIES      // Default behavior is NeoPixel 2 in parallel
  #endif

  // Use a single NeoPixel LED for static (background) lighting
  //#define NEOPIXEL_BKGD_LED_INDEX  0               // Index of the LED to use
  //#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W
#endif

CONFIGURATION_ADV.H (search, copy and replace, ignore *** lines for info only):

Replace whole section with this:

  /**
   * LED Control Menu
   * Add LED Control to the LCD menu
   */
  #define LED_CONTROL_MENU                    //877 uncommented
  #if ENABLED(LED_CONTROL_MENU)
    #define LED_COLOR_PRESETS                 // Enable the Preset Color menu option
    //#define NEO2_COLOR_PRESETS              // Enable a second NeoPixel Preset Color menu option
    #if ENABLED(LED_COLOR_PRESETS)
      #define LED_USER_PRESET_RED        255  //              User defined RED value
      #define LED_USER_PRESET_GREEN      255  // 877 was 128  User defined GREEN value
      #define LED_USER_PRESET_BLUE       255  // 877 was 0    User defined BLUE value
      #define LED_USER_PRESET_WHITE      255  //              User defined WHITE value
      #define LED_USER_PRESET_BRIGHTNESS 128  // 877 was 255  User defined intensity
      #define LED_USER_PRESET_STARTUP         //877 uncommented // Have the printer display the user preset color on startup
    #endif
    #if ENABLED(NEO2_COLOR_PRESETS)
      #define NEO2_USER_PRESET_RED        255 // User defined RED value
      #define NEO2_USER_PRESET_GREEN      128 // User defined GREEN value
      #define NEO2_USER_PRESET_BLUE         0 // User defined BLUE value
      #define NEO2_USER_PRESET_WHITE      255 // User defined WHITE value
      #define NEO2_USER_PRESET_BRIGHTNESS 255 // User defined intensity
      //#define NEO2_USER_PRESET_STARTUP      // Have the printer display the user preset color on startup for the second strip
    #endif
  #endif

CURA START/END GCODE TO TAKE ADVANTAGE OF THE ABOVE:

Start G-code:

; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
G29 ; BLTouch probing
M104 S{material_standby_temperature} ; Start heating up the nozzle most of the way
M190 S{material_bed_temperature_layer_0} ; Start heating the bed, wait until target temperature reached
M109 S{material_print_temperature_layer_0} ; Finish heating the nozzle
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish

End G-code:

; Ender 3 Custom End G-code

G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z10 ;Raise Z more
G90 ;Absolute positioning

M150 R0 U50 B0 ;877 turn Neopixel green

G1 X0 Y{machine_depth} ;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed

M84 X Y E ;Disable all steppers but Z

GENERAL COMMON COMPILE 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:

For 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 SPECIFIC TROUBLESHOOTING:

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

  1. 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)

  2. To fix random LED colour issues such as here bigtreetech/BIGTREETECH-SKR-mini-E3#286 edit platformio.ini and change the following (line 221 or near that):

NEOPIXEL_LED            = https://github.com/CommandoreBombardiero/Adafruit_NeoPixel  

then edit .pio\libdeps\STM32F103RC_btt_512K\Adafruit NeoPixel\Adafruit_NeoPixel.cpp to this:

//Locate Delay.h file in your local Marlin copy and enter full path to this file below
#include <D:\Marlin-bugfix-2.0.x\Marlin\src\HAL\shared\Delay.h>

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