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.35k 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

jasonr517 commented 2 years ago

so i get it to compile all the way to the end then get an error:

Archiving .pio\build\tronxy_stm32f446\lib1cb\libWire.a Linking .pio\build\tronxy_stm32f446\firmware.elf c:/users/scott/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: Marlin/Tronxy\libTronxy.a(Tronxy.cpp.o): in function EXTI1_IRQHandler': F:\YSZ\work\3Marlin-2.0.9.2/Marlin\Tronxy/Tronxy.cpp:496: multiple definition ofEXTI1_IRQHandler'; .pio/build/tronxy_stm32f446/SrcWrapper/src/stm32/interrupt.cpp.o:C:\Users\Scott.platformio\packages\framework-arduinoststm32\libraries\SrcWrapper\src\stm32/interrupt.cpp:339: first defined here

Is anyone else having this issue?

EvilGremlin commented 2 years ago

Marlin-2.0.9.2 Using this is pointless, try with fresh bufgix 2.1

ellensp commented 2 years ago

Issue is with Marlin/Tronxy a library in here, no source.

@EvilGremlin this has been highly customized, cannot use stock marlin. That is why this is here, waiting for some one to port it

thisiskeithb commented 2 years ago

Marlin-2.0.9.2 Using this is pointless, try with fresh bufgix 2.1

@EvilGremlin: See https://github.com/MarlinFirmware/Marlin/issues/23761#issuecomment-1183264218

This is the source code provided the vendor and will need to be ported to a newer version.

ellensp commented 2 years ago

you can butcher .platformio/packages/framework-arduinoststm32/libraries/SrcWrapper/src/stm32/interrupt.cpp

find

/**
  * @brief This function handles external line 1 interrupt request.
  * @param  None
  * @retval None
  */
void EXTI1_IRQHandler(void)
{
  HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
}

change it to

/**
  * @brief This function handles external line 1 interrupt request.
  * @param  None
  * @retval None
  */
/**
void EXTI1_IRQHandler(void)
{
  HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
}
*/

This will compile... cant test it beyond that

EvilGremlin commented 2 years ago

I mean F446 don't throw such error in vanilla marlin. Of course changes need to be ported. For starts - easy mode without FSMC.

jasonr517 commented 2 years ago

I tried to copy the boards.h, pins.h from the tronxy to vanilla marlin and got an error where it wouldnt recognize the new enviroment, but its over my head lol.

Darth-Kuni commented 2 years ago

here is Tronxy latest marlin they say its for the VEHO 600 but it looks like its for all if someone can get the f446 working in vanilla marlin please let me know this crap wont Evan work with octoprint https://drive.google.com/file/d/1nsQXs2d6fvkILCa064XXZ7pKlgU7IdhZ/view?usp=sharing

remote110 commented 2 years ago

here is Tronxy latest marlin they say its for the VEHO 600 but it looks like its for all if someone can get the f446 working in vanilla marlin please let me know this crap wont Evan work with octoprint https://drive.google.com/file/d/1nsQXs2d6fvkILCa064XXZ7pKlgU7IdhZ/view?usp=sharing

Were you able to get that to compile?

Darth-Kuni commented 2 years ago

No I cannot get that to compile and they are being very difficult they don't want me to change the firmware

I don't understand why they won't just add they're bored to marlin and use marlin instead of trying to reinvent the wheel

remote110 commented 2 years ago

They just sent me an updated version of what was already on it. At least they sent you Marlin. Mine does work with octoprint even though they say it doesn't. I don't understand either. You would think they would want to make customers happy.

Darth-Kuni commented 2 years ago

I can print with octoprint but when it does the filament runout it just ends the print octoprint does not know that it is run out of filament

remote110 commented 2 years ago

I haven't tried that feature. Do you have the plugin installed for that feature?

Darth-Kuni commented 2 years ago

I have multiple printers using the same octoprint settings and it works on all the others

When I asked them about it they said it's not compatible with online printing

remote110 commented 2 years ago

Gotcha. My Tronxy is the only one I have with runout detection on it.

Darth-Kuni commented 2 years ago

It needs host action commands enable and it should work we can't compile our own firmware and they won't help I cannot turn it on yet

kliberty commented 2 years ago

Which printer are you building for? I have a working build setup for my X5SA Pro based on the sources they provided a couple months ago.

remote110 commented 2 years ago

Which printer are you building for? I have a working build setup for my X5SA Pro based on the sources they provided a couple months ago.

The X5SA Pro with the F446 Board is what I'm trying to build.

