shadow578 / Marlin-H32

Marlin for HC32F460 based printers (now in upstream)
http://marlinfw.org
GNU General Public License v3.0
13 stars 7 forks source link

[Help Wanted] ISP programmer testing #39

Closed shadow578 closed 3 months ago

shadow578 commented 11 months ago

looking for a person that is willing to help in testing the unbricking procedure (ISP programming) of HC32-based printers.

to my information, programming the chip directly should be fairly straightforward. but i only have the one board in my only printer and i'd like to not risk breaking it...

please leave a comment under this issue if you're willing to help


update: i've since started development of a custom bootloader for HC32, which takes less space than the stock one. This could allow for larger Marlin builds to be used, unlocking the ability to use more & more advanced features. See shadow578/OpenHC32Boot for the bootloader repo.

classicrocker883 commented 11 months ago

I may be able to help, what is the process?

shadow578 commented 11 months ago

tbh, i'm not quite sure about the exact process myself....

for a start, you could do the following things:

  1. comment the exact model of printer you have (e.g. Voxelab Aquila X2 (H32)), the time of purchase, and the initial firmware version
  2. dump the bootloader of your printer using https://github.com/shadow578/marlin-flash-dump (i hope the readme there is understandable)
    • dump the flash from address 0 to BFFF, this should be the entire bootloader
    • dump the bootloader twice, then compare both dumps are equal (checksums should be equal, test on windows with Get-FileHash
    • upload both the .txt and .bin files the utility creates (there might still be some issues with the dumping utility, so keeping the raw response could be useful)
    • why?: i'd like to check if there are differences in the bootloaders of different printers, be it by model or time difference
  3. open the printer's mainboard enclosure, and note the following details:
    • Mainboard Name + Version (eg. FFP0173_Aquila_Main_Board_V1.0.2)
    • model number of the SoC (eg. HC32F460 KCTA
    • model of the I2C EEPROM (near the screen port; eg. 24C16)
    • if possible, check if the connections shown in the reference image are the same (or similar) on your board
    • if possible, please take a high-resolution and upload it too (without metadata)
    • reference image: MB_annotated
    • why?: i'd like to see if there are differences between different mainboard revisions, especially if there are boards with the 512K version of the HC32

also, is there a way to communicate outside of github messages? i'm not quite sure about some of the licensing of the tools and documents i'd like to provide to you, and i'm not quite comfortable uploading them publicly

classicrocker883 commented 11 months ago

I believe everything I have is exactly as the picture is referring to.

I don't think there are 512k chips on any other board. I asked this question before and it seems all are 256k.

for my board does it matter if I already have another firmware than stock installed? or how should this be done now?

shadow578 commented 11 months ago

I don't think there are 512k chips on any other board. I asked this question before and it seems all are 256k.

would it be possible to check by opening the printer? for future steps, you'll also need access to the mainboard...

for my board does it matter if I already have another firmware than stock installed? or how should this be done now?

i don't quite understand what you mean by this, goal of this testing is to a) dump and b) re-flash a bootloader using external tools. The firmware you've installed does not affect the bootloader at all, so it does not matter. tho for the 2. part, you'll need to flash a modified version of marlin to allow dumping the bootloader.

classicrocker883 commented 11 months ago

ill be doing the flash dump thing soon, just had it all set up.

what I asked before was does it matter if the firmware is not originally stock? but i guess it doesnt matter.

classicrocker883 commented 11 months ago

so should the .bin binaries be a maximum of 208k?

because it seems to be an issue, if the .ini is defined with 208k the max file size for firmware.bin is 208k. and i think that these H32 cant have anything more because of that limit. for instance a nomal Aquila G32 has a 256K chip, however the max size for the .bin is 228K. it cant compile any larger, and I tested it cant flash with anything more than 228K.

so what I'm saying is these chips should actually be limited to 208K rather than 256K, granted they are 256K but as you say the bootloader takes room. so binaries shouldnt be anymore than the 208K threshold.

shadow578 commented 11 months ago

so should the .bin binaries be a maximum of 208k?

because it seems to be an issue, if the .ini is defined with 208k the max file size for firmware.bin is 208k. and i think that these H32 cant have anything more because of that limit. for instance a nomal Aquila G32 has a 256K chip, however the max size for the .bin is 228K. it cant compile any larger, and I tested it cant flash with anything more than 228K.

so what I'm saying is these chips should actually be limited to 208K rather than 256K, granted they are 256K but as you say the bootloader takes room. so binaries shouldnt be anymore than the 208K threshold.

yes, binaries must be below 212992 bytes in size, so about 208K. I'm currently looking into this in more detail, but it might take some time...

for now, i've created a issue https://github.com/shadow578/Marlin-H32/issues/40 to track this problem

shadow578 commented 3 months ago

solved by knowledge gained in currently ongoing https://github.com/shadow578/OpenHC32Boot rewrite.

TL;DR

ISP programming (e.g. for unbricking of a printer) can be done using a SWD debug probe (CMSIS-DAP via raspberry pi pico debug probe tested) and pyOCD. required changes have been implemented into the platformio packages and are currently beign tested