pscrespo / Morpheus-STM32

A small 3D printer controller board for use with a "blue pill" STM32F1 generic board. Inspired on http://reprap.org/wiki/SinapTec
GNU General Public License v3.0
65 stars 19 forks source link

Work status? #1

Open dossalab opened 6 years ago

dossalab commented 6 years ago

Hi, I'm really interested in this project. Blue pill is a cheap and powerful board, so it's a nice choice for 3d printers. So I want to know is this board complete? Can I make one? Which software works with your board?

pscrespo commented 6 years ago

Hello. I didn't make one yet, you can make one if you want. Please consider that this project is a work in progress, and it may have some mistake that I didn't see yet. Also this board has no fuses or reverse current protection, please make sure that all cables are connected properly and use an external fuse. As of firmware, I'm waiting for a functional Marlin release (you can track it too here: "https://github.com/MarlinFirmware/Marlin/issues/7076"). I'm hoping that Marlin works with STM32F1 boards since it would be a very cheap upgrade to 32bits, especially for delta machines.

jakep82 commented 6 years ago

Klipper supports the STM32F103 board.

https://github.com/KevinOConnor/klipper/blob/master/docs/Features.md

vivian-ng commented 5 years ago

Can I clarify if the diode beside the VIN is to guard against reverse polarity?

Also, is there a list of components (capacitors, resistors, MOSFETs, etc.) that is needed? Or do I just RTFM (or in this case, RTFPDF)?

pscrespo commented 5 years ago

Hi! The diode is needed because when tested with USB voltage input only, there was current on 12V rails, apprently due to how the LM1117 works. Currently it has no reverse polarity or overcurrent protection. Also I found that HW PWM is not working correctly yet on Marlin 2.0 so print fan doesn't work as intended. As for the BOM, I'll make one soon so it's easier for you. @jakep82 I've been reading about Klipper, it's really nice but my goal for now it's to make it work correctly with Marlin. If you want to try it would be nice to see how it performs.

jakep82 commented 5 years ago

I'm interested in building one as soon as a BOM is available. I have a couple STM32 Dev boards, and I want to test this board with Klipper for a future printer.

Alfrederson commented 5 years ago

Did you manage to get the built-in USB port when compiling Marlin 2.0?

Vicbarn commented 5 years ago

Hi. I got Marlin 2 compiled with Arduino IDE and fully working on my Blue Pill board.

The latest Arduino 1.8.9 with updated boards STM32 Cores ver. 1.6.1 updated using Additional boards in preferences with https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json allowed me to select under tools: Board: Generic STM32F1 Series Board part number: Bluepill F103C8 (128k) U(S)ART support "Enabled (generic 'Serial')" USB support (if available): "CDC (generic 'Serial' supersede U(S)ART"

I copied just the Marlin folder from Marlin-bugfix-2.0.x to my Arduino Projects folder. I opened the .ino file from Ardiuno IDE and selected my board as above. Using the default Configuration files I chose

define SERIAL_PORT 1

define SERIAL_PORT_2 -1

giving me both Blue Pill Serial 1 on PA 9 and PA10, and USB serial working. I chose #define MOTHERBOARD BOARD_MALYAN_M200 as my motherboard. This compiled without any errors or warnings and uploaded the firmware to my Blue Pill using ST-Link V2 I connected XYZ Min, A15, B4 and B5 to 3.3v and A0 (T0 sensor) to a 10k Potentiometer between gnd and 3.3V to set its voltage for 210 C. This was necessary to stop Marlin from performing a critical Halt for Thermal runaway etc. I then connected via USB to Repetier Host after installing the STM32 VCP serial driver available at https://www.st.com/en/development-tools/stsw-stm32102.html.

I was able to serial connect to Blue Pill from Repetier and load, slice and print a model to it. I checked all the pins with an oscilloscope and all signals were exactly as expected.

Choosing #define MOTHERBOARD BOARD_MORPHEUS gave errors and after editing lines producing errors in the pins_MORPHEUS.h file I managed to compile and upload but the Blue Pill went into a Watchdog reset every 4 seconds. This is because of a pins - timer usage clash.

@pscrespo Please change your pins_MORPHEUS.h file to get a pins combination that doesn't produce a timer clash and if possible make PA9 and PA10 available for a serial WIFI connection.

Your work is much appreciated and I look forward to a final PCB to plug my Blue Pill into and to start printing!

