bigtreetech / BIGTREETECH-TouchScreenFirmware

support TFT35 V1.0/V1.1/V1.2/V2.0/V3.0, TFT28, TFT24 V1.1, TFT43, TFT50, TFT70
GNU General Public License v3.0
1.28k stars 1.64k forks source link

[FR] New Artillery not flashing LCD on GD32F305 #2391

Closed Help3D-Padova closed 5 months ago

Help3D-Padova commented 2 years ago

Description

There some Artillery Genius PRO or X2 that are not able to flash the LCD firmware.

Steps to reproduce

Try to flash as usual

Actual behavior

MKSTFT28.bin is not detected and the flash is not able to start

Hardware Variant

It seems that the new microcontroller is based on GD32F305 - VERIFIED

TFT Firmware Version & Main Board Firmware details

The bootloader is V3.0.4

Additional Information

https://github.com/artillery3d/genius-pro-tft-firmware this firmware can be flashed without issue

@digant73 i'm not able to reproduce this issue because i have an older lcd but i have some user that can try some beta firmware.

Dave811 commented 1 year ago

I tired both (@ciotto , @Fourmi ) of your repos (first flashed with original to test that my SD-Card is working, and after that I used your repos to compile it), but both dont work on my end :/

ciotto commented 1 year ago

@Dave811 you used mkstft28evo.bin as filename?

Dave811 commented 1 year ago

@ciotto yes I used that name, and also in all uppercase, just in case. But both dont work.

Fourmi commented 1 year ago

@Dave811 , yes, compile is ok ,but upload don't load with SDcard it is this point that should be seen and which blocks me to advance a little more

ciotto commented 1 year ago

Finally I was able to update the TFT firmware with the one compiled by @Fourmi (I have a video), but in the end, nothing worked.

The trick is to use the original firmware as a base, replacing the mkstft28evo.bin and adding other BIGTREETECH firmware files, so we have:

The procedure requested me to do e touchscreen calibration, but I can't do anything. I suppose that the pin mapping is wrong.

Screenshot_20230125_110238_2

After restarting, the screen shows the BIGTREETECH logo but nothing else.

Now I re-flashed the original firmware and all works fine.

I think that it's a great result, now we can fix the firmware.

I'll update you ASAP with more details and some images.

digant73 commented 1 year ago

@ciotto, @Fourmi after the first successfull installation, try to simply re-install only the BTT files:

Verify if the installation is performed or not. If installation is performed as expected (you see on screen the binary, font, icons and config.ini update process) and touch screen during calibration process is not working, you must start from reviewing the following pins mapping in pin_MKS_TFT28_X2.h:

// XPT2046 Software SPI pins for touch screen
// It needs CS/SCK/MISO/MOSI for Software SPI and TPEN for pen interrupt
#define XPT2046_CS   PC9
#define XPT2046_SCK  PC10
#define XPT2046_MISO PC11
#define XPT2046_MOSI PC12
#define XPT2046_TPEN PC5

This mapping is currently matching the one used on the X1 board (based on old STM chip). Possibly in the X2 board they have been changed.

ziirish commented 1 year ago

@Fourmi can you provide a bit of details on how you compiled the firmware? I tried to compile it based on your repo but I'm encountering the following error:

$ pio run
Processing MKS_TFT28_X2 (board: GD32F305VC_0X3000; platform: https://github.com/CommunityGD32Cores/platform-gd32.git; framework: spl)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Error: Unknown board ID 'GD32F305VC_0X3000'

Thanks

ciotto commented 1 year ago

I want to try to do some changes but after the first installation, the process never reaches the end.

The first time, the process was this:

Now the update stop after Complete screen, I don't know why.

Does someone else have the same problem?

I'll do more test.

nomc2 commented 1 year ago

Finally I was able to update the TFT firmware with the one compiled by @Fourmi (I have a video), but in the end, nothing worked.

The trick is to use the original firmware as a base, replacing the mkstft28evo.bin and adding other BIGTREETECH firmware files, so we have:

The procedure requested me to do e touchscreen calibration, but I can't do anything. I suppose that the pin mapping is wrong.

Screenshot_20230125_110238_2

After restarting, the screen shows the BIGTREETECH logo but nothing else.

Now I re-flashed the original firmware and all works fine.

I think that it's a great result, now we can fix the firmware.

I'll update you ASAP with more details and some images.

Did not work for me on my X2, I get stuck at a black screen that says complete and the TFT never reboots. Are you sure you just replaced the mkstft28evo.bin file and not something else as well?

ciotto commented 1 year ago

I'm pretty sure, but now I have the same problem, so probably something else is different... 😩

ciotto commented 1 year ago

One more update.

I tryed the procedure using the MKS_TFT28_V4.0.27.x.bin file and doesn't stop after the "Completed" screen, but this is what I see.

IMG_20230127_194311~2.jpg

As usual, after I can flash the original firmware.

ciotto commented 1 year ago

I'm trying a new approach. Starting from the STM32 version of the firmware, I have a "working" firmware that shows the BTT logo:

IMG_20230128_094056~2

Starting from this, I want to try some debugging.

If you want to try, here is available the "working" firmware with all the file and folder needed for uploading.

FabulosoDev commented 1 year ago

I have a "working" firmware that shows the BTT logo

Promising progress you made 👍. Could you please describe what 'working' means in that context? Is it the regular STM firmware you were able to compile for the GD32 MCU? Thanks for your reply.

ciotto commented 1 year ago

As I said, "working" means that it "shows the BTT logo", literally 🙂.

This version was essentially built using STM32 libraries, after flashing show the logo screen with the Card inserted and Card removed! strings (as you can see in my previous post).

After working on it for a day, now I reached the same result with a version built using the GB32 libraries.

This version has some screen glitches and is slower, I don't know why (yet). Fixed

In any case, for both versions the problem that stop the execution on boot screen is this loop on ModeSwitching.c:

while (OS_GetTimeMs() - startUpTime < BTT_BOOTSCREEN_TIME)  // display logo BTT_BOOTSCREEN_TIME ms
{
  loopProcess();
}

The loop never ends due to the fact that OS_GetTimeMs() is always 0. Probably it's related to the timer interrupt call.

Ricky1966 commented 1 year ago

@ciotto I need to write to you but the message was returned to your site's email address. Could you write me?

ciotto commented 1 year ago

@Ricky1966 I fixed the issue with my email and now you can write me.

Ricky1966 commented 1 year ago

@ciotto If you think problem nested in the interrupt OS_GetTimeMs(), have you try to replace this value with a fixed as 1000 (1 second)?

MirakelPrints commented 1 year ago

@Ricky1966 Sadly this is not a fixed time. Its a counter incremented on interrupt. See os_timer.c#L76

ciotto commented 1 year ago

Exactly, as @MirakelPrints said the counter it's incremented every millisecond on interrupt and on this depends every time-related task.

Moreover, interrupt manage many other things like, UART and I2C communication, buzzer, etc.

MirakelPrints commented 1 year ago

@ciotto have you tried to skip showing boot screen by commenting #define SHOW_BTT_BOOTSCREEN ? maybe there is an issue in that early stage of bootup

Ricky1966 commented 1 year ago

Maybe this you have seen yet, but https://www.gigadevice.com/manual/gd32f307xxxx-user-manual/ Could be helping?

Ricky1966 commented 1 year ago

This link could help? https://www.google.com/url?sa=t&source=web&rct=j&url=https://github.com/ivaniacono/GD32-RISCV-Example/blob/master/GD32VF103_Firmware_Library/GD32VF103_standard_peripheral/Include/gd32vf103_rcu.h&ved=2ahUKEwi2ycSo45z9AhXIsaQKHdmQB3cQFnoECA8QAQ&usg=AOvVaw3kHXWT9gXjdzJFNmwywWrA

gagipro commented 1 year ago

@ciotto have you tried to skip showing boot screen by commenting #define SHOW_BTT_BOOTSCREEN ? maybe there is an issue in that early stage of bootup

tried it and it's locked @V3.0.4 screen 20230217_194530

gagipro commented 1 year ago

Yes it's strange that it does calibration first time but not other flash afterwards

ETE-Design commented 1 year ago

Yes it's strange that it does calibration first time but not other flash afterwards

Have you tried to add reset.txt to the sd-card??

gagipro commented 1 year ago

Yes it's strange that it does calibration first time but not other flash afterwards

Have you tried to add reset.txt to the sd-card??

No I Can try tomorrow but WE are probably missing some pins mappings like explained in previous posts...

Or some clock adaptations, I have no clue at all but if someone Can have a look at source code I Can also try to compile and test.

gagipro commented 1 year ago

didn't change anything, I reflashed original and everything's back to normal ... at least we can try as many times as we need to

gagipro commented 1 year ago

ok I rechecked everything and it seems I am not able to recompile properly like the binary firmware from @Fourmi I must miss something Fourmi's binary is copying properly all bmps but if I recompile one myself it doesn't do the same.

Ricky1966 commented 1 year ago

@gagipro If you explicate me all passage to recompile I also could try to help you. Say me what I must search (and where) and I look to help all community to find "The Force"! 🤣 Maybe with GD32F305 Datasheet and STM32, comparing, could be jumping out which are the differences

gagipro commented 1 year ago

@gagipro If you explicate me all passage to recompile I also could try to help you. Say me what I must search (and where) and I look to help all community to find "The Force"! 🤣 Maybe with GD32F305 Datasheet and STM32, comparing, could be jumping out which are the differences

Fourmi knows how to recompile, i did recompile but my binary doesn't work like fourmi's one

Ricky1966 commented 1 year ago

@Fourmi If I could be helping?

gagipro commented 1 year ago

@Ricky1966 I tried to flash with the folder available in @ciotto repository : I have same results as Ciotto when I try to compile with @Fourmi repo (target MKS_TFT28_X2 in platformio.ini) or @ciotto repo (target BIGTREE_TFT35_V3_0 in platformio.ini) : the resulting flash directory behave like this : update never reboots and doesn't copy bmp files. the only thing that do work is the @ciotto directory : https://github.com/ciotto/BIGTREETECH-TouchScreenFirmware

gagipro commented 1 year ago

@Ricky1966 to recompile : you git clone any repo (fourmi ciotto or bigtree), you install platformio extension in vscode and you just click on build it will result in a firmware bin available in .pio/build/targetboard specified in plateformio.ini default_envs line

gagipro commented 1 year ago

@Ricky1966 git clone -b MKS-GD-TFT28-release https://github.com/ciotto/BIGTREETECH-TouchScreenFirmware.git -> to get the good branch

Ricky1966 commented 1 year ago

@gagipro Thanks a lot!

gagipro commented 1 year ago

pffffiou finaly I managed to compile and have same behavior as @ciotto

and now I have this screen dudes ! bootok

of course it's unresponsive : we are probably missing pin mapping.

gagipro commented 1 year ago

@MirakelPrints I did what you suggested : commented bootlogo 👍 //#define SHOW_BTT_BOOTSCREEN

gagipro commented 1 year ago

noprinter

gagipro commented 1 year ago

reset.txt allows to recalibrate BUT : no mapping so no luck reset

Julian4Cats commented 1 year ago

okay sorry to be that guy, but when i try and compile the source firmware for the genius pro i too get the error 1 message. Is there a fix available already? cuz i have been searching my ass off and still no results. i just need to enable host commands for octoprint lol

gagipro commented 1 year ago

I'm a (un)fortunated owner of an Artillery Genius Pro with GD32F305VC TFT screen.

I tried to do some tests and the reason why the original firmware update starts without issue is the name of the file.

In fact, if you try to update without the mkstft28evo.bin file, introduced by this commit, nothing happens, precisely like the update with this custom firmware.

This means that the update start only using the mkstft28evo.bin filename, but trying without more information can brick my LCD, so it's only a suppose.

The previous version of the board used an STM32F401RC MCU.

GD32F305VC

STM32F401RC and GD32F305VC are very similar MCUs, in fact both are Arm® Cortex®-M4 32-bit MCU, but somethings is different:

Check Features STM32F401RC GD32F305VC [x] MCU type M4 M4 [ ] Frequency 84 MHz 120 MHz [ ] Flash memory 256 KB 1024 KB [ ] SRAM 64 KB 96 KB Also, seems that the pinout is more or less the same:

Pinout

So I can suppose that the board is more or less the same.

The good news is that the GD32F305VC is more powerful, the bad news is that probably requires a different compiled binary.

I'm not an expert, but probably I can try to add a new configuration to Platformio for MKS TFT28 Evo.

I think it's the 100pins package and not the 64 one, an exact pin to pin replacement.

Ricky1966 commented 1 year ago

@gagipro 14 STM PA0 GD PD0- WKUP. Maybe this pin is different? For GD is a Wakeup pin when chip gone sleep? As @ciotto said, seems a problem of interrupts plotted on different pins. I downloaded from GD site a pdf with all type of chips, today a will do the same for STM. So I will look if there are differences of interrupts and what is the right corresponding from GD and STM. Which is the right model of STM32 to search?

Ricky1966 commented 1 year ago

I know you have this uet, but if not Stm

Ricky1966 commented 1 year ago

Amd this Gd

gagipro commented 1 year ago

For me its those chips : image png 7a366a1faa0bbf59089c8068fbed9ae4 image png 6a1ef9f0db21003e15cf83780b4535ad

gagipro commented 1 year ago

20230219_094703

gagipro commented 1 year ago

But @ciotto said there is also

211381540-b043c8a8-2802-43c4-a5a5-24f22b17fa57 (1)

Which is a 64 pins package

Me I compared with the v1.0 version of the board and not the 1.2 stm version vs 1.2 gd version

gagipro commented 1 year ago

Screenshot_20230219_013727_AliExpress 20230218_231450

gagipro commented 1 year ago

I have difficulties to know what variant to use.

gagipro commented 1 year ago

ok understood the picture at begining of the thread is from the motherboard Ruby which is not good !!! it's stm32f107 vs gd32F305 and not a STM32F401 !!! anyway it doesn't change much the issue