MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
15.97k stars 19.09k forks source link

[FR] (Unkown Mainboard with HC32F460 MCU) #24338

Closed n4bstar closed 4 months ago

n4bstar commented 1 year ago

Is your feature request related to a problem? Please describe.

New Ender 2 pro Mainboard with HC32F460 MCU not found in list.

Are you looking for hardware support?

Yes, try fixing hardware isusses with clean Marlin Firmware for the Creality Ender 2 Pro

Describe the feature you want

Firmware for New Creality Ender 2 Pro Mainboard.

Additional context

No response

n4bstar commented 1 year ago

Picture from the mainboard

EvilGremlin commented 1 year ago

Bad image, make good sharp hi-res photo of both sides with PCB traces visible and marking on the chip readable. Looks like we have F4 clone in addition to F1 https://www.hdsc.com.cn/Category83-1483

n4bstar commented 1 year ago

I have uploaded new images, this is maximum what i can do on quality.

https://github.com/n4bstar/ce2p

ellensp commented 1 year ago

Another new CR-FDM this ones a V2.4.S4.??? (last 3 digits are obscured, guessing 170)

n4bstar commented 1 year ago

yes it 170

BartVB commented 1 year ago

The Anycubic Kobra and some versions of the Voxelab Aquila also use this chip.

These machines are delivered with Marlin running on them so someone has already ported Marlin to the HC32F460 and because of the GPL license they are required to publish their modifications. I know that Anycubic has been promising to do just that for a while now but haven't seen any actual code yet.

@n4bstar you might want to send Creality a message asking for the Marlin source code for your printer.

th3dstudio commented 1 year ago

The Anycubic Kobra and some versions of the Voxelab Aquila also use this chip.

These machines are delivered with Marlin running on them so someone has already ported Marlin to the HC32F460 and because of the GPL license they are required to publish their modifications. I know that Anycubic has been promising to do just that for a while now but haven't seen any actual code yet.

@n4bstar you might want to send Creality a message asking for the Marlin source code for your printer.

This is correct. Good luck getting them to comply, I've been barking up that tree for years and just gave up. I hope you get it. If you want to use Marlin on that printer you're going to have to swap the board unless they cough up some source code.

EvilGremlin commented 1 year ago

This should be same as STM32F469, but i read about differnet interrupt vectors offset and some other funny things https://translate.google.com/translate?sl=auto&tl=en&u=https://blog.csdn.net/jjp969988159/article/details/114976562

jpraczyk commented 1 year ago

I've created a dump of the flash from this board. Mine is also 2.4.S4.170. This MCU (HC32f460kcta) has 256 KB of flash and 192 KB of ram available.

pyocd> show map
 Region   Type   Start       End         Size        Access  Sector      Page
 flash    Flash  0x00000000  0x0003ffff  0x00040000  rx      0x00002000  0x00000200
 flash_1  Flash  0x03000c00  0x03000ffb  0x000003fc  rx      0x000003fc  0x000003fc
 ram      Ram    0x1fff8000  0x20026fff  0x0002f000  rwx     -           -
 ram_1    Ram    0x200f0000  0x200f0fff  0x00001000  rwx     -           -

ender2proflash+ram.zip

EDIT: Adding firmware binary I got from Creality support

Ender-2pro-hw2.4.s4xx-sw2.2.36_165.bin.zip

Update instructions from Creality:

Update Notes:
Software version: Ender-2Pro-hw2.4.s4_XXXX-SW2.2.4_xxx (firmware. Bin) XXXX: indicates a different motor socket port. XXX: indicates different print sizes. Currently, there are two sizes: 165 and 200
Production software brush in:
Create the Factory folder in the TF Kagen directory, and import the firmware.bin file into this folder.
Insert it into the TF card slot of the machine, power it on again, wait for the update to be completed and enter the system, indicating that the update is complete.
Note: After the update, you need to pull out the card. If you use this update method, the card program file,
After the system is powered on, the firmware is updated each time. After the firmware is updated, the system does not delete the updated firmware.
User software brush in:
TF Kagen directory to create the user folder, import the firware. Bin file to this folder,
Insert it into the TF card slot of the machine, power it on again, wait for the update to be completed and enter the system, indicating that the update is complete.
Note:
After the update is complete, the system automatically deletes the updated firmware. If you want to brush the firmware again, you need to re-enter the corresponding updated firmware
uski commented 1 year ago

