Porting Marlin to STM32.
victor_pv Thu Jun 29, 2017 4:39 pm
In the last 2 days xC000005 and me have completed successful prints with Marlin for STM32F1, with the stm32duino-libmaple core, he printed a cat, and I printed a little Yoda-Budha.
During tests I was able to get about 50000khz pulses as max speed, which seems inline with other 32 bit platforms, and much faster than most printers should ever need. Which means at slower rates we have quite a few CPU cycles left to do other things.
We haven’t start with the LCD parts, but so far ADC, steppers and sdcard work, so printing from a computer is fully functional.
UPDATED 07/07/2017:
First version of my port to libmaple based cores. Should work on an F4 too, but so far I have just tested it with the F1, and only that it runs and there is serial communication, but not the steppers driving or the SDCard.
Compiled with Sloeber 4.1 and gcc 4.8.3. Should compile in the Arduino IDE but not tested.
I have tested it with an RCT6 MCU, but should fit fine in a maple mini as far as RAM and Flash
https://github.com/victorpv/Marlin-STM32-libmaple
==============================
Original post.
I’m starting this new thread to document the effort of porting Marlin to stm32 arduino cores.
-Shield with stepper connections etc, RAMPS can be modified:
-Boards: too many to list
- My effort will go first to libmaple. Chriss Bar has a version based on STM32GENERIC core. Both cores work on some F1, F3 and F4 MCUs
-Software:
There are at least 2 ports running in STM32.
- STM official one for their EVAL board. Doesn’t use arduino core. Uses the HAL.
Based on Marlin 1.1.0 RC7
https://github.com/St3dPrinter/Marlin4ST - Chriss Barr port. Uses the HAL. Nucleo 446 board.
Based on Marlin with HAL Bugfix fork.
Chriss said in a github conversation he has a more recent code that will try to upload in the next few days.
https://github.com/chrissbarr/Marlin/tr … Fix-F446VE
My plan:
Take Chriss code and make it compile in sloeber.
Once so, take it to Danieleff core, and make it compile and resolve any issue.
Test it with a Nucleo board and generic boards.
Add HAL for libmaple core
All the above should be feasible from a first look at the code.
We already have:
-Arduino compatible pin functions.
-Arduino compatible spi functions.
-Arduino compatible ADC functions (with more resolution, may need to trim)
-PWM functions (even if with some different parameters and setup than Arduino, still same functionality or more)
What needs to be done:
-Go thru each file in the HAL and modify/optimize for stm (just a few things)
Stepper control
Temperature probes and hotbed control
Memory usage.
Pin access.
Timers setup and usage.



