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
16.34k stars 19.26k forks source link

[FR] Tronxy V10 controller #23761

Closed michalsok closed 2 years ago

michalsok commented 2 years ago

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

I received my new TronXY X5SA-PRO with PRO-2E upgrade (dual extruder to one nozzle) I tried to compile Marlin for it but realized that my controller is new and not supported. The controller uses STM32F446ZET6 MCU unlike the older V5,V6,V9 I have spent hours probing and mapping the pins of the MCU. I believe I have them all right. I copied the configuration files from Tronxy_V6 Chitu3D_V6-2E and modified as needed. I created a pins_custom.h and added my pinout to it. I tried to compile using custom board but could not setup a correct platformio environment to compile. I then hijacked the octopus_1.1 board and edited its pins file to match the new chitu3d_V10 as it uses the same MCU but still get compile errors. I am out of my league and will leave this to you the pros. My hours of probing/mapping pins and will to test a build if someone is able to compile will be my contribution. Board has an EEPROM that is not defined in my configs/pins files. it is 24c16 I2C 16Kbit (2KB) part It has SPI 32Mbit (4KB) Flash 25Q32 It uses 480x320, 3.5", FSMC Stock Display from TronxXY (#define TFT_TRONXY_X5SA) Uses TMC2225 drivers (2208_standalone option) All my settings are based on dual extruder version but single extruder is same minus E2 motor driver. If someone can help define new board and pins and proper build environment for the new MCU i will test the functionality.

Are you looking for hardware support?

TRONXY-X5SA-PRO, TRONXY-X5SA-PRO-2E with new "V10" board that uses STM32F446ZET6 MCU and 480x320, 3.5", FSMC Stock Display from TronxXY (#define TFT_TRONXY_X5SA)

Describe the feature you want

New controller support

Additional context

TronXY seem to have compiled a version of Marlin for their new boards but update to it did not work and corrupted my board. Their bootloader still works and displays a version but no firmware starts. I followed their included inst. video and files get copied from SD but then error message pops up "No firmware to start!" I verified I have the "446 version of their board. Peeled the sticker from MCU to verify ST Part Number. The board is labeled as V6 but the date code behind it is new. I believe the silkscreen was not updated. There is no boot jumper. Boot pin is hardwired. Only way to update is their bootloader from SD or ST-Link. There is a 4pin ST-Link programming header. https://www.tronxy.com/marlin-firmware-for-tronxy-3d-printer/

My pins and config files:

config and pins.zip Mainboard-446 after update 20220215_152729 20220212_132001

michalsok commented 2 years ago

Did I post this in a wrong place?

ellensp commented 2 years ago

There is zero information available for this board. where is the bootloader in flash, how is the data encrypted (tronxy love to encrypt the data) or any of the other data required to create a variant for this is board.

thumptech commented 2 years ago

I'm looking at this at the moment. I was able to dump the firmware out with the latest STM32 cube programmer and STLINKV2 and the resulting file had all of the user interface strings human readable at the end, so I don't think any encryption is present

Edit: I dumped the firmware again powering the board from usb rather than 24V. I got a slightly different result, but the programmer was stable and all subsequent dumps were identical with FC. I have attached the confirmed dump CXY-V10-20210309_1.zip .

Edit2: I've erased the firmware, confirmed the board was bricked, flashed the above file and it came back again.

thumptech commented 2 years ago

I have the firmware compiling and uploading now. Hopefully I can use that pin tracing above to get this to work.

thumptech commented 2 years ago

Serial is now working after using the internal clock source on the STM32 and I'm getting serial output. Now I'm having trouble getting the eeprom to write as the WP pin is actually hooked up to the MCU. Also I'm unsure what the 8mhz crystal is doing. Once I get a bit further, I will fork the repo.

Update: EEPROM is working now. I had the clock configuration totally wrong and only had the board running at 16MHz.

thumptech commented 2 years ago

Struggling to get the SD Card to work, I just get a boot loop. Also cannot get the steppers to work yet. It's as if TRONXY just messed with every default pin just to try skirting open source.

thumptech commented 2 years ago