The Marlin firmware is released under the GPL. I believe the focus of this topic should be to request Creality to release the firmware, as per the GPL forces them to, instead of trying to port the firmware ourselves. This is the whole point of the GPL.

EvilGremlin commented 1 year ago

Requests are being sent like every day, all pretty much ignored. And let's be honest, their code is mostly garbage in need of complete rewrite. (mostly because they use very old codebase)

jpraczyk commented 1 year ago

Requests are being sent like every day, all pretty much ignored. And let's be honest, their code is mostly garbage in need of complete rewrite. (mostly because they use very old codebase)

The only public Marlin release for HC32F460 that I've found is https://github.com/Voxelab-64/Aquila_X2/tree/main/firmware/Sources and saying it's hacky is like not saying anything. So far the creality firmware looks similar to this, looking at the binaries in ghidra. Bootloader checks whether firmware update files are stored on the sd (factory which also contains the Bootloader or user which only contains Marlin) It writes the new firmware then jumps to 0x8000. Looks like creality uses the same ddl as Aquila, there is no arduino compatible framework for that mcu so porting will be painful. I may give it a try as soon as my skr mini e3 v3 arrives, so that I have something to fall back to, but no promises yet.

EvilGremlin commented 1 year ago

i'm sure they're just using STM32 framework with custom linker script at most

uski commented 1 year ago

Part of the issue is that they do this while knowing/assuming they can get away without publishing anything. So far this has proven true.

If they know they are going to have to publish the code, they may make more efforts to write cleaner code and/or just push the changes upstream like so many other companies are doing when they contribute to OSS projects.

Separate discussion in issue #24801 about trying to get them to comply.

jpraczyk commented 1 year ago

i'm sure they're just using STM32 framework with custom linker script at most

Highly unlikely, this mcu is not meant to be a drop-in replacement for stm32 similar to gd32.

EvilGremlin commented 1 year ago

@jpraczyk i linked article above, NVIC address is main difference, might be some other less prominent ones - but using stm32 frameworks is still easiest way @uski compelled to do cleaner code? LOL, not happening, look at Sovol SV04, look at LVGL_UI history... As were said multiple times before, the only way to make them comply is to damage their revenue enough for them to care.

houseofbugs commented 1 year ago

Requests are being sent like every day, all pretty much ignored. And let's be honest, their code is mostly garbage in need of complete rewrite. (mostly because they use very old codebase)

I setup a list and a reporting form today. That printer is now on said list: https://gplviolations.th3dstudio.com/

EvilGremlin commented 1 year ago

@houseofbugs there is vyper source, complete with extui code, they sent it to someone via email Anycubic Vyper-vyper.zip

houseofbugs commented 1 year ago

@houseofbugs there is vyper source, they sent it to someone via email Anycubic Vyper-vyper.zip

Excellent. I will update the list. I dont have time to keep up with it hence why I am going to rely on people reporting things to me.

EvilGremlin commented 1 year ago

i really should upload some of my stashes as fork branches...

houseofbugs commented 1 year ago

Maybe someone could make a github repo just to store the sources? Sorted by brand and model in folders. Keep it simple. I would but my time is limited.

EvilGremlin commented 1 year ago

that too, but proper fork is way more useful, you can throw diff links around this is main grief with vendor's not-forks

fufuakuseru commented 1 year ago

Anycubic has finally released their source code for their Kobra and Kobra Max using this MCU. Hopefully somebody more clever than me can put it to good use

jpraczyk commented 1 year ago

I have personally given up on the 2.4.S4.170 board. Replaced it with an skr mini e3 v3.

lucas19961 commented 1 year ago

anything new ?

InsanityAutomation commented 1 year ago

We have working source for 2 other machines using the MCU, and they are building it in Kiel, instead of platformIO, so it will not be a simple task to get working in the standard environments. There is at least a way to work though.

houseofbugs commented 1 year ago

We have working source for 2 other machines using the MCU, and they are building it in Kiel, instead of platformIO, so it will not be a simple task to get working in the standard environments. There is at least a way to work though.

This is the key here. If someone who knows how to port from Kiel to platformIO can do it for the HC series that would be the major hurdle to getting these supported in Marlin.

thisiskeithb commented 1 year ago

If someone who knows how to port from Kiel to platformIO

