Hello,
I have been primarily using ESP32 boards but have started working with STM32 boards.
Specifically I have been using a MKS Monster8 v2 board (stm32f407vet6)
https://github.com/makerbase-mks/MKS-Mo ... 20V2.0_003
I work as an electrical engineer at a company that makes animatronics for theme parks.
I'm working on a kinetic sculpture that repurposes the MKS Monster8 v2 board which is originally intended as a 3d printer controller.
I want to use it to independently control 8 NEMA17 stepper motors with positions sent from a PC over serial from TouchDesigner.
I have been programming the board using the variant_BLACK_F407VX but encountered an issue when trying to enable X and Y stepper motors of the MKS Monster8 v2 board.
This requires writing LOW to pin PC15 which on the BLACK_F407VX is connected to a oscillator crystal but is used for XY_EN on the MKS Monster8 v2 board.
Is there anyone who could help me out with understanding and performing the process to add a MKS Monster8 v2 board variant?
There is some reference configuration information from the Marlin 3d printer firmware that supports this board
Common pins:
https://github.com/MarlinFirmware/Marli ... 8_common.h
V2 specific pins:
https://github.com/MarlinFirmware/Marli ... STER8_V2.h
Thanks,
Elijah
Introduction post
Re: Introduction post
Welcome,
I've not actually build Marlin from source, but that it is a complex set of codes given the large number of features it support particularly for 3d printing and the large number of platforms it support.
If you specifically want to use Marlin, Marlin web
https://marlinfw.org/
and its community groups may be relevant e.g.
https://reprap.org/forum/list.php?415
https://www.facebook.com/groups/1049718498464482
looking at the source Marlin is apparently (still?) based around Arduino
https://github.com/MarlinFirmware/Marli ... .cpp#L1143
https://github.com/MarlinFirmware/Marli ... .cpp#L1722
However, I'm not sure if it may use its own board support codes that could practically 'replace' the *duino core codes itself.
And do note that there are at least 2 variants of 'stm32duino' around (e.g. the 'official' core and a 'libmaple' core)
viewtopic.php?t=3
viewtopic.php?t=301
the 'official' core is here
https://github.com/stm32duino/Arduino_Core_STM32
its wiki on how to install the core in Arduino IDE is here
https://github.com/stm32duino/Arduino_Core_STM32/wiki
However, I can't really say about building Marlin firmware itself which you may need to refer to the Marlin firmware website.
Doing a web search also turns up a repository about your board which may be handy, especially its schematics.
https://github.com/makerbase-mks/MKS-Monster8/tree/main
https://github.com/makerbase-mks/MKS-Mo ... %20SCH.pdf
if what you need is to basically 'control' the steppers,
it'd depends on the stepper drivers that you install / use, e.g. for A4988
a google search for A4988 as keyword turns up some of these entries
https://www.pololu.com/product/1182
https://lastminuteengineers.com/a4988-s ... -tutorial/
https://www.adafruit.com/product/6109
https://www.allegromicro.com/-/media/fi ... asheet.pdf
I've not actually build Marlin from source, but that it is a complex set of codes given the large number of features it support particularly for 3d printing and the large number of platforms it support.
If you specifically want to use Marlin, Marlin web
https://marlinfw.org/
and its community groups may be relevant e.g.
https://reprap.org/forum/list.php?415
https://www.facebook.com/groups/1049718498464482
looking at the source Marlin is apparently (still?) based around Arduino
https://github.com/MarlinFirmware/Marli ... .cpp#L1143
https://github.com/MarlinFirmware/Marli ... .cpp#L1722
However, I'm not sure if it may use its own board support codes that could practically 'replace' the *duino core codes itself.
And do note that there are at least 2 variants of 'stm32duino' around (e.g. the 'official' core and a 'libmaple' core)
viewtopic.php?t=3
viewtopic.php?t=301
the 'official' core is here
https://github.com/stm32duino/Arduino_Core_STM32
its wiki on how to install the core in Arduino IDE is here
https://github.com/stm32duino/Arduino_Core_STM32/wiki
However, I can't really say about building Marlin firmware itself which you may need to refer to the Marlin firmware website.
Doing a web search also turns up a repository about your board which may be handy, especially its schematics.
https://github.com/makerbase-mks/MKS-Monster8/tree/main
https://github.com/makerbase-mks/MKS-Mo ... %20SCH.pdf
if what you need is to basically 'control' the steppers,
it'd depends on the stepper drivers that you install / use, e.g. for A4988
a google search for A4988 as keyword turns up some of these entries
https://www.pololu.com/product/1182
https://lastminuteengineers.com/a4988-s ... -tutorial/
https://www.adafruit.com/product/6109
https://www.allegromicro.com/-/media/fi ... asheet.pdf
Last edited by ag123 on Tue May 20, 2025 12:24 pm, edited 3 times in total.
Re: Introduction post
Here's a link to instructions how to add new variant board:
https://github.com/stm32duino/Arduino_C ... 28board%29
But I think you should be able to use generic F407VETx as it uses internal oscillators like MKS board.
https://github.com/stm32duino/Arduino_C ... 28board%29
But I think you should be able to use generic F407VETx as it uses internal oscillators like MKS board.
Re: Introduction post
oops I'm off-topic in the prior comment
but that apparently the HSE crystal frequency is apparently not indicated on the schematic itself
https://github.com/makerbase-mks/MKS-Mo ... %20SCH.pdf
using the 'Generic' variant normally runs it on HSI (high speed internal) oscillator
and there are some boards which is based on stm32f407ve as well listed on the core Readme.md
https://github.com/stm32duino/Arduino_C ... 2f4-boards
if you want it to run on your board and use its external crystal oscillator as HSE, you can try selecting boards as like
stm32 Black F407VET6 etc
https://github.com/stm32duino/Arduino_C ... .txt#L4630
https://github.com/stm32duino/Arduino_C ... X.cpp#L109
Note that the Black F407VET6 board is apparently based on an 8 Mhz external crystal
cpu clock speeds = crystal_freq (8 Mhz) / 8 * 336 / 2 (RCC_PLLP_DIV2) = 168 Mhz
if you want your board to run at the correct cpu speeds e.g. 168 Mhz, you would need to determine the crystal frequency on your board
Then you can follow instructions as that given prior (https://github.com/stm32duino/Arduino_C ... 28board%29)
and make a new variant perhaps using the variant codes say for variant_BLACK_F407VX as example.
and to determine the PLL multipliers to use, for stm32f407 it is
crystal frequency / M * N / P
to get 168 Mhz system/cpu clock speeds that is how the above formula derives
you may refer to RM0009 reset and clock control - clocks / clock tree
https://www.st.com/resource/en/referenc ... ronics.pdf
Note that the system clocks is further divided for peripherals etc, review the clock tree and relevant codes
To work the PLL multipliers I've once made a python script utility e.g.
viewtopic.php?t=78
which may be used to explore the pll multiplier configurations.
The usual steps is to run a blink sketch oh the board when setting up the board this way, if it blinks 'too fast' or 'too slow' the crystal frequency or the pll multipliers is probably incorrect.
but that apparently the HSE crystal frequency is apparently not indicated on the schematic itself
https://github.com/makerbase-mks/MKS-Mo ... %20SCH.pdf
using the 'Generic' variant normally runs it on HSI (high speed internal) oscillator
and there are some boards which is based on stm32f407ve as well listed on the core Readme.md
https://github.com/stm32duino/Arduino_C ... 2f4-boards
if you want it to run on your board and use its external crystal oscillator as HSE, you can try selecting boards as like
stm32 Black F407VET6 etc
https://github.com/stm32duino/Arduino_C ... .txt#L4630
https://github.com/stm32duino/Arduino_C ... X.cpp#L109
Note that the Black F407VET6 board is apparently based on an 8 Mhz external crystal
Code: Select all
RCC_OscInitStruct.PLL.PLLM = 8;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
if you want your board to run at the correct cpu speeds e.g. 168 Mhz, you would need to determine the crystal frequency on your board
Then you can follow instructions as that given prior (https://github.com/stm32duino/Arduino_C ... 28board%29)
and make a new variant perhaps using the variant codes say for variant_BLACK_F407VX as example.
and to determine the PLL multipliers to use, for stm32f407 it is
crystal frequency / M * N / P
to get 168 Mhz system/cpu clock speeds that is how the above formula derives
you may refer to RM0009 reset and clock control - clocks / clock tree
https://www.st.com/resource/en/referenc ... ronics.pdf
Note that the system clocks is further divided for peripherals etc, review the clock tree and relevant codes
To work the PLL multipliers I've once made a python script utility e.g.
viewtopic.php?t=78
which may be used to explore the pll multiplier configurations.
The usual steps is to run a blink sketch oh the board when setting up the board this way, if it blinks 'too fast' or 'too slow' the crystal frequency or the pll multipliers is probably incorrect.
Code: Select all
/* note LED_BUILTIN is probably different on your board, you need to replace it with the gpio ref e.g. PAxx for the led */
int ledPin = LED_BUILTIN;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, ! digitalRead(ledPin));
delay(500);
}