Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
n4bstar opened this issue Jun 12, 2022 · 139 comments
Closed

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

n4bstar opened this issue Jun 12, 2022 · 139 comments
Labels
C: Boards/Pins T: Feature Request Features requested by users.

Comments

@n4bstar
Copy link

n4bstar commented Jun 12, 2022

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 n4bstar added the T: Feature Request Features requested by users. label Jun 12, 2022
@ellensp ellensp added the Needs: More Data We need more data in order to proceed label Jun 17, 2022
@n4bstar
Copy link
Author

n4bstar commented Jun 17, 2022

@EvilGremlin
Copy link
Contributor

EvilGremlin commented Jun 18, 2022

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
Copy link
Author

n4bstar commented Jun 26, 2022

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

https://github.com/n4bstar/ce2p

@ellensp
Copy link
Contributor

ellensp commented Jun 26, 2022

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

@n4bstar
Copy link
Author

n4bstar commented Jun 26, 2022

yes it 170

@BartVB
Copy link

BartVB commented Jul 8, 2022

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
Copy link

th3dstudio commented Jul 28, 2022

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
Copy link
Contributor

EvilGremlin commented Jul 28, 2022

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
Copy link

jpraczyk commented Aug 16, 2022

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
Copy link

uski commented Sep 25, 2022

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
Copy link
Contributor

EvilGremlin commented Sep 25, 2022

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
Copy link

jpraczyk commented Sep 25, 2022

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
Copy link
Contributor

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

@uski
Copy link

uski commented Sep 25, 2022

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
Copy link

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
Copy link
Contributor

@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
Copy link
Contributor

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
Copy link
Contributor

EvilGremlin commented Sep 26, 2022

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

@houseofbugs
Copy link
Contributor

@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
Copy link
Contributor

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

@houseofbugs
Copy link
Contributor

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
Copy link
Contributor

EvilGremlin commented Sep 26, 2022

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
Copy link

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
Copy link

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

@lucas19961
Copy link

anything new ?

@InsanityAutomation
Copy link
Contributor

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.

@ellensp
Copy link
Contributor

ellensp commented Jan 25, 2024

Gihdra is legit and very powerful, in the hands of someone who can use it.

Are they reporting it all back to someone?? who cares!

@chrismclellen
Copy link

chrismclellen commented Jan 25, 2024 via email

@classicrocker883
Copy link
Contributor

Gihdra. A Blackbox reverse engineering tool offered by the government. Seems legit to me.

its used more for malware purposes. they want to see the code of viruses in order to find a fix.

@cesarweb
Copy link
Contributor

@cesarweb Can you tell me exactly what you did? I've been trying to get this to work for over a year.

I saw a bunch of configs, I used the files at Proyect Arkane to compile the .165 bin, from there I heavily modified the files to add a lot of functionality trying to solve the communications error. When I gave up, I opted for 2.1.x to see if I could port the files, thanks to the contribution of h32 by Shadow... I honestly didn't expect the screen to work. Because in the config several configurations were loaded for it to work. I just simplified the options and pinout to what seemed correct to me.

@smokeypell
Copy link
Contributor

@cesarweb You're running an Ender with an H32, correct? Comparing your pinout with my Aquila C2, it's completely different. I've been working on the Aquila C2 for over a year. Hopefully I can get something working now.

@thisiskeithb
Copy link
Member

Added in #26730

@thisiskeithb thisiskeithb removed the Needs: More Data We need more data in order to proceed label Jan 25, 2024
@shadow578
Copy link
Contributor

From my preliminary review, the firmware update process occurs in some "bootloader" because I do not see any references in the source code of the firmware reading from "user" or "factory" folder to look for the firmware update file. Thus, the update process must occur somewhere outside the firmware. You may wish to look at the source again before you proceed, though. I may be wrong. Unbrick should hopefully just involve flashing a EEPROM chip?

@evnchn @cesarweb

this is correct, the firmware update process on (afaik all) HC32 printers is done using a bootloader that looks a firmware update file on the sdcard. I've actually reverse-engineered the one used by voxelab and started a open source bootloader.

This also makes flashing the printer fairly safe.
the bootloader will never erase / overwrite any part of flash that is used by the bootloader (as long as the manufacturer didn't mess up completely), and the HC32 doesn't mirror the flash area (at least not in a way that could be dangerous in this context).
meaning as long as you've got a working firmware binary, it's almost impossible to permanently brick the printer.

@evnchn
Copy link

evnchn commented Feb 2, 2024

@cesarweb @thinkyhead Thank you for making the config and committing. I appreciate your work.

Could you please share any steps and files that were used in the process? It'll be useful for other machines in the market.

@Mategm
Copy link

Mategm commented Feb 2, 2024

Someone Could help me?
I also have an Ender 2 pro with one modification: hotend replaced to Spyder Speedy Ceramic hotend with 300 C max temp.
I think, I copied all the parameters from @cesarweb modified files, but the printer every time displays it after the boot logo: killed. : Printer halted.
Configurations.zip

@cesarweb
Copy link
Contributor

cesarweb commented Feb 2, 2024 via email

@Mategm
Copy link

Mategm commented Feb 3, 2024

Thank You dear @cesarweb, I tried to disable the Show_bootscreen but it has no effect, the problem is the same: killed.

Try disabling custom logo en config_adv... I have spyder 300° and have no trouble... Now im away from my pc until 6/2 Enviado desde Outlook para Androidhttps://aka.ms/AAb9ysg

@smokeypell
Copy link
Contributor

@Mategm
This may be a long shot, but in the pin file "src/hc32f4/pins_CREALITY_ENDER2P_V24S4.h", look for this line at the very bottom.
#define KILL_PIN EXP1_04_PIN
comment it out and then compile again and see if this fixes it.
//#define KILL_PIN EXP1_04_PIN

@Mategm
Copy link

Mategm commented Feb 4, 2024

Great! Thank You @cesarweb! It works!
This is the first time when the Marlin is installed on my ender 2p :D
Sucsessfully Sucsess!

@Mategm This may be a long shot, but in the pin file "src/hc32f4/pins_CREALITY_ENDER2P_V24S4.h", look for this line at the very bottom. #define KILL_PIN EXP1_04_PIN comment it out and then compile again and see if this fixes it. //#define KILL_PIN EXP1_04_PIN

@mowag
Copy link

mowag commented Feb 7, 2024

Great! Thank You @cesarweb! It works! This is the first time when the Marlin is installed on my ender 2p :D Sucsessfully Sucsess!

@Mategm This may be a long shot, but in the pin file "src/hc32f4/pins_CREALITY_ENDER2P_V24S4.h", look for this line at the very bottom. #define KILL_PIN EXP1_04_PIN comment it out and then compile again and see if this fixes it. //#define KILL_PIN EXP1_04_PIN

Same problem as @Mategm, same solution, just comment out #define KILL_PIN EXP1_04_PIN . E2P seems to work fine and healthy, now just testing it out. Thanks @cesarweb @shadow578 @smokeypell .

@Petkoj
Copy link

Petkoj commented Feb 11, 2024

Hi, Does anyone have a compiled bin file? I tried to turn on the printer writes that the printer is killed then bad eeprom. Even if the printer started with an eeprom error, the filament insertion/removal options were missing. There were no advanced settings. Thank you

@Mategm
Copy link

Mategm commented Feb 11, 2024

Hi! Yes, I have, but there is a good config file on the marlin config github:
https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-2%20Pro/CrealityV24S4

This perfect for the beginning, but If you cannot compile it, please ping me.
No I am on the modification phase Now I trying to setup the perfect settings for printing.

Hi, Does anyone have a compiled bin file? I tried to turn on the printer writes that the printer is killed then bad eeprom. Even if the printer started with an eeprom error, the filament insertion/removal options were missing. There were no advanced settings. Thank you

@Petkoj
Copy link

Petkoj commented Feb 11, 2024

Hi! Yes, I have, but there is a good config file on the marlin config github: https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-2%20Pro/CrealityV24S4

This perfect for the beginning, but If you cannot compile it, please ping me. No I am on the modification phase Now I trying to setup the perfect settings for printing.

Hi, Does anyone have a compiled bin file? I tried to turn on the printer writes that the printer is killed then bad eeprom. Even if the printer started with an eeprom error, the filament insertion/removal options were missing. There were no advanced settings. Thank you

I downloaded Marlin-e2p-2.4.s4 + Configurations from cesarweb. I installed Visual studio code + auto build extension.
I copied the config files (Configuration.h,Configuration_adv.h....) into the merlin folder. Edited //#error "Don't build with import-2.1.x configurations!"
//#error "Use the 'bugfix...' or 'release...' configurations matching your Marlin version."
Then I edited "src/hc32f4/pins_CREALITY_ENDER2P_V24S4.h" //#define KILL_PIN EXP1_04_PIN
I compiled it, the bin is 142Kb in size and says Err: EEPROM Version.
I don't know if I'm doing something wrong? thanks

@smokeypell
Copy link
Contributor

@Petkoj Just to be clear, are you positive that you have the HC32 chip?

@Petkoj
Copy link

Petkoj commented Feb 11, 2024

@Petkoj Just to be clear, are you positive that you have the HC32 chip?

IMG_20240210_231031

@smokeypell
Copy link
Contributor

smokeypell commented Feb 11, 2024

Ok. Good deal. Just checking so we're not chasing the wrong issue.

Looking over everything that I can see, according to the original code published by Creality, the pin file looks correct except for
//
// Servos
//
#ifndef SERVO0_PIN
#define SERVO0_PIN PB0 // BLTouch OUT *
#endif
According to the Creality files, SERVO0_PIN should be PB2.

Go ahead ad just delete this line completely.
#define KILL_PIN EXP1_04_PIN

In the Configuration.h file, uncomment the following two lines.
#if ENABLED(EEPROM_SETTINGS)
//#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
//#define EEPROM_INIT_NOW // Init EEPROM on first boot after a new build.
#endif

Recompile and hopefully you'll be good.

If not, I'll help all I can.

@Mategm
Copy link

Mategm commented Feb 11, 2024

@Petkoj
Try this, that was my first trying what works. Unzip it, because the system cannot enable me to attach a bin file:
Marlin_replace_original_Ender2P.zip

Please make a 'user' folder on a memory card and put the bin file in it. I hope it will help You. Good Luck.

@Petkoj
Copy link

Petkoj commented Feb 13, 2024

@Petkoj Try this, that was my first trying what works. Unzip it, because the system cannot enable me to attach a bin file: Marlin_replace_original_Ender2P.zip

Please make a 'user' folder on a memory card and put the bin file in it. I hope it will help You. Good Luck.

it did the same to me. There were no improvements and the possibility of pulling out and inserting the filament was missing. Printing from the SD card was only after about printer. so I used another firmware.

But thanks for the help anyway

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: Boards/Pins T: Feature Request Features requested by users.
Projects
None yet
Development

No branches or pull requests