Vicbarn commented 5 years ago

Hi pscrespo Thank you very much for your board and pins update. In order to get a successful build I had to use Arduino IDE with modified MalyanM200 pins to match Morpheus. I would love to use PlatformIO but haven't managed a successful build. Could you please add your platformio.ini, Configuration.h and Configuration_adv.h files to the code section to help me build using PlatformIO.

Cleric-K commented 4 years ago

Here's my recipe for building with PlatformIO:

  1. Use the latest 2.0.x branch of Marlin.
  2. Create new environment in platformio.ini
    [env:STM32F103CB_morpheus]
    platform    = ststm32
    board       = genericSTM32F103CB
    build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py -ffunction-sections -fdata-sections -Wl,--gc-sections
    src_filter  = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
    lib_ignore  = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SPI
  3. Optionally modify:
    [platformio]
    ...
    default_envs = STM32F103CB_morpheus
  4. The minimum changes to Configuration.h are:
    #define SERIAL_PORT -1

    and

    #define MOTHERBOARD BOARD_MORPHEUS
  5. Build and flash!

Seems to work, responds correctly in Pronterface. On Windows I had to install the drivers for the Maple USB serial port: ~/.platformio/packages/framework-arduinoststm32-maple/drivers/win/install_drivers.bat

Note that the above configuration builds image for direct flashing (stlink), and not for stm32duino/maple bootloader. It seems that PlatformIO has some hardcoded preferences for the linker script (which determines the type of image to build) according to the name of the board (see ~/.platformio/packages/framework-arduinoststm32-maple/tools/platformio-build-stm32f1.py).

If you would like to build version for flashing with the bootloader, you have to use env such as this:

[env:STM32F103CB_morpheus]
platform    = ststm32
board       = bluepill_f103c8_128k
board_build.core = maple
build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py -ffunction-sections -fdata-sections -Wl,--gc-sections
src_filter  = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
lib_ignore  = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SPI

The platformio-build-stm32f1.py scripts builds bootloader code (code at 0x8002000) for the bluepill_f103c8_128k board and raw code (at 0x8000000) for the genericSTM32F103CB board.

Vicbarn commented 4 years ago

@Cleric-K Hi. Thanks a stack for the PlatformIO instructions. Worked perfectly! Trying to get OpenOCD in PlatformIO to upload via Stlink to a Blue Pill board with 128k ROM but reporting as 64K . OpenOCD has a size overide option, but I need to find where to do this. Another option is to use STM32CubeProgrammer like Arduino does. Arduino happily programs the board. Would be great if you could help. My IDE environment experience is rather low.

Cleric-K commented 4 years ago

Unfortunately I don't have elegant solution to this one. What I do is to manually edit: ~\.platformio\packages\tool-openocd\scripts\target\stm32f1x.cfg and replace $_FLASH_SIZE on the flash bank ... line with sufficiently large number, for eaxmple 0x1000000. We are not setting it to 0x20000 (128K) because that would restrict flashing other f1xx MCUs which might have more than that:

flash bank $_FLASHNAME stm32f1x 0x08000000 0x10000000 0 $_TARGETNAME

The above number will allow OpenOCD to try to flash images up to 16MB. It will fail of course, but I don't think this can do any harm (besides leaving the mcu in unworkable state).

Vicbarn commented 4 years ago

Thanks Tiny typo. Used flash bank $_FLASHNAME stm32f1x 0x08000000 0x1000000 0 0 $_TARGETNAME Worked perfectly.

Cleric-K commented 4 years ago

Thanks for spotting the typo.

Just for the record, here's also how to use STLink (no changes in .cfg scripts needed). This must be added to the [env...] section:

upload_protocol = custom
upload_command = $PROJECT_PACKAGES_DIR/tool-stm32duino/stlink/ST-LINK_CLI.exe -ME -V -P $SOURCE 0x8000000 -Rst
Vicbarn commented 4 years ago

Thanks. Worked!

pebri86 commented 4 years ago

Thanks. Did anyone tried enabled sdsupport? Is it fit on 128kb flash?

Cleric-K commented 4 years ago

Quick test with SD enabled caused overflow with about +13KB.

I think I'm missing something. Then I compiled the same config for arduino 128 and the bin is just 66K! I'm not very experienced with the Marlin code but I suspect that the stm32 version compiles unnecessary stuff.

Or maybe ARM code, being 32bit, is simply larger than 8bit AVR code ... I have no idea.

