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?
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
(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.
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.