Welcome! Log In Create A New Profile

Advanced

Marlin 2.0 and STM32F103C8

Posted by ruyvieira 
Marlin 2.0 and STM32F103C8
February 12, 2019 09:40PM
Was it ever possible to build Marlin 2.0 for this MCU? There are at least two boards designed for it (Morpheus and RABPS), plus the Mono Price Mini I3 controller, but I either get a "can't find included file atomic.h" or a "NameError: name 'variant' is not defined:" when trying to build it in Platformio. This happens even on a fresh install of Platformio, which makes me wonder if it was ever possible to build it for this specific MCU. I can build it for other mcu's in the same like like the one in MKS Robin, and a guy in this forum designed a whole 3d printer board around what seems to be an inexpensive stm32f407 module.

I made a board for a stm32f103 port of GRBL and it functions perfectly, if Marlin 2.0 could run on it it then a single board would be able to run both firmwares.
Re: Marlin 2.0 and STM32F103C8
February 13, 2019 12:22AM
I have complied marlin 2.0 for STM32F103C8 on platformio

there where some things that needed changed
main issue were memory, had to hack files to tell it that it really has 128k flash vs the 64k it is sold as.

I set #define MOTHERBOARD BOARD_MORPHEUS

PID Build (STM32F1)

still seems to compile fine with current marlin 2.0
Re: Marlin 2.0 and STM32F103C8
February 13, 2019 01:02AM
I tried choosing the STM32F1 environment, setting the board in the environment as genericSTM32F103CB. It shows the right specs in the beginning, like

PLATFORM: ST STM32 > STM32F103CB (20k RAM. 128k Flash)
HARDWARE: STM32F103CBT6 72MHz 20KB RAM (128KB Flash)

But then it gives me a different series of errors

Compiling .pioenvs\STM32F1\src\src\HAL\HAL_STM32F1\HAL_timers_STM32F1.cpp.o
Marlin\src\HAL\HAL_STM32F1\HAL_sdio_STM32F1.cpp: In function 'bool SDIO_Init()':
Marlin\src\HAL\HAL_STM32F1\HAL_sdio_STM32F1.cpp:34:3: error: 'sdio_begin' was not declared in this scope
sdio_begin();
^~~~~~~~~~

And so on. It's a different result already, I could be on the right track or not




Makes me want to try ESP32 instead
Re: Marlin 2.0 and STM32F103C8
February 13, 2019 02:55AM
I didn't change board = genericSTM32F103RE in platformio.ini (this time....)

after changing it to genericSTM32F103C8 or genericSTM32F103CB I get the same error as you

It did used to work....


[update]

ok this is odd...

code is looking like it is ignoring -D__STM32F1__

if you edit Marlin/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp line 24
change it from #ifdef __STM32F1__ to #ifndef __STM32F1__

it complies!!

I can't explain this...

Edited 1 time(s). Last edit at 02/13/2019 03:30AM by Dust.
Re: Marlin 2.0 and STM32F103C8
November 06, 2024 08:25AM
I have made a circuit board using STM32F103C8T6 to control a 3D printer, but when I upload the Marlin firmware to the STM32, I get the following error: 'Your Configuration provides no method to acquire user feedback!'. Has anyone encountered this error and knows how to fix it? Thank you very much.
Re: Marlin 2.0 and STM32F103C8
November 06, 2024 09:10AM
@trieudung

That is not an error Its a warning.

That you have no screen or HOST_PROMPT_SUPPORT or EMERGENCY_PARSER or any other way to give feedback enabled

The full thing is
#warning "Your Configuration provides no method to acquire user feedback! (Define NO_USER_FEEDBACK_WARNING to suppress this warning.)"

And it tells you how to just turn off the waning if you really dont want anything like that

Edited 1 time(s). Last edit at 11/06/2024 09:13AM by Dust.
Re: Marlin 2.0 and STM32F103C8
November 14, 2024 03:32AM
I have connected to an LCD module but when I try to upload Marlin firmware to STM32F103C8T6 using ST-Link, I encounter the following errors. Could you please help me? I'm also a beginner.


[upload] AssertionError :
Traceback (most recent call last):
File "C:\Users\Dung\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Action.py", line 1441, in execute
result = self.execfunction(target=target, source=rsources, env=env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\platforms\atmelavr\builder\main.py", line 54, in BeforeUpload
env.AutodetectUploadPort()
File "C:\Users\Dung\.platformio\packages\tool-scons\scons-local-4.8.1\SCons\Util\envs.py", line 252, in __call__
return self.method(*nargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\penv\Lib\site-packages\platformio\builder\tools\pioupload.py", line 118, in AutodetectUploadPort
).find(initial_port)
^^^^^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\penv\Lib\site-packages\platformio\device\finder.py", line 147, in find
device = self._find_known_device()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\penv\Lib\site-packages\platformio\device\finder.py", line 245, in _find_known_device
return wrapper()
^^^^^^^^^
File "C:\Users\Dung\.platformio\penv\Lib\site-packages\platformio\util.py", line 113, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\penv\Lib\site-packages\platformio\device\finder.py", line 240, in wrapper
device = self.match_device_hwid(_fetch_hwids_from_platforms())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\penv\Lib\site-packages\platformio\device\finder.py", line 227, in _fetch_hwids_from_platforms
for board_config in p.get_boards().values():
^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\platforms\atmelsam\platform.py", line 102, in get_boards
result[key] = self._add_default_debug_tools(result[key])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dung\.platformio\platforms\atmelsam\platform.py", line 151, in _add_default_debug_tools
assert openocd_chipname
AssertionError

Edited 1 time(s). Last edit at 11/14/2024 03:32AM by trieudung.
Re: Marlin 2.0 and STM32F103C8
November 14, 2024 08:17AM
platform atmelsam is not stm32f103C8

In platformio.ini default_envs should be set to a stm32 environment
or if using command line -E some stm32 environment
Re: Marlin 2.0 and STM32F103C8
November 14, 2024 09:22AM
STM32F103C8 officially only has 64K of flash and 20K of ram, this is insufficient for Marlin 2.1.x (I suspect Marlin 2.0 will be the same)

A minimal build with the added STM32F103C8 build environment errors with `FLASH' overflowed by 22472 bytes

If you force it to use 128k (ie make it think its a STM32F103CB, as some actually do have the extra flash ) it will build

RAM: [==== ] 36.6% (used 7496 bytes from 20480 bytes)
Flash: [======= ] 66.9% (used 87684 bytes from 131072 bytes)
Building .pio/build/STM32F103CB/firmware.bin

changes I made to build this example in diff format.

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index c45c75a39d..43bcf3d846 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -68,7 +68,7 @@
 
 // Choose the name from boards.h that matches your setup
 #ifndef MOTHERBOARD
-  #define MOTHERBOARD BOARD_RAMPS_14_EFB
+  #define MOTHERBOARD BOARD_MORPHEUS
 #endif
 
 // @section serial
@@ -81,7 +81,7 @@
  *
  * :[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  */
-#define SERIAL_PORT 0
+#define SERIAL_PORT 1
 
 /**
  * Serial Port Baud Rate
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index e70a70b518..123321dac3 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -608,7 +608,7 @@
 #elif MB(GTM32_REV_cool smiley
   #include "stm32f1/pins_GTM32_REV_B.h"             // STM32F1                              envconfused smileyTM32F103VE envconfused smileyTM32F103VE_GTM32_maple
 #elif MB(MORPHEUS)
-  #include "stm32f1/pins_MORPHEUS.h"                // STM32F1                              envconfused smileyTM32F103RE envconfused smileyTM32F103RE_maple
+  #include "stm32f1/pins_MORPHEUS.h"                // STM32F1                              envconfused smileyTM32F103C8 envconfused smileyTM32F103CB envconfused smileyTM32F103RE envconfused smileyTM32F103RE_maple
 #elif MB(CHITU3D)
   #include "stm32f1/pins_CHITU3D.h"                 // STM32F1                              envconfused smileyTM32F103ZE envconfused smileyTM32F103RE_maple
 #elif MB(MKS_ROBIN)
diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini
index 0978b19476..6f375f7237 100644
--- a/ini/stm32f1.ini
+++ b/ini/stm32f1.ini
@@ -26,6 +26,24 @@ board_build.variant  = MARLIN_F103Rx
 build_flags          = ${stm32_variant.build_flags} -DDEBUG_LEVEL=0
 monitor_speed        = 115200
 
+
+#
+# STM32F103C8
+#
+[envconfused smileyTM32F103C8]
+extends       = common_stm32
+board         = genericSTM32F103C8
+monitor_speed = 115200
+
+#
+# STM32F103CB
+#
+[envconfused smileyTM32F103CB]
+extends       = common_stm32
+board         = genericSTM32F103CB
+monitor_speed = 115200
+
+
 #
 # STM32F103RE
 #
diff --git a/platformio.ini b/platformio.ini
index ed1670dc6d..63bed88739 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -13,7 +13,7 @@
 [platformio]
 src_dir      = Marlin
 boards_dir   = buildroot/share/PlatformIO/boards
-default_envs = mega2560
+default_envs = STM32F103CB
 include_dir  = Marlin
 extra_configs =
     Marlin/config.ini
Also attached, so you can work out what the silly similes are meant to be
diff.log

Edited 5 time(s). Last edit at 11/14/2024 10:07AM by Dust.
Re: Marlin 2.0 and STM32F103C8
November 14, 2024 09:42AM
Thank you for your enthusiastic support. I will try a board with 128k flash memory
Re: Marlin 2.0 and STM32F103C8
November 15, 2024 10:58AM
Hi, I have successfully uploaded Marlin firmware to my STM32, but when I configure some functions and try to upload again, I encounter some errors:
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
[openocd.org]
debug_level: 1


hla_swd
Error: init mode failed (unable to connect to the target)
in procedure 'program'
OpenOCD init failed
shutdown command invoked

Do you know how to fix it? Please help me. Thank you very much.
Re: Marlin 2.0 and STM32F103C8
November 16, 2024 12:48AM
no real idea on that, my guess your programmer isnt connected to reset so running code is blocking the connection.
Sorry, only registered users may post in this forum.

Click here to login