Serial connection problem after changing to BTT SKR Mini E3 V2.0 with GD32F103

What is the problem?

During my prints, octoprint disconnect randomly from my printer.
It starts to occur when I change my stock mainboard (Creality v.4.2.2) to BTT SKR Mini E3 V2 with my self-compiled Marlin 2.0.9.1. Currently the serial port config is set as:

#define SERIAL_PORT 2
#define BAUDRATE 115200
#define SERIAL_PORT_2 -1

I am using the stock LCD 12864 screen.

Also note that connection to my printer starts to be slow since my change of mainboard. It used to be less than 1 second and now it takes around 2-3 seconds for Octoprint to connect.

Another thing is that during connection, it is very prone to fail to connect if I have gcode file in my printer SD card and the startup M21 command triggered the disconnection.

What did you already try to solve it?

Switch to official Raspberry AC adaptor (5.1V 2.5A), change my USB cable to a shielded one (I am now using the one came with BTT mainboard), put a fan on top of the Pi to prevent overheating, tape my USB cable power pin, also unplug my stock 12864 screen as I thought I read something about screen cable to cause serial connection problem. All the above fail.

Have you tried running in safe mode?

Not yet, but I don't think it is a plugin problem

Did running in safe mode solve the problem?

Not tested

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)
octoprint-systeminfo-20210825145624.zip (94.0 KB)

Uploaded

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

Octoprint: 1.6.1;
OctoPi: 0.18.0,
printer: Ender 3 with BTT SKR Mini E3 V2.0;
firmware: self-compiled Marlin 2.0.9.1;
browser: Microsoft Edge 92.0.902.78;
also access Octoprint via Android App OctoRemote ver. 1.4.3

hello,

as this is about serial connection issues a piece of serial logging is needed. Please enable it (click on the wrench, scroll down to the bottom at the right pane, click the checkbox) and let it log & run for a while until you encounter the problem. Please add the file here, thanks

Hi to everyone who might have the same problem with BTT SKR Mini E3 V2, please check whether your MCU is a GD32F103 instead of the STM version. It turns out to be the problem of the chip (not exactly, but related to the slightly different configuration of this chip and stm chip). After I followed the instruction mentioned by blazewicz on Github, connection instability problem is gone. Here is the linkSolution
Below is what I did:

  1. firstly I compiled my Marlin firmware by using environment STM32F103RE_btt, but it turned out Octoprint cannot even connect to my printer, so I changed my compilation environment to STM32F103RE_btt_USB, which solved my connection problem at the first place;
  2. However this brings the problem as I depicted above, connection randomly failed, usually after 2 hours. According to this spread here [https://github.com/MarlinFirmware/Marlin/issues/22431], it is caused by enabling MSC and CDC together. Basically if you compile using _btt_USB option, the printer regards your SD card as a massive storage, which will trigger the problem. So don't use that one if you have the GD version chip;
  3. So I followed the instruction by blazewics, changing back to STM32F103RE_btt, and then change my platform io file as in C:\Users{your user name}.platformio\packages\framework-arduinoststm32\cores\arduino\stm32\usb\usbd_ep_conf.c, and change on line 40 to read as {CDC_OUT_EP, PMA_CDC_OUT_ADDR, PCD_SNG_BUF} (basically changing DBL to SNG).
  4. And after compilation, everything works fine and there are no more serial connection problem even when I printed 20 hours.

Sorry it is my first time to write something related to coding and I am not a programmer by any sort. So the format might be messy.

3 Likes

thanks for coming back and reporting your solution!