It sure would be nice for non-Windows users.

InsanityAutomation commented 1 year ago

If someone who knows how to port from Kiel to platformIO

It sure would be nice for non-Windows users.

Kiel is the arm uVision environment, it's cross platform.

We have working source for 2 other machines using the MCU, and they are building it in Kiel, instead of platformIO, so it will not be a simple task to get working in the standard environments. There is at least a way to work though.

This is the key here. If someone who knows how to port from Kiel to platformIO can do it for the HC series that would be the major hurdle to getting these supported in Marlin.

PlatformIO needs to add support for the chip first before Marlin can adopt it, but we may be able to work towards that. On the flip side, I'd like to go through this for methods to support other generic cmsis platforms that platformio doesn't support.....

thisiskeithb commented 1 year ago

Kiel is the arm uVision environment, it's cross platform.

If you consider VMs cross-platform, sure.

InsanityAutomation commented 1 year ago

Kiel is the arm uVision environment, it's cross platform.

If you consider VMs cross-platform, sure.

I was under the impression it ran underneath one of the runtime environments like wine, but it may be a different open source compatible tool that I was thinking of. Been a long time since I've even looked. Not something I commonly need to touch.

InsanityAutomation commented 1 year ago

Just went and double checked. The uVision ide is windows only. Keil is also part of the arm development studio which is cross platform. Should be no issue opening the project there.

lucas19961 commented 1 year ago

https://www.reddit.com/r/anycubic/comments/y2waxu/tutorial_how_to_build_anycubic_marlin_source_code/ maybe have a look here

doctorevil30564 commented 1 year ago

watching this thread with great interest. I bought a ender 2 pro recently and it has one of the 2.4.S4 mainboards in it. I am having issues with running prints thru octoprint on this printer, where it stutters and it's ruining the quality of the print. the same gcode ran locally runs great. I believe the buffers and baud rate need to be increased in the firmware for the usb serial connection to fix it. I also asked Creality for the firmware and the link they sent me doesn't appear to have a specific repo for this particular chip

jojos38 commented 1 year ago

e print. the same gcode ran locally runs great. I believe the buffers and baud rate need to be increased in the firmware for the usb

Hey, try to disable power off recovery in the firmware also

mfraser commented 1 year ago

Disabling power off recovery doesn't help.

doctorevil30564 commented 1 year ago

e print. the same gcode ran locally runs great. I believe the buffers and baud rate need to be increased in the firmware for the usb

Hey, try to disable power off recovery in the firmware also

That didn't work. I wound up buying a used 4.2.7 mainboard and I compiled custom firmware for it using the 2.1.x bugfix marlin code. It's running smoothly now.

mfraser commented 1 year ago

e print. the same gcode ran locally runs great. I believe the buffers and baud rate need to be increased in the firmware for the usb

Hey, try to disable power off recovery in the firmware also

That didn't work. I wound up buying a used 4.2.7 mainboard and I compiled custom firmware for it using the 2.1.x bugfix marlin code. It's running smoothly now.

I've got a 4.2.3 board I'm intending to replace it with after Christmas.

mfraser commented 1 year ago

e print. the same gcode ran locally runs great. I believe the buffers and baud rate need to be increased in the firmware for the usb

Hey, try to disable power off recovery in the firmware also

That didn't work. I wound up buying a used 4.2.7 mainboard and I compiled custom firmware for it using the 2.1.x bugfix marlin code. It's running smoothly now.

I've got a 4.2.3 board I'm intending to replace it with after Christmas.

The 4.2.3 board is now installed. OctoPrint now works.

jpraczyk commented 1 year ago

If anyone's still running the hc32f460 boards, it looks like they've released the sources for that https://github.com/CrealityOfficial/Ender-2-Pro - MCU_HDSC branch.

ABBolle commented 1 year ago

Can anyone confirm that these are the correct sources? And is anything else missing for getting support for the Ender 2 pro (with hc32f460 MCU)?

ChubbyBunny1 commented 1 year ago

If anyone's still running the hc32f460 boards, it looks like they've released the sources for that https://github.com/CrealityOfficial/Ender-2-Pro - MCU_HDSC branch.

Yeah it seems they released the code, any clue what to use to build the marlin for the HC32F460 mcu?

EvilGremlin commented 1 year ago

Keil. uVision IDE or whatever it's called nowadays.

