This is a rough document on how to compile Marlin 2.0.9 for the Ender 5 Pro, using the BLTouch bed levelling sensor plugged into the BL_T port of the v4.2.2 motherboard. Be aware that the v4.2.7 motherboard uses different motor drivers and could be quite different from the v4.2.2 described here.
Get yourself a directory to work in
Clone the Marlin firmware source tree
git clone https://github.com/MarlinFirmware/Marlin ~/src/Marlin/Marlin
This will default to the 2.0.x branch. This should be fine.
Clone the Marlin configurations source tree
git clone https://github.com/MarlinFirmware/Configurations ~/src/Marlin/Configurations
This will also default to the import-2.0.x branch. This is crucial, as the master branch does not have the required changes.
Copy the V422 board configuration into the Marlin tree
cp Configurations/config/examples/Creality/Ender-5\ Pro/CrealityV422/* Marlin/Marlin/
Now edit ~/src/Marlin/Marlin/platformio.ini and ensure the following property is set appropriately.
default_envs = STM32F103RET6_creality
If you wish to do a test build:
platformio run -e STM32F103RET6_creality
Now that we are confident the build environment is correct, it’s time to edit some of the information in ~/src/Marlin/Marlin/Marlin/Configuration.h. You will have copied this file over from the Configurations source tree earlier.
Additionally, there is some very useful information provided by a commenter on Github regarding the configuration of the BLTouch module
All five pins into the Bltouch port
2. 3 pins in BlTouch port and 2 in Z stop port
3. Creality's err way (to use up old v1/v2 SKU kits) is 2 pins into z stop port and connect a adaptor board into the screen display port...
My particular BLTouch confniguration is that all 5 pins are plugged into the BLtouch port, marked BL_T
The Z Axis limit switch, however, is disconnected as it was interfering with the travel of the Z axis when using BLTouch for limit sensing.
Firstly, enable BLTouch support by uncommenting
Ensure the Z probe is within the limits of the XY axis by uncommenting
Disable the use of the Z-Min pin, by commenting out
To force the use of the BLTouch for Z homing, uncomment
And just for the sake of completeness, a diff file of Configuration.h
< // #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
< #define USE_PROBE_FOR_Z_HOMING
< #define BLTOUCH
< #define Z_SAFE_HOMING
It should now be good to go, and the build can be started with platformio run -e STM32F103RET6_creality
The resultant .bin file in ~/src/Marlin/Marlin/.pio/build/STM32F103RET6_creality/ is the firmware that should be put on an SDCard, loaded into the printer, and then powered up with.