Quantcast
Channel: Reprap Forum - Firmware - Marlin
Viewing all articles
Browse latest Browse all 12090

Trying to add a GD32F303 board in Marlin

$
0
0
Hi All,

Hopefully this is the right place to ask this? If not, if someone could point me in a good direction, that would be appreciated!

I am trying to create a custom Marlin install for a new Kingroon KP3s 3.0. From my understanding the board is based on a Makerbase Robin Nano, but Kingroon appear to have switched to using the GigaDevices GD32 chipset.

Support for this chip is pretty contentious on the Marlin GitHub, but there is a Creality board that uses GD32F303 and seems to be supported. Some uses have reported success using the maple branch of STM32 chipsets, but when I tried that for this board the printer would just reboot when I tried to start a print (possibly because of Watchdog).

My hope was that I could use the config for the Creality GD32F303 board and combine it with the pin mappings for the Robin Nano. I have added a new board in Marlin/src/core/boards.h:

#define BOARD_KINGROON_KP3_V1_3_GD    5301  // Kingroon KP3s v1.3 (GD32F303RET6)

I also added the the pin definition in Marlin/src/pins/gd32f3/pins_KINGROON_KP3S_V1_3_GD.h

/**
 * Marlin 3D Printer Firmware
 * Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 *
 * Based on Sprinter and grbl.
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see [www.gnu.org].
 *
 */
#pragma once

/**
 * Kingroon KP3s 1.3 (GD32F303VET6) board pin assignments
 * Sold as "Kingroon KP3s Mainboard"
 * Preliminary support for the Professional Firmwware
 */

#include "env_validate.h"

#if HOTENDS > 2 || E_STEPPERS > 2
  #error "KINGROONKP3SV1.3 only supports two hotend / E-stepper."
#endif

// Validate stepper driver selections.
//#if !AXIS_DRIVER_TYPE_X(TMC2208) || !AXIS_DRIVER_TYPE_Y(TMC2208) || !AXIS_DRIVER_TYPE_Z(TMC2208) || !AXIS_DRIVER_TYPE_E0(TMC2208)
//  #error "This board has onboard TMC2208 drivers for X, Y, Z, and E0."
//#endif

#ifndef BOARD_INFO_NAME
  #define BOARD_INFO_NAME      "KINGROONKP3SV1.3"
#endif
#ifndef DEFAULT_MACHINE_NAME
  #define DEFAULT_MACHINE_NAME "Kingroon KP3s"
#endif
#define BOARD_WEBSITE_URL      "kingroon.com"
#define ALLOW_STM32DUINO
#include "env_validate.h"

#define BOARD_INFO_NAME "MKS Robin Nano V1"

//
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
//
#define DISABLE_JTAG

//
// Thermocouples
//
//#define TEMP_0_CS_PIN                     PE5   // TC1 - CS1
//#define TEMP_0_CS_PIN                     PE6   // TC2 - CS2

//#define LED_PIN                           PB2

#include "../stm32f1/pins_MKS_ROBIN_NANO_common.h"

#if HAS_TFT_LVGL_UI && FAN1_PIN != PB0 && HEATER_1_PIN != PB0
  #define BOARD_INIT() OUT_WRITE(PB0, LOW)
#endif

I then added a check in Marlin/src/pins/pins.h

#elif MB(KINGROON_KP3_V1_3_GD)
  #include "gd32f3/pins_KINGROON_KP3S_V1_3_GD.h"

Next I added the ini config for the board ini/gd32.ini (I am trying to use the CommonGD32 cores repo):


[env:GD32F303VET6_kingroon_kp3s]
platform             = [github.com]
platform_packages    = framework-arduinogd32
board                = genericGD32F303VE
board_build.core     = gd32
monitor_speed        = 115200
build_flags          = ${common.build_flags} -std=gnu++14
                       -DHAL_STM32 -DPLATFORM_M997_SUPPORT
                       -DUSBCON -DUSBD_USE_CDC -DTIM_IRQ_PRIO=13 -DADC_RESOLUTION=12
build_unflags        = -std=gnu11 -std=gnu++11
build_src_filter     = ${common.default_src_filter} + - +

lib_ignore           = SPI, FreeRTOS701, FreeRTOS821
lib_deps             = ${common.lib_deps}
                       SoftwareSerialM

board_build.address  = 0x08007000
board_build.ldscript = mks_robin_nano.ld
board_build.rename   = ROBIN_NANO.bin
debug_tool           = jlink
upload_protocol      = jlink
extra_scripts        = ${common.extra_scripts}
                       pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
                       pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
                           buildroot/share/PlatformIO/scripts/custom_board.py
                           buildroot/share/PlatformIO/scripts/offset_and_rename.py

When I try and build using PlatformIO I get the following error (no suggested environments are generated):

Error: Build environment 'GD32F303VET6_kingroon_kp3s' is incompatible with BOARD_KINGROON_KP3_V1_3_GD. Use one of these environments:

I suspect that I need to add this new board to a definitions config somewhere? If so, I cannot find how the boards in boards.h are mapped to platformio build config?

Any help on what I am doing would be greatly appreciated!

Viewing all articles
Browse latest Browse all 12090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>