Enrico Rossi

CTC 3D printer and Marlin firmware

I have decided to upgrade my old CTC Chinese 3D printer during this Christmas time. I already performed this kind of upgrade some years ago, but I did not take any log of it, so now I’m back to square zero with some interesting and unpleasant discoveries.

note: I write this blog’s post weeks later, some passage may be missing or imprecise.

Prepare the platform.io tools.

Marlin1 firmware is develop using Paltform.io2 and to compile it you need to create a compatible environment. Following the documentation online I setup a Python venv and used pip to install the library

python3 -m venv ~/python3
source ~/python3/bin/activate
pip install platformio

Fetch and compile the firmware.

Clone the Marlin1 firmware and the example configurations repository3.

git clone https://github.com/MarlinFirmware/Marlin.git
git clone https://github.com/MarlinFirmware/Configurations.git

Pick the version with the configuration from CTC I3 example:

cd Marlin
git checkout
cp ../Marlin-Configurations/config/examples/CTC/i3 2560 Rev A/no probe/Configuration.h Marlin/

Patch the configuration to fix the bed type, which, in my case, is a 12V

diff --git a/config/examples/CTC/i3 2560 Rev A/no probe/Configuration.h b/config/examples/CTC/i3 2560 Rev A/no probe/Configuration.h
index fc22fdeb98..6905b10b16 100644
--- a/config/examples/CTC/i3 2560 Rev A/no probe/Configuration.h        
+++ b/config/examples/CTC/i3 2560 Rev A/no probe/Configuration.h        
@@ -753,11 +753,16 @@
   //#define MIN_BED_POWER 0
   //#define PID_BED_DEBUG // Print Bed PID debug data to the serial port.
+  // 12v (120 watt?) MK2a PCB Heatbed into 4mm borosilicate (Geeetech Prusa i3 Pro, Pro/B/C/X)
+  #define DEFAULT_bedKp 234.88
+  #define DEFAULT_bedKi 42.79
+  #define DEFAULT_bedKd 322.28
   // 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
   // from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
-  #define DEFAULT_bedKp 10.00
-  #define DEFAULT_bedKi .023
-  #define DEFAULT_bedKd 305.4
+  //#define DEFAULT_bedKp 10.00
+  //#define DEFAULT_bedKi .023
+  //#define DEFAULT_bedKd 305.4
   // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
 #endif // PIDTEMPBED


pio run

Upload the firmware.

to upload the firmware should be enough to

pio run --target upload --upload-port /dev/ttyUSB0

where /dev/ttyUSB0 is where the USB-connected printer appears (fix based on your system). It should work but it didn’t.

The unpleasant discovery

Try to understand what was wrong, after testing and re-compiling I decided to use an Atmel programmer to write the firmware or, better say, to rewrite the bootloader and then re-upload the firmware via USB. I was quite confident my problems were in the bootloader (spoiler alert: I was wrong).

Soon also I realized that the board does NOT have a plug to connect an external programmer!

Fortunately I found this picture showing, in the LCD panel’s connectors, where the required pins are located.

gt2560 connector

Also note that my connectors have been mounted upside-down!

gt2560 with Atmel ICE connected

Connected the programmer and run the AVRdude to check the MCU I received an error regarding wrong MCU type.

Ops… I have a CTC gt2560 board with an atmega1280 microcontroller instead of the atmega2560! And yes, a quick look with lenses at the chip on the board could have spare me an hour or so trying to upload a firmware compiled for a wrong MCU.

Fix the platformio and complete the job

Apply a patch on the palatform.io configuration file to fix the MCU type

diff --git a/platformio.ini b/platformio.ini
index 8b79ea2537..576a2b236a 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -13,7 +13,7 @@
 src_dir      = Marlin
 boards_dir   = buildroot/share/PlatformIO/boards
-default_envs = mega2560
+default_envs = mega1280
 include_dir  = Marlin
 extra_configs =
@@ -276,12 +276,13 @@ monitor_speed     = 250000
 monitor_eol       = LF
 monitor_echo      = yes
 monitor_filters   = colorize, time, send_on_enter
+#upload_protocol = atmelice_isp
 # Just print the dependency tree
 platform         = atmelavr
-board            = megaatmega2560
+board            = megaatmega1280
 build_flags      = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__
 build_src_filter = +<src/MarlinCore.cpp>

compile and install did actually complete without errors.