Skip to content

Compile&Flash firmware

Mark edited this page Oct 19, 2022 · 40 revisions

Install/Compile/Upload

2. Download PandaZHU marlin source code this code is based on the marlin2.0.8.

3. Opening marlin source code in VScode with Platformio

4. Make sure the board name MOTHERBOARD in the Configuration.h is BOARD_PANDA_ZHU or BOARD_PANDA_M4

5. Choose the PANDA_ZHU or PANDA_M4 list and click build, then download esp32-hal-uart.c and replace the esp32-hal-uart.c in the following path of your computer,

%HOMEPATH%\.platformio\packages\[email protected]\cores\esp32

or else the esp32 will reboot all the time. if the folder is not exist,please try %HOMEPATH%\.platformio\packages\framework-arduinoespressif32\cores\esp32

Download WebServer.h and replace the WebServer.h in the following path of your computer,

%HOMEPATH%\.platformio\packages\[email protected]\libraries\WebServer\src

if the folder is not exist,please try %HOMEPATH%\.platformio\packages\framework-arduinoespressif32\libraries\WebServer\src

then clean, build again.

6. Flash firmware with microUSB

Connect pandaZHU or pandaM4 board to your computer with a microusb line,install CH340G USB driver , make sure there is a SD card in the slot(use the sd card detection pin(GPIO2) as firmware Download boot mode) and no serial/uart touch screen connected. Click to upload as shown below.

image

7. Upload firmware OTA Over the air (optional)

there is a Webserver program running on ESP32,so you can upload the firmware OTA from wifi.

after booting the esp32 will try to connect to a default SSID first,if it can not connect,it will switch to AP mode(Access Point),so you can scan and find a new wifi server named "MARLIN_ESP",connect to it,then open browser,type in 192.168.0.1, like the picture shown below.

image

the firmware.bin you builded is normally in the folder Marlin-2.0.x\.pio\build\PANDA_ZHU or Marlin-2.0.x\.pio\build\PANDA_M4

LCD Configure

In the Configuration.h,

If you use PandaLCD touch screen,please uncomment the line

#define DGUS_LCD_UI_FYSETC of course you need to disable other LCD like comment the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

For MKS-H43 touch screen,please uncomment the line

#define DGUS_LCD_UI_MKS

by the way,the PandaLCD and MKS-H43 use the same hardware core,so you can flash the MKS-H43 UI file into PandaLCD.

For LCD12864 that is commonly used in the creality printers like ender3/5,CR10... , please uncomment the line

#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

How to set default WiFi?

you can goto (https://github.com/luc-github/ESP3DLib) for more about ESP3D.

from the Configuration_adv.h we can know the default wifi SSID and password can be changed in the Configuration_Secure.h

/**
   * To set a default WiFi SSID / Password, create a file called Configuration_Secure.h with
   * the following defines, customized for your network. This specific file is excluded via
   * .gitignore to prevent it from accidentally leaking to the public.
   *
   *   #define WIFI_SSID "WiFi SSID"
   *   #define WIFI_PWD  "WiFi Password"
   */


  #include "Configuration_Secure.h" // External file with WiFi SSID / Password

other default Configuration

AP:MARLIN_ESP
PW:12345678
Authentification: WPA
Mode: g (n is not supported by AP, just by STA)
channel: 1
IP: 192.168.0.1
Mask: 255.255.255.0
GW:192.168.0.1
Web port:80 the websocket is web port + 1 => 80+1 : 81
User: admin
Password: admin
User:user
Password: user

FAQ

FAQ 1: try several times but still can not download firmware,and there are some errors of timeout message in the log?

  • the software driver of CH340 run on PC may not pull download the GPIO0 by the USB line. From the page 10 of ESP32,we can know the GPIO0 should pull-down while in Download Boot mode. you can connect the GPIO0(PWM pin of the BLTOUCH) to the GND pin with one wire.and then download again.after that disconnect the GPIO0.

  • Do not forget to power the board with external power supply,the 5v from the USB can not power the board.

FAQ 2:download firmware successful,but the board is not boot while connect to PC with usb line.

  • replug the usb line and try again.

  • Insert a SD card.

FAQ 3: Compile error: ESP3DLib / src / espcom.cpp: 31: 26: fatal error: U8glib-HAL.h: No such file or directory

  • we can fixed it by disable 2 lines in the .pio\libdeps\PANDA_M4\ESP3DLib\src\espcom.cpp or .pio\libdeps\PANDA_ZHU\ESP3DLib\src\espcom.cpp
  1. #include <U8glib-HAL.h> to //#include <U8glib-HAL.h>

  2. SERIAL_ECHOLNPGM("", data); to //SERIAL_ECHOLNPGM("", data);

or see this https://www.facebook.com/groups/380795976169477/posts/1092728734976194/?comment_id=1093060584943009&reply_comment_id=1093176881598046