SD Card is now working. Had to configure SDIO. Next is the stepper drivers. LCD is a low/no priority and I'm still troubled by the 8mhz crystal. I do wonder if it is used as a clock source to drive the steppers.

thumptech commented 2 years ago

X, Y, Z, Z2 and E1 steppers are working. My board does not have E2 IC installled. Also of note is my ICs were TMC2209 and the UART was not connected to the MCU despite the bulk amount of GPIO available. The Z2 actually had its own pins that were missed on the pin tracing above.


#define Z2_STEP_PIN                          PF6
#define Z2_DIR_PIN                           PF4
#define Z2_ENABLE_PIN                        PF7

I tried to get the LCD to work, but the STM32F446 uses an "FMC" rather than an "FSMC" and the Marlin HAL bindings aren't set up to support it. I'd love some help here.

I'll try to get the rest of the IO going then commit my fork.

thumptech commented 2 years ago

OK, it's a bit of a mess and you will need an STLINK/V2. LCD is not working. 8mhz crystal also unused.

https://github.com/thumptech/Marlin/commit/5693cbbdd1ef430aebf7d79e485b1ae2f620c8fe

I've set it up for my XSA-500 with a 3D touch using filament 1 pin for servo but I haven't actually tested other than on the bench.

thumptech commented 2 years ago

I have the LCD showing the splash screen now, after that it corrupts as if the color ui is trying to send the incorrect resolution. The garbage shown on the screen repeats and can be changed by using M117

thumptech commented 2 years ago

LCD is working now. I stupidly had some conflicting pins from blindly copying and pasting. Only the flash memory and the 8mhz are not implemented now.

thinkyhead commented 2 years ago

Sounds close. Which of our existing boards is closest to this one?

thumptech commented 2 years ago

I'm not really sure. Maybe the fystec spider but my configs ended up being from scratch starting from the oscillator configuration in STM32CubeMX. Anyway. unless that 8mhz crystal is needed for something I haven't come across yet, or LVGL is some must have feature, I'm happy with where it is. I made my own board definitions in my repo.

thumptech commented 2 years ago

It is worth noting I had to modify the tft_fsmc files to work with FMC. In hindsight I should have made a new class, but it works as is.

jasonr517 commented 2 years ago

Hi thump I recently picked up a Tronxy X5SA Pro 400with the same board and noticed the same issue about the environment. I don’t mean to clutter this thread but it sends you got Marlin working on your 2E and 500 can I ask how you’re uploading it to the machine or could you possibly email me?

thumptech commented 2 years ago

I'm using an ST-LINK V2 and programming from Visual Studio Code/PlatformIO directly. I tried to get SD Card upload to work using the TronXY bootloader, but had no success. I found the board needs to be powered from USB to program and the external 24V supply must be off.

jasonr517 commented 2 years ago

Ahh okay thank you for the quick reply def way over my head though lol

thumptech commented 2 years ago

Hopefully TRONXY release their actual source code, it's a total joke they are using marlin and not sharing it.

aimwaffel commented 2 years ago

I might have come over some interesting piece of code: http://www.tronxy.cn/web/userfiles/download/XY-3SE-Marlin.zip Looks like some original tronxy 103 AND 446 sources. I recently got myself an X5SA Pro with the 446 controller and want to do some changes with the hot end and also maybe the heated bed, where i would have to do edits in the Marlin FW. I was not able to compile the firmware inside the link i posted, did not waste a whole lot of time on this yet, maybe one of you pros will have more luck and even post a short tutorial.

kliberty commented 2 years ago

I might have come over some interesting piece of code: http://www.tronxy.cn/web/userfiles/download/XY-3SE-Marlin.zip Looks like some original tronxy 103 AND 446 sources.

Do you have a copy of the downloaded file you can share? The link is not working for me.

aimwaffel commented 2 years ago

Download works, is just awfully slow (im downloading right now, takes forever til it starts) If you have a private space where i can upload to i would do so, i dont want to just publicly put it out there.

thumptech commented 2 years ago

My repo works, it just doesn't allow the LVGL interface.