pscrespo commented 4 years ago

Hi there! First, thanks to everyone, it's great to see users helping others! I apologize for not being around lately, I'm going to make some time to write a (simple and short) tutorial in the wiki, but for now, to save space you can:

That will give enough space for LCD and SD support If you need an extra you can:

pebri86 commented 4 years ago

Using latest 2.0.x still overflowed ~3kb after disabled pid and even uncommenting #define NO_LCD_MENUS.

Vicbarn commented 4 years ago

Built using Arduino IDE with SDSUPPORT enabled and it was successful with result: Sketch uses 97576 bytes (74%) of program storage space. Maximum is 131072 bytes. Global variables use 8144 bytes (39%) of dynamic memory, leaving 12336 bytes for local variables. Maximum is 20480 bytes.

Must use different libraries. Takes four times as long to build though!

pebri86 commented 4 years ago

@Vicbarn could you share what you have done? I failed to compile using Arduino IDE.

Vicbarn commented 4 years ago

See my post on July 8th above. Need to use STM32 Cores ver. 1.6.1. The latest version may result in errors. Modified pins_MALYAN_M200.h below. pins_MALYAN_M200.zip

Vicbarn commented 4 years ago

Rename pins_MALYAN_M200.zip to pins_MALYAN_M200.h.

pebri86 commented 4 years ago

@Vicbarn thanks it works. Compiled successfully SDSUPPORT enabled without LCD uses 88KB rom. I wonder why compiled with platformio so big binary size.

Vicbarn commented 4 years ago

Hopefully @Cleric-K or @pscrespo will give us a new recipe for PlatformIO that will use the same libraries. I suspect the Arduino build uses custom HAL libraries instead of the STM HAL libraries.

pebri86 commented 4 years ago

Compile under Arduino IDE getting me serious pain, sometimes hangs or sometimes got filename too long. I manage to setting build flags platformio using arduino build flags. Here my settings

#
# Morpheus (STM32F103CB)
#
[env:STM32F103CB_morpheus]
platform      = ststm32
board         = genericSTM32F103CB
build_flags   = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py -c -w -std=gnu++14 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Wl,--gc-sections
  -DMCU_STM32F103CB
  -D__STM32F1__=1
  -DMOTHERBOARD="BOARD_MORPHEUS"
  -DSERIAL_USB
  -DENABLE_HWSERIAL3 # enable second serial on i2c pin (PB11, PB10)
  -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__
build_unflags = -std=gnu++11
lib_deps      =
src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
lib_ignore    = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SPI

with SDSUPPORT and MESH BED LEVELING enabled give me more than enough space Checking size .pio\build\STM32F103CB_morpheus\firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" DATA: [==== ] 42.2% (used 8648 bytes from 20480 bytes) PROGRAM: [======== ] 75.5% (used 98936 bytes from 131072 bytes) Building .pio\build\STM32F103CB_morpheus\firmware.bin

Hope it helps, thanks.

Vicbarn commented 4 years ago

@pebri86. Thanks, works great! Thanks for adding Serial 3 for Wi-Fi serial. I was able to have USB and Serial 3 connected at the same time and change between them just by changing Com ports in Repetier Host.

On a dual core machine with 4GB RAM Arduino IDE hangs because it uses up all the RAM and then has to page! If left long enough it eventually finishes. Great to be able to use PlatformIO!

pebri86 commented 4 years ago

Hi everyone, This little board are much capable than expected, i tried work on the software and there is enough memory and pins available (including PC13 so no debug led, PC14, and PC15 disable lse oscillator) for sdcard, i2c oled, and rotary or we have another option to enable second serial on i2c pin which is i2c oled and rotary encoder dropped but we have wifi option to connect esp01 module on those pin with ESP3D firmware.

The flash storage used 98% but the firmware is working great.

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
DATA:    [=======   ]  66.1% (used 13544 bytes from 20480 bytes)
PROGRAM: [==========]  98.6% (used 129232 bytes from 131072 bytes)

here oled working on my prototype, the board are actually bluepill compatible, they said it "Super Bluepill" but it just the same hardware with added some connector including microsd card socket.

IMG_20200116_101907

paudrat commented 4 years ago

Hi everyone. @pebri86. I see you have I2C oled and encoder working. When i try to activate I2C oled and add U8glib-hal library, i have a lot of error.... Could you please share the right config? (I use PB10 and PB11 // TwoWire Wire (2)).

pebri86 commented 4 years ago

@paudrat I also use PB10 and PB11 for SCL and SDA pin respectively. latest U8glib-hal has fixed i2c com hal for stm32 but marlin doesn't defined it in HAL_LCD_com_defines.h so you need to modify those file by yourself besides your change of TwoWire Wire (2). I use bugfix-2.0.x branch of Marlin.

Here my configuration

/* configuration.h file */
// uncomment lines
#define SLIM_LCD_MENUS // without this enabled flash storage won't fit 128K

#define U8GLIB_SSD1306
#define OLED_PANEL_TINYBOY2 // enable this to use encoder

/* HAL_LCD_com_defines.h file */

// modify file around line 46 
#elif defined(__STM32F1__)

    uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
    uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);

// enable function to use stm32 i2c wire library
    uint8_t u8g_com_stm32duino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); 
    #define U8G_COM_HAL_SW_SPI_FN     u8g_com_HAL_STM32F1_sw_spi_fn
    #define U8G_COM_HAL_HW_SPI_FN     u8g_com_stm32duino_hw_spi_fn
    #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_std_sw_spi_fn
    #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn

// enable function to use stm32 i2c wire library
    #define U8G_COM_SSD_I2C_HAL       u8g_com_stm32duino_ssd_i2c_fn 

#endif

and here my platformio.ini file

#
# Morpheus (STM32F103CB)
#
[env:STM32F103CB_morpheus]
platform      = ststm32
board         = genericSTM32F103CB
build_flags   = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py -c -w -std=gnu++14 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Wl,--gc-sections
  -DMCU_STM32F103CB
  -D__STM32F1__=1
  -DMOTHERBOARD="BOARD_MORPHEUS"
  -DSERIAL_USB
  -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__
build_unflags = -std=gnu++11
src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
lib_ignore    = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, SPI
paudrat commented 4 years ago

@pebri86. Many many many thanks... it compiles without error..................

paudrat commented 4 years ago

next step (upload) fails:

Programming Started Warn : no flash bank found for address 0x08010000 Warn : no flash bank found for address 0x0801c1a0 Warn : no flash bank found for address 0x0801d020 Programming Finished Verify Started Error: checksum mismatch - attempting binary compare embedded:startup.tcl:449: Error: Verify Failed

Any idea?

Cleric-K commented 4 years ago

Usually bluepills come with the STM32F103C8T6 chip. By specification it has 64K (0x10000) bytes Flash memory. But it is widely known that most the chips have in fact 128K.

I've had a case with bluepill ($1.5 from aliexpress) which has 64K so it was giving me the same errors as yours, when trying to flash image >64K.

Unfortunately it is almost impossible to know if the one you are buying has 128K or not. Trying to communicate with Chinese sellers about this is next to impossible.

Alas, the chip is designed to have 64K, it's just that we are used to get 128K most of the cases, so there's no one blame about this.

paudrat commented 4 years ago

@Cleric-K Thanks, i will try to solder another STM32....

paudrat commented 4 years ago

Works well with a real STM32F103CBT6..... 20200122_082131_small

pebri86 commented 4 years ago

Great, btw nice board. is your board open source projects?

paudrat commented 4 years ago

Yes it is. I am working to debug it and i will release it. It is to update my old printrbot printer but can work with any printer with 3 steppers for the axis and one extruder only. stay tuned....

paudrat commented 4 years ago

Hi everyone, I am debugging my board... all is OK except the PWM outputs. No life on the Fans and nothing hot. I use the pins PA0 to PA3 to use hardware PWM. Any idea?

pebri86 commented 4 years ago

Hi everyone, I am debugging my board... all is OK except the PWM outputs. No life on the Fans and nothing hot. I use the pins PA0 to PA3 to use hardware PWM. Any idea?

What type of your mosfet? Bluepill only output 3.3v and some mosfet needs minimum 4V on the gate.

paudrat commented 4 years ago

Yes, all have low Vgs threshold to be compatible with 3.3V logic level.

paudrat commented 4 years ago

I check with a scope............ the signals are OK on the blue pill..... so the problem is between the bluepill and the transistors..........

paudrat commented 4 years ago

I am stupid, the fans were bad wired.... Sorry....

azant commented 4 years ago

I am stupid, the fans were bad wired.... Sorry....

i had the same problem with MOSFET. i used 1kOhms pull-up with 5v and it worked! @3.3VDC some mosfets wont fully open the gate.

azant commented 4 years ago

is anyone having hang-up issues with STM32F103C8? downloaded Marlin XYZ axis work fine. the moment i try to turn on the hotend green LED stays on and i get error. when i try to config an LCD i have the same issue. could it be my ROM size ? mine is 64kb.

paudrat commented 4 years ago

For my configuration, 64kb was to small. When i add LCD config, it take about 1/3 of the memory. I unsoldered the C8 from a bluepill and resoldered a CB and after all works well but the program takes about 98% of the 128kb......

ekaggrat commented 4 years ago

hi am not able to compile marlin . I uses latest 2.0 release and tried both the boards . I am using arduino 1.8.12 and the stm 1.6.1 library . I keeps giving hardware timer error in step handler . I dont understand what that error is.

ekaggrat commented 4 years ago

``Arduino: 1.8.12 (Windows 10), Board: "Generic STM32F1 series, BluePill F103C8 (128k), Maple DFU Bootloader 2.0, Enabled (generic 'Serial'), CDC (generic 'Serial' supersede U(S)ART), Low/Full Speed, Smallest (-Os default), Newlib Nano (default)"

In file included from c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\hal.h:121, from c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\hal.h:26, from sketch\src\inc/MarlinConfig.h:30, from sketch\src\MarlinCore.h:24, from sketch\src\MarlinCore.cpp:31: c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:26: error: variable or field 'Step_Handler' declared void extern void Step_Handler(HardwareTimer htim); ^~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:26: error: 'HardwareTimer' was not declared in this scope c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:26: note: suggested alternative: 'HardwareSerial' extern void Step_Handler(HardwareTimer htim); ^~~~~ HardwareSerial c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:41: error: 'htim' was not declared in this scope extern void Step_Handler(HardwareTimer htim); ^~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:41: note: suggested alternative: 'tm' extern void Step_Handler(HardwareTimer htim); ^~~~ tm c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:26: error: variable or field 'Temp_Handler' declared void extern void Temp_Handler(HardwareTimer htim); ^~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:26: error: 'HardwareTimer' was not declared in this scope c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:26: note: suggested alternative: 'HardwareSerial' extern void Temp_Handler(HardwareTimer htim); ^~~~~ HardwareSerial c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:41: error: 'htim' was not declared in this scope extern void Temp_Handler(HardwareTimer htim); ^~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:41: note: suggested alternative: 'tm' extern void Temp_Handler(HardwareTimer htim); ^~~~ tm c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:147:8: error: 'HardwareTimer' does not name a type; did you mean 'HardwareSerial'? extern HardwareTimer timer_instance[]; ^~~~~ HardwareSerial c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h: In function 'bool HAL_timer_initialized(uint8_t)': c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:162:10: error: 'timer_instance' was not declared in this scope return timer_instance[timer_num] != NULL; ^~~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:162:10: note: suggested alternative: 'timer_num' return timer_instance[timer_num] != NULL; ^~~~~~ timer_num c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h: In function 'uint32_t HAL_timer_get_count(uint8_t)': c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:165:45: error: 'timer_instance' was not declared in this scope return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0; ^~~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:165:45: note: suggested alternative: 'timer_num' return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0; ^~~~~~ timer_num c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h: In function 'void HAL_timer_set_compare(uint8_t, uint32_t)': c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:5: error: 'timer_instance' was not declared in this scope timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:5: note: suggested alternative: 'timer_num' timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~~~~ timer_num c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:58: error: 'TICK_FORMAT' was not declared in this scope timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:58: note: suggested alternative: 'IS_RTC_FORMAT' timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~ IS_RTC_FORMAT In file included from c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\hal.h:121, from c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\hal.h:26, from c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\inc\marlinconfig.h:30, from sketch\src\HAL\DUE\fastio\G2_PWM.cpp:43: c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:26: error: variable or field 'Step_Handler' declared void extern void Step_Handler(HardwareTimer htim); ^~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:26: error: 'HardwareTimer' was not declared in this scope c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:26: note: suggested alternative: 'HardwareSerial' extern void Step_Handler(HardwareTimer htim); ^~~~~ HardwareSerial c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:41: error: 'htim' was not declared in this scope extern void Step_Handler(HardwareTimer htim); ^~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:138:41: note: suggested alternative: 'tm' extern void Step_Handler(HardwareTimer htim); ^~~~ tm c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:26: error: variable or field 'Temp_Handler' declared void extern void Temp_Handler(HardwareTimer htim); ^~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:26: error: 'HardwareTimer' was not declared in this scope c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:26: note: suggested alternative: 'HardwareSerial' extern void Temp_Handler(HardwareTimer htim); ^~~~~ HardwareSerial c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:41: error: 'htim' was not declared in this scope extern void Temp_Handler(HardwareTimer htim); ^~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:139:41: note: suggested alternative: 'tm' extern void Temp_Handler(HardwareTimer htim); ^~~~ tm c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:147:8: error: 'HardwareTimer' does not name a type; did you mean 'HardwareSerial'? extern HardwareTimer timer_instance[]; ^~~~~ HardwareSerial c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h: In function 'bool HAL_timer_initialized(uint8_t)': c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:162:10: error: 'timer_instance' was not declared in this scope return timer_instance[timer_num] != NULL; ^~~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:162:10: note: suggested alternative: 'timer_num' return timer_instance[timer_num] != NULL; ^~~~~~ timer_num c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h: In function 'uint32_t HAL_timer_get_count(uint8_t)': c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:165:45: error: 'timer_instance' was not declared in this scope return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0; ^~~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:165:45: note: suggested alternative: 'timer_num' return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0; ^~~~~~ timer_num c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h: In function 'void HAL_timer_set_compare(uint8_t, uint32_t)': c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:5: error: 'timer_instance' was not declared in this scope timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~~~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:5: note: suggested alternative: 'timer_num' timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~~~~ timer_num c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:58: error: 'TICK_FORMAT' was not declared in this scope timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~ c:\users\admin\appdata\local\temp\arduino_build_565390\sketch\src\hal\stm32\timers.h:172:58: note: suggested alternative: 'IS_RTC_FORMAT' timer_instance[timer_num]->setOverflow(overflow + 1, TICK_FORMAT); // Value decremented by setOverflow() ^~~ IS_RTC_FORMAT exit status 1 Error compiling for board Generic STM32F1 series.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

genaro14 commented 3 years ago

Hi people, i've succesfully compiled a working build with @pebri86 settings Marlin on platformio, double check the HAL route in newer versions, like this

 [env:STM32F103CB_morpheus]
platform      = ststm32
board         = genericSTM32F103CB
board_build.core = maple
build_flags   = !python Marlin/src/HAL/STM32F1/build_flags.py -c -w -std=gnu++14 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Wl,--gc-sections
  -DMCU_STM32F103CB
  -D__STM32F1__=1
  -DMOTHERBOARD="BOARD_MORPHEUS"
  -DSERIAL_USB
  #-DENABLE_HWSERIAL3 # enable second serial on i2c pin (PB11, PB10)
  -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__
build_unflags = -std=gnu++11
lib_deps      =
src_filter    = ${common.default_src_filter} +<src/HAL/STM32F1>
lib_ignore    = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SPI  

Essential configuration.h changes: #define SERIAL_PORT -1 and:

#ifndef MOTHERBOARD
  #define MOTHERBOARD BOARD_MORPHEUS
#endif 

morpheus Builded the board, thanks to @pscrespo for the work, hotend, fan , x axis and extruder are ok, no heatbed yet but im facing two issues: Y axis movement in only one way (YDIR pin seems to be always enabled, i've check the bluepill board alone). No Z movement, both directions(I haven't debugged this yet).

Has anybody successfully build a complete controller? Can you share some knowledge in here? Thank you all.

l29ah commented 3 years ago

is it me or stm32f103c8t6 (that carries 128kB of flash in fact, but only advertises 64kB) is only debuggable in the first 64kB, and the debugger explodes when it wants to jump away? also, is it possible to fit Marlin in 64kB these days?

amit-nath30 commented 3 years ago

Which thermistor to choose in marlin config? my existing printer with cnc shield with teacup firmware uses thermistor value 1 (epcos, beta 4092, 4.7k pull up) but in Morpheus it is showing -15 degree.

so if some can share which value to choose or some debug will be helpfull

paudrat commented 3 years ago

@l29ah For my configuration, 64kb was to small. When i add LCD config, it take about 1/3 of the memory. I unsoldered the C8 from a bluepill and resoldered a CB and after all works well but the program takes about 98% of the 128kb......