kliberty commented 2 years ago

The X5SA Pro with the F446 Board is what I'm trying to build.

Great! I'll upload the files and some instructions when I get home tonight.

remote110 commented 2 years ago

The X5SA Pro with the F446 Board is what I'm trying to build.

Great! I'll upload the files and some instructions when I get home tonight.

That would be really awesome of you! Thanks

Darth-Kuni commented 2 years ago

I am building for the VEHO 600 it also uses the f44 6 board

Kazwahs commented 2 years ago

I'm building for an x5sa 2e with a f446 board

cdedwards commented 2 years ago

install klipper and be done with tronxy.

remote110 commented 2 years ago

Sure, take the easy way out. lol Maybe I don't have a raspberry pi or a spare pc or any of the million other devices that will run klipper just laying around.

ellensp commented 2 years ago

@cdedwards This is Marlin... suggesting that someone use Klipper is not helpful and not wanted. Please stop with such non helpful comments.

remote110 commented 2 years ago

here is Tronxy latest marlin they say its for the VEHO 600 but it looks like its for all if someone can get the f446 working in vanilla marlin please let me know this crap wont Evan work with octoprint https://drive.google.com/file/d/1nsQXs2d6fvkILCa064XXZ7pKlgU7IdhZ/view?usp=sharing

I've spent the day trying to make what they sent you compile with no luck. I can get it all the way to the "elf" file before it fails. Greater minds than mine will have to solve this.

ellensp commented 2 years ago

I have added basic tronxy v10 board support to Marlin bugfix 2.1.x on my github https://github.com/ellensp/Marlin/tree/tronxy-v10

It compiles and builds, but I cannot test this as I don't have the hardware

Can someone give this a test?

Important this is MOTHERBOARD support ONLY! Do not expect to drop this on a working machine and expect the display to work!

define MOTHERBOARD BOARD_TRONXY_V10

define SERIAL_PORT 1

remote110 commented 2 years ago

I have added basic tronxy v10 board support to Marlin bugfix 2.1.x on my github https://github.com/ellensp/Marlin/tree/tronxy-v10

It compiles and builds, but I cannot test this as I don't have the hardware

Can someone give this a test?

Important this is MOTHERBOARD support ONLY! Do not expect to drop this on a working machine and expect the display to work!

I have a print going at the moment so it will be tomorrow before I can put it on the machine. It does compile fine. Did you have to make a lot of changes? Edit: I almost forgot to say thank you. So, Thank you so much for helping this along.

ellensp commented 2 years ago

@remoete110 all files added/changed to marlin are listed here https://github.com/MarlinFirmware/Marlin/compare/bugfix-2.1.x...ellensp:Marlin:tronxy-v10

a few changes from what tronxy supplied, mostly in ini/stm32f4.ini and some cosmetic renames to follow marlin naming conventions.

Darth-Kuni commented 2 years ago

Thank you I spent the last week trying to figure out what they had screwed up to make it not work then I pulled everything out that I could find to do with the board and put it in 2.1.1 but I have had no luck

So again thank you for your hard work

remote110 commented 2 years ago

I've got the bed size adjusted to match my machine. Now to figure out how to enable the bed heater. Figured I could do something while I wait for this print to finish.

kliberty commented 2 years ago

I've uploaded to my changes to https://github.com/kliberty/Marlin-2.0.9.2-Tronxy-X5SA

  1. I needed to include libTronxy.a and liby_lib.a that I found in another zip from Tronxy.
  2. The changes mentioned in this comment are also required. EXTI1_IRQHandler is provided by one of the .a archives.
  3. Tronxy builds on Windows (case insensitive), but I am building in a Linux Docker container. This required a fix to an include path. I don't remember if my updated .vscode files are required, or were only to provide code-completion.
  4. The other changes I made are personal customizations, but you should be able to start with the commit link from bullet 3 and then add the binary archives from this commit.
  5. The .bin file can be loaded using the SD card upgrade process.
ellensp commented 2 years ago

@remote110 my provided config is just motherboard and serial port. minimal required to compile.

To enable heated bed

define TEMP_SENSOR_BED 1

remote110 commented 2 years ago

Wow! That was fast. If this print wasn't for my grandkids I would cancel it. lol

Darth-Kuni commented 2 years ago

Is there some special technique to flash this bored I will give it a try as soon as I get home

remote110 commented 2 years ago

You should be able to just put it on the root of your sd card and turn the machine on. The factory file comes in a folder named "update" so you may need to create that folder and put the file in it if the first method doesn't work.

ellensp commented 2 years ago

Edited: where did this V10 name come from? just wondering if its the best name to give it... It not written on the controller as far as I can make out from internet pictures It is written on the pcb silkscreen. Just needed a clearer picture to see it eg https://i0.wp.com/bangshaboodle.com/wp-content/uploads/2022/04/29665-l6hdk6.jpg

Darth-Kuni commented 2 years ago

i keep getting this Marlin\src\HAL\shared../../inc/../core/serial.h: In function 'void SERIAL_ECHO(T)':
Marlin\src\HAL\shared../../inc/../core/serial.h:61:26: error: 'MYSERIAL1' was not declared in this scope; did you mean 'MSERIAL'? 61 | #define _SERIAL_LEAF_1 MYSERIAL1

ellensp commented 2 years ago

@Darth-Kuni you cannot use serial port 0 on stm32 based controllers

change #define SERIAL_PORT 0 to 1 for eg

the error "SERIAL_PORT must be from 1 to 6." is displayed...

Darth-Kuni commented 2 years ago

Thank you

Darth-Kuni commented 2 years ago

ok i have a .bin with no lcd lol it would not let me add one i tryed the #define TFT_TRONXY_X5SA but i get this Marlin\src\HAL\STM32\tft\tft_fsmc.h:90:69: error: 'GPIO_AF12_FSMC' was not declared in this scope; did you mean 'GPIO_AF12_FMC'?

its no prob i can use octoprint i hope

ellensp commented 2 years ago

As far as I can ascertain the stm32f446ze does not support FSMC https://www.st.com/resource/en/datasheet/stm32f446ze.pdf
But its not an area im that familiar with Apparently it has FMC which according to what I read FMC = FSMC + SDRAM controller, but this doesn't help me...

ellensp commented 2 years ago

As far as I can tell hardware FMC requires FMC_A0, but this pin is used by marlin

pin name    func            Marlin
10  PF0 FMC_A0      X_ENABLE_PIN

But I am not an expert on FMC Never ever used this before

remote110 commented 2 years ago

Just out of curiosity. Is there a screen that would work? I have a couple screens laying around. lol

Darth-Kuni commented 2 years ago

As far as I can tell that should be the definition for the screen I have...#define TFT_TRONXY_X5SA I will have to dig into their code to see how they got it to work

kliberty commented 2 years ago

As far as I can tell that should be the definition for the screen I have...#define TFT_TRONXY_X5SA I will have to dig into their code to see how they got it to work

Do you have the source code for the Tronxy UI/screen?

Darth-Kuni commented 2 years ago

I am hoping it is in that firmware file they gave me I posted a link to it further up in the conversation

remote110 commented 2 years ago

I got "eeprom disabled" warning when I tried the bin file I compiled last night. There's a lot different in the config.h from the veho 600 files concerning the TFT. Dunno if that helps anyone. Also, here is the link to the file they sent me. There might be something useful in it. https://drive.google.com/file/d/1YOiw6vxtX1DVo4YqlqmGW4j5ro6PTKFP/view?usp=sharing

ellensp commented 2 years ago

Original code has build_flags = -DTRONXY_UI=2 -DLCD_CHIP_INDEX=2

Which means that this is not enabled in Configuration
// // 480x272, 4.3", FSMC Display From MKS //

if !TRONXY_UI && LCD_CHIP_INDEX == 2

define MKS_ROBIN_TFT43

endif

And neither is this // // 480x320, 3.5", FSMC Stock Display from TronxXY //

if !TRONXY_UI && LCD_CHIP_INDEX == 1

define TFT_TRONXY_X5SA

endif

The lcd is instead being driven with the code in the y_lib directory

remote110 commented 2 years ago

Original code has build_flags = -DTRONXY_UI=2 -DLCD_CHIP_INDEX=2

Which means that this is not enabled in Configuration // // 480x272, 4.3", FSMC Display From MKS // #if !TRONXY_UI && LCD_CHIP_INDEX == 2 #define MKS_ROBIN_TFT43 #endif

And neither is this // // 480x320, 3.5", FSMC Stock Display from TronxXY // #if !TRONXY_UI && LCD_CHIP_INDEX == 1 #define TFT_TRONXY_X5SA #endif

The lcd is instead being driven with the code in the y_lib directory

So, I should be able to make those changes and copy the y_lib directory over and bobs your uncle? lol I'm really a hardware guy with just enough knowledge to be dangerous. Sorry if my questions are too basic.