thisiskeithb commented 2 years ago

My repo works, it just doesn't allow the LVGL interface.

Will you send a PR our way? It's OK if LVGL doesn't work since there are a couple more UI options.

thumptech commented 2 years ago

My repo works, it just doesn't allow the LVGL interface.

Will you send a PR our way? It's OK if LVGL doesn't work since there are a couple more UI options.

No problems, it is a bit of a mess though, so please raise any issues and I'll sort them out. If I can get a look at the leaked source code mentioned above, I can try to integrate it.

Additionally, I've never collaborated via a pull request so I've no doubt done something stupid.

Finally, the pull request turned into more trouble than it's worth. Good luck, this unfortunately isn't what I'm paid for and I can't justify the time needed to work in the constraints stated.

aimwaffel commented 2 years ago

Surprise, surprise: I contacted tronxy via email and asked them for the firmware sources for my X5SA Pro with 446 board (explaining the Marlin license and stuff)... and they sent me a DL link to the firmware. I dont want to post that link here cause its personalized but would upload the stuff to some anonymous webspace - anyone interested and can provide some space?

thisiskeithb commented 2 years ago

I dont want to post that link here cause its personalized but would upload the stuff to some anonymous webspace - anyone interested and can provide some space?

What do you mean by "personalized"? If it's too big to post here as a .zip, then you can use something like https://www.file.io/ , https://easyupload.io/ , https://mega.io/ , etc.

aimwaffel commented 2 years ago

I dont want to post that link here cause its personalized but would upload the stuff to some anonymous webspace - anyone interested and can provide some space?

What do you mean by "personalized"? If it's too big to post here as a .zip, then you can use something like https://www.file.io/ , https://easyupload.io/ , https://mega.io/ , etc.

They sent me a link to a private file, uploaded to a cloud space only for me and identifyable by a key. Its about 270MB in size, about the same as the link from their chinese site that i posted. I will upload it to one of your suggested services in a few hours.

aimwaffel commented 2 years ago

OK girls and boys here is the stuff: https://easyupload.io/6vqkvq will be there for 30 days...

thisiskeithb commented 2 years ago

OK girls and boys here is the stuff:

I won't complain about a vendor providing source code, but it sure is a mess.

aimwaffel commented 2 years ago

OK girls and boys here is the stuff:

I won't complain about a vendor providing source code, but it sure is a mess.

agree, those "tronxy 446 extensions" to the normal marlin codebase seem to be not following the intended structure. have been browsing through this stuff trying to make it compile but getting errors with LD not finding setup() and loop()... all seems like some linker/filestructure problem... dont have the nerve to go through this mess right now :-( if anyone of you can put that stuff straight it would be highly appreciated!

aimwaffel commented 2 years ago

anyone got something working yet? im currently rebuilding mechanics of my printer, might want to try my luck with the firmware tomorrow. would be very happy if someone got a compileable setup for me :-)

Kazwahs commented 2 years ago

Hoping to for a compileable setup soon too, thank you to everyone working on this, appreciate it.

cdedwards commented 2 years ago

that source is broken. I finally got a compile to work but its just the lib. itself. I dont know enough about platformio to see what they broke.

Kazwahs commented 2 years ago

Good job on getting the compile to work, unfortunately I'm of no help on platformio, but still wanted to offer up some accolades to you.

aimwaffel commented 2 years ago

some update: I was given another more recent firmware by tronxy themselves. This software did compile without problems. I was able to put it onto my printer and it worked without problems - just as the precompiled marlin firmware from their website. My intention was to change the original print head to an e2v hemera and the thermal probe to a k-type element with an analog signal amp. So I had to change the parameters for filament feed in the firmware, which was no problem at all. Same goes for the thermal probe, which I changed to some generic analog input probe and fiddled with the multiplier value in the firmware, until the temp reading was correct (measuring the analog output of the signal amp giving me the actual measured temp). For that to work i additionally had to do a hardware change to the controller PCB, which was to remove the pullup resistor for this analog input. Shoutout to the tronxy tech support, who provided not only the firmware sources but also the electrical schematics for the analog input circuit so i was able to identify which small SMD resistor on the PCB i had to remove. With the changes to the hot end + temperatur measurement i am able to print at 300+ °C, which was the goal after all.

cdedwards commented 2 years ago

Any chance you could upload that source somewhere. I’d like to make a few changes to there firmware that is not possible at the moment

jasonr517 commented 2 years ago

I would also like this.

Kazwahs commented 2 years ago

I would like it too please.

EvilGremlin commented 2 years ago

@aimwaffel you definitely should upload their code on github Fork marlin, make branch from tag closest to their code, then replace everything with their code.

ellensp commented 2 years ago

Ive just found https://www.tronxy.com/wp-content/uploads/2021/07/XY-3SE-Marlin.zip (I see http://www.tronxy.cn/web/userfiles/download/XY-3SE-Marlin.zip was posted before, but never worked for me) Which is not for this board/printer, but it does contain board and variant files for a TRONXY_STM32F446 board STM32F103-Marlin/Marlin/buildroot/share/PlatformIO/boards/tronxy_stm32f446ze.json and STM32F103-Marlin/Marlin/buildroot/share/PlatformIO/variants/TRONXY_STM32F446 and env:tronxy_stm32f446

but sadly stm32f4/pins_TRONXY_F446.h is missing

But it may help.

aimwaffel commented 2 years ago

Any chance you could upload that source somewhere. I’d like to make a few changes to there firmware that is not possible at the moment

I will check back with tronxy what their position regarding their firmware is... yes opensource marlin, should be no problem but still want to make sure everyone is on the same page

EvilGremlin commented 2 years ago

Nope, you don't have to ask them about such things. Their opinion in matter of publishig it is absolutely irrelevant.

aimwaffel commented 2 years ago

Nope, you don't have to ask them about such things. Their opinion in matter of publishig it is absolutely irrelevant.

so there is 2 ways how to look at my current situation.... yes your might be right just looking at legal terms, i might have all the rights to post the code they provided me in public but out of respect for them i wanted to get back to them and ask their opinion if they have problems with that. so this is what i did and their response was if i (or someone else) asks them at their mail: support@tronxy.com with machine ID and serial they will provide the firmware sources... just as they did for me. so what i will do for now: you guys try mailing them and if they do not follow their promise i will help out.

Kazwahs commented 2 years ago

I emailed them, waiting for a response now.

EvilGremlin commented 2 years ago

Ugh, this usual corporate stupidity... By license they obligated to provide code to anybody, no questions asked. You don't have to own the product to ask for GPL code. Serial only make sense in case you ask for binary, because hardware revisions. Again, they have no right to forbid you publishing the code, no matter the reason. So by doing this back-and-fourth emails you just stall people from being able to help, please don't do that.

Kazwahs commented 2 years ago

@EvilGremlin, 100% agreed, but gonna respect @aimwaffel too, so yeah playing the email game with Tronxy.

I'll post what I get when I get it.

EvilGremlin commented 2 years ago

Yeah, i realize i'm being kinda harsh, but i have experience dealing with that chinese mentality. It's always that tendency to backdoor-keep-it-private dealings. If you got any problems with purchase on Ali - you always must open dispute first, no matter what sellers say, or they often will stall things infinitely in hope to get money and 5-star rating on timeout. And with code it's often the same - yeah here it is but please don't go public... Like Creality's excuse for delayed publishing of source: yeah, we know, we know, but if we publish it we'll get immediately copied and lose advantage... Guys, you massively overestimate quality and originality of your code! Copycats simply gotta use Dave's fork to get advantage. Which is actually tested unlike crelaity fw.

Kazwahs commented 2 years ago

Heres the link fron Tronxy support, 14 days left on it. https://dashi.163.com/html/cloud-attachment-download/?key=djAyL0hQWEpweEZuNzcxTjRnNUxkMWRvUT09

ellensp commented 2 years ago

Local copy that wont vanish as quick. X5SA-2E.zip

Kazwahs commented 2 years ago

@ellensp thank you, I was in a hurry this morning and my upload speed at home is horrible