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

Fix MKS Nano V1.2 FSMC Display #18901

Merged

Conversation

rhapsodyv
Copy link
Sponsor Member

@rhapsodyv rhapsodyv commented Aug 2, 2020

Description

  • Fix compiling warnings and the FSMC display for MKS Nano v1.2
  • Add 3x upscale support for NON-DMA TFT
  • Fix the 0x8066 init code
  • Removed non supported displays that were add to nano board by mistake
  • Re-enabled DMA for FSMC_GRAPHICAL_TFT for nano v1.2

Benefits

Fix #18899

Related Issues

@thisiskeithb
Copy link
Member

thisiskeithb commented Aug 2, 2020

Per our discussion on Discord, I'm getting a half black/half white (fuzzy) screen and the board isn't usable with FSMC_GRAPHICAL_TFT:

image

Link to Tevo Nereus config with fixes from this PR.

@thisiskeithb thisiskeithb added Needs: Testing Testing is needed for this change Needs: Work More work is needed S: Don't Merge Work in progress or under discussion. C: LCD & Controllers labels Aug 2, 2020
@rhapsodyv
Copy link
Sponsor Member Author

I found the problem. FSMC_UPSCALE 3x was never implemented for a NON-DMA display, line Nano v1.2. I will work on that.

@rhapsodyv rhapsodyv marked this pull request as draft August 2, 2020 20:25
@Miraculix200
Copy link

I found the problem. FSMC_UPSCALE 3x was never implemented for a NON-DMA display, line Nano v1.2. I will work on that.

This is what I use in my currently working config (before the commits in the past few days)
#define LCD_USE_DMA_FSMC
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5

https://github.com/Miraculix200/Marlin-SapphirePro-2209-UART/blob/289425c9abb01d1fd082c85a7974b58552a8aced/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h#L198

Don't remember where I got that from.

@Miraculix200
Copy link

Ok, getting there. With LCD_RESET_PIN commented out and these lines added I get a working display. Though the touchscreen seems to freak out. It acts as if it is getting randomly touched.

#define LCD_USE_DMA_FSMC
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5

I'll try again with these changes reverted, with commit 280bded merged

@rhapsodyv
Copy link
Sponsor Member Author

Ok, getting there. With LCD_RESET_PIN commented out and these lines added I get a working display. Though the touchscreen seems to freak out. It acts as if it is getting randomly touched.

#define LCD_USE_DMA_FSMC
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5

I'll try again with these changes reverted, with commit 280bded merged

Now we found! MKS removed that DMA settings from they nano board. And the NON-DMA never was implemented for FSMC_UPSCALE 3x.
The two things together, blew up.

@Miraculix200
Copy link

I'll try again with these changes reverted, with commit 280bded merged

Reverting the DMA #defines I made doesn't produce a working display with 280bded

@thisiskeithb
Copy link
Member

The latest changes in this PR plus:

#define LCD_USE_DMA_FSMC                        // Use DMA transfers to send data to the TFT
#define FSMC_DMA_DEV                      DMA2
#define FSMC_DMA_CHANNEL               DMA_CH5 

Produces:

image

@Miraculix200
Copy link

Miraculix200 commented Aug 2, 2020

Produces:

Could be caused by LCD_RESET_PIN not being commented out?

@Miraculix200
Copy link

Miraculix200 commented Aug 2, 2020

R0038791
This is what I get with LCD_RESET_PIN defined (and the DMA defines included)

@Miraculix200
Copy link

Well.... with LCD_RESET_PIN defined I get a green display. But it works.

With LCD_RESET_PIN commented out I get a normal looking display, but the touch screen is freaking out, acting as if it is getting touched on the enter button twice per second or so. When I use the down arrow while it's in the menu screen, I can stop it for a while. But then it starts again

@Miraculix200
Copy link

Miraculix200 commented Aug 2, 2020

The green display seems to be slightly flickering. As if it was the wrong update frequency? Or maybe it's just more visible because it's green.

Also, when turning the printer on I first get a green bar above the enter button. Without any text displayed, only the touch buttons. After a while the info screen appears.

@rhapsodyv
Copy link
Sponsor Member Author

The green display seems to be slightly flickering. As if it was the wrong update frequency? Or maybe it's just more visible because it's green.

Also, when turning the printer on I first get a green bar above the enter button. Without any text displayed, only the touch buttons. After a while the info screen appears.

Do you have TFT 3.5 or 2.8/2.4?

@thisiskeithb
Copy link
Member

Do you have TFT 3.5 or 2.8/2.4?

Pretty sure the Nano 1.2 only comes with the TFT35.

@Miraculix200
Copy link

Miraculix200 commented Aug 2, 2020

Do you have TFT 3.5 or 2.8/2.4?

3.5

@Miraculix200
Copy link

I have to add that I've been using it with LCD_RESET_PIN commented out in the past months.

Maybe the touch screen freaking out with LCD_RESET_PIN commented out is not related to this display issue, but to the recent changes that have been made to touch buttons.

Copy link
Sponsor Member Author

@rhapsodyv rhapsodyv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that can be removed too.

@rhapsodyv
Copy link
Sponsor Member Author

Nano only have FSMC. LVGL and FSMC_GRAPHICAL interface.