ChubbyBunny1 commented 1 year ago

I have installed the uVision, but there is no .uvprojx file provided by creality. There is only a file called firmware.uvoptx in the workspace folder.

genko commented 1 year ago

I have installed the uVision, but there is no .uvprojx file provided by creality. There is only a file called firmware.uvoptx in the workspace folder.

It seems like they are using the BAT file to compile via CLI. https://github.com/CrealityOfficial/Ender-2-Pro/blob/MCU_HDSC/workspace/firmware_Release.BAT

ChubbyBunny1 commented 1 year ago

I have installed the uVision, but there is no .uvprojx file provided by creality. There is only a file called firmware.uvoptx in the workspace folder.

It seems like they are using the BAT file to compile via CLI. https://github.com/CrealityOfficial/Ender-2-Pro/blob/MCU_HDSC/workspace/firmware_Release.BAT

Correct. I can see in the first line there are some paths. Whare are those for? Of cource the script doesnt run. What compiler should be installed? In the script it has some armcc comands. Is the ARM V5 compiler?

genko commented 1 year ago

Correct. I can see in the first line there are some paths. Whare are those for? Of cource the script doesnt run. What compiler should be installed? In the script it has some armcc comands. Is the ARM V5 compiler?

Actually the first line is not needed. It seems to export a lookup path for binaries but looks like they decided to hardcode the binary path later.

"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC"

According to the listing files they expect the official arm compiler that ships with uVision in version 5.36. So make sure your compiler binary is available under the path "C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" or do a search and replace for this string with the actual location on your system.

There will be more troubles ahead. You will need files for the architecture as well:

-IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\Core\Include -IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\DSP\Include -IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\DSP\PrivateInclude -IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\HDSC\HC32F46x\1.0.2\Device\Include

These are include pathes that are hardcoded in all listing files. The first three seem to be from the CMSIS hardware abstraction framework for cortex mcus. You might get this with uVision. Where you get the mcu specific files in the folder HDSC\HC32F46x\1.0.2\Device\Include I currently do not know. Maybe you can check if you can download mcu support packages with uVision for this chip.

ChubbyBunny1 commented 1 year ago

Correct. I can see in the first line there are some paths. Whare are those for? Of cource the script doesnt run. What compiler should be installed? In the script it has some armcc comands. Is the ARM V5 compiler?

Actually the first line is not needed. It seems to export a lookup path for binaries but looks like they decided to hardcode the binary path later.

"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC"

According to the listing files they expect the official arm compiler that ships with uVision in version 5.36. So make sure your compiler binary is available under the path "C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" or do a search and replace for this string with the actual location on your system.

There will be more troubles ahead. You will need files for the architecture as well:

-IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\Core\Include -IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\DSP\Include -IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\DSP\PrivateInclude -IC:\Users\DeskCX-1900\AppData\Local\Arm\Packs\HDSC\HC32F46x\1.0.2\Device\Include

These are include pathes that are hardcoded in all listing files. The first three seem to be from the CMSIS hardware abstraction framework for cortex mcus. You might get this with uVision. Where you get the mcu specific files in the folder HDSC\HC32F46x\1.0.2\Device\Include I currently do not know. Maybe you can check if you can download mcu support packages with uVision for this chip.

Alot of the package information and what is needed is availabe in here https://github.com/CrealityOfficial/Ender-2-Pro/blob/MCU_HDSC/workspace/list/firmware.build_log.htm

I have downloaded what is needed and i am workining towards building the bin file using the .bat. All the .__i filles needed to be opened and configured their paths to match each system. Once i manage to build the bin file succesfully without any errors i will make a post, step by step proccess.

ChubbyBunny1 commented 1 year ago

Seems that i am missing a glib.lib file. When i am trying to compile i am getting this error: C:\Users\Tasos\Downloads\ender 2 pro\Ender-2-Pro-MCU_HDSC\Ender-2-Pro-MCU_HDSC\workspace>"C:\Keil_v5\ARM\ARMCC\Bin\ArmLink" --Via ".\list\firmware.lnp" Fatal error: L6002U: Could not open file .\glib.lib: No such file or directory Finished: 0 information, 0 warning, 0 error and 1 fatal error messages.

Anyone have an idea where i can find it? I have searched google but cant find information about the .lib file. Do i need to compile glib somehow?

tom0579 commented 1 year ago

Hi, any progress ?