MarlinFW on custom PCB

I’ve just about finished my hardware design for a new 3D Print controller (GitHub - majic79/RepRap-GenX-Electronics: Next generation electronics for RepRap - STM32 ARM MCU based controller for 5x Stepper motors, 3x Heat sources and additional peripherals)

Once I’ve finalised and put the prototype order in, I’m going to look at putting MarlinFW onto it. Don’t suppose anyone has any familiarity with MarlinFW and STM32?

Evening @cdabone,

Other than this, Why do I get this error everytime I try to build the new marlin firmware - #31 by normandunbar, I’m afraid not.

I’ve built it for STM32 to help out the OP on that thread, but while I do have a couple of STM32 Blue Pills, I don’t have a 3D printer. Yet!

I did a quick search on here for “Marlin STM32” and got 48 hits – so there might be something useful for you in amongst the 48?

Sorry, not much help I’m afraid.

Cheers,
Norm.

Thanks - I went back to that thread after posting this and immediately thought “Yeah! This might not be that hard”

Maybe this little project might help you on the 3D printing road…

1 Like

The main information source on how to configure Marlin would be at the Marlin repo and their docs. There are two main parts for this:

  • for the Configuration.h and Configuration_adv.h settings, telling Marlin what exact hardware is on which exact pins and how the drivers and behavior is configured
  • the PlatformIO part with creating a new environment in the platformio.ini and building for that board / MCU

For the first part, I’ve already linked the config page, plus Marlin has an excessive example repository for configuration files for the supported 3D printers which you can have a look at.

For the latter part, building a firmware for the STM32F412RG, as I read in your repo, your microcontroller is already supported per genericSTM32F412RG docs and can run the Arduino STM32 core so it should have no troubles there compiling and running basic Arduino firmwares. You should also test this first on your board, as a simple sanity check with like a simple

[env:genericSTM32F412RG]
platform = ststm32
board = genericSTM32F412RG
framework = arduino
; default upload protocol is "serial",
; if STLink (SWD) is available, use this
upload_protocol = stlink

and blinky code.

(Possible caveat: if the firmware does nothing at all, it’s a possible clock configuration error. the Arduino variant will try to start up the HSE from a quartz-crystal with some default frequency (25MHz or 8MHz I think), and falls back to internal HSI if it fails. If you have a quarz on board, you may need to tell the core what frequency it is in hertz, with build_flags = -D HSE_VALUE=<value> in the platformio.ini. HSE is needed for USB functionality.)

You can then go ahead and look at existing STM32F4 environments for Marlin, like

and adapt them regarding the board and macro values accordingly.

Marlin is quite “pimped out” and uses some extra_scripts for extended functionality. These scripts might not be needed or may be needed to be adapted. I don’t know the specifics of that specific board and why they would need to do a generic_create_variant.py here, since the board has a known + supported Arduino variant already… but for those questions, you can look at the code yourself and our docs, or also ask them in an issue at their github page or ask in forums spezialed for Marlin (RepRap Forums :: Firmware - Marlin). If anything purely PlatformIO specific comes up of course, here is the right place to ask.

1 Like

Thanks - it looks fairly straightforward, so I should be able to fill in any blanks.

I did some validation in LTSpice to try and profile the MOSFET behaviour and discovered that there’s no way that what I had was going to work.

After some research, I finally got a working design at a reasonable cost. I have an excess of board space, so I was able to layout discrete components to solve that power issue. I have a new found respect for electronics designers - I lost a lot of time trying to figure that part out! Spice tells me it will work, and as long as there’s no glaring issues with the board layout, I think it should be a workable design (I’ve pushed my changes to github)

Time to sleep on it and consider anything else I may want to add. I have a few pins left over, and there’s one thing that’s on my “nice to have” list that I may be able to slip in there.