@thinkyhead thinkyhead merged commit 04c10ed into MarlinFirmware:bugfix-2.0.x Aug 4, 2020
@neoxm3
Copy link

neoxm3 commented Aug 9, 2020

@rhapsodyv for me the latest commit is not working.,..

FLSUN Q5 with mks robin nano v1.2 + tft mks 3.5 , i have in the configuration file:

  • #define MOTHERBOARD BOARD_MKS_ROBIN_NANO
  • #define FSMC_GRAPHICAL_TFT

and this is the result (atached image)
IMG_20200809_193307

@rhapsodyv
Copy link
Sponsor Member Author

@neoxm3 are you using the last bugfix?

@neoxm3
Copy link

neoxm3 commented Aug 9, 2020

@rhapsodyv yes, downloaded today... I tryed to comment the lcd reset pin, but no difference

@rhapsodyv
Copy link
Sponsor Member Author

TFT 2.4/2.8/3.5?

If is less than 3.5, you need to set FSMC_UPSCALE 2

@rhapsodyv
Copy link
Sponsor Member Author

In fact, you need to configura all this:

  #ifndef FSMC_UPSCALE
    #define FSMC_UPSCALE                    3
  #endif
  #ifndef LCD_FULL_PIXEL_WIDTH
    #define LCD_FULL_PIXEL_WIDTH            480
  #endif
  #ifndef LCD_PIXEL_OFFSET_X
    #define LCD_PIXEL_OFFSET_X              48
  #endif
  #ifndef LCD_FULL_PIXEL_HEIGHT
    #define LCD_FULL_PIXEL_HEIGHT           320
  #endif
  #ifndef LCD_PIXEL_OFFSET_Y
    #define LCD_PIXEL_OFFSET_Y              32
  #endif

as defaults are set to 3.5 display

@neoxm3
Copy link

neoxm3 commented Aug 9, 2020

I am going to try, i didnt dismounted the lcd but now seeing it more slowly, i am not secure that this is a 3.5 tft... It is more like 3 - 2.8,, thanks for the clue!

@neoxm3
Copy link

neoxm3 commented Aug 9, 2020

omg! solved! very thanks @rhapsodyv
with this options:

#ifndef FSMC_UPSCALE
#define FSMC_UPSCALE 2
#endif
#ifndef LCD_FULL_PIXEL_WIDTH
#define LCD_FULL_PIXEL_WIDTH 320 //480
#endif
#ifndef LCD_PIXEL_OFFSET_X
#define LCD_PIXEL_OFFSET_X 48
#endif
#ifndef LCD_FULL_PIXEL_HEIGHT
#define LCD_FULL_PIXEL_HEIGHT 240 //320
#endif
#ifndef LCD_PIXEL_OFFSET_Y
#define LCD_PIXEL_OFFSET_Y 32
#endif

now, my only problem is that i have the tft inverted... :P
i can flip the screen with:
#define LCD_SCREEN_ROT_180

but the touch buttons are not flipped... :P and remains in top

@rhapsodyv
Copy link
Sponsor Member Author

You can put it direct to you Configuration.h

#define FSMC_UPSCALE 2
#define LCD_FULL_PIXEL_WIDTH 320 
#define LCD_PIXEL_OFFSET_X 48
#define LCD_FULL_PIXEL_HEIGHT 240
#define LCD_PIXEL_OFFSET_Y 32

For rotation, try:

#define GRAPHICAL_TFT_ROTATE_180

@neoxm3
Copy link

neoxm3 commented Aug 9, 2020

You can put it direct to you Configuration.h

#define FSMC_UPSCALE 2
#define LCD_FULL_PIXEL_WIDTH 320 
#define LCD_PIXEL_OFFSET_X 48
#define LCD_FULL_PIXEL_HEIGHT 240
#define LCD_PIXEL_OFFSET_Y 32

For rotation, try:

#define GRAPHICAL_TFT_ROTATE_180

#define GRAPHICAL_TFT_ROTATE_180 (only this) doesnt rotate the screen in my case.

#define LCD_SCREEN_ROT_180 yes but not the touch buttons.

thanks!

@rhapsodyv
Copy link
Sponsor Member Author

You need better XPT2046_* calibration values. Try swapping the signal from XPT2046_X_CALIBRATION and XPT2046_Y_CALIBRATION

@meteozond
Copy link

@rhapsodyv could touchscreen (not display) be mirrored with XPT2046_X_CALIBRATION settings?

Speaka pushed a commit to Speaka/Marlin that referenced this pull request Aug 13, 2020
thinkyhead pushed a commit that referenced this pull request Aug 14, 2020
albertogg pushed a commit to albertogg/Marlin that referenced this pull request Aug 31, 2020
@rhapsodyv rhapsodyv deleted the fix-nano-v1-fsmc-display branch October 25, 2020 00:29
vgadreau pushed a commit to vgadreau/Marlin that referenced this pull request Dec 9, 2020
ahmetcemturan pushed a commit to ahmetcemturan/Marlin that referenced this pull request Jan 21, 2021
ahmetcemturan added a commit to ahmetcemturan/Marlin that referenced this pull request Jan 23, 2021
kageurufu pushed a commit to CR30-Users/Marlin-CR30 that referenced this pull request Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants