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 LCD12864A/B and MKS MINI 12864 display on MKS Robin E3/E3D and MKS SGEN_L motherboard #19269

Closed
wants to merge 9 commits into from

Conversation

mks-viva
Copy link
Contributor

@mks-viva mks-viva commented Sep 5, 2020

Requirements

Fix MKS LCD12864 display on MKS Robin E3/E3D and MKS SGEN_L motherboard

Description

  #if ENABLED(MKS_LCD12864) || ENABLED(MKS_MINI_12864)
    #if ENABLED(SDSUPPORT)
      SETUP_RUN(card.mount());          // Mount media with settings before first_load
    #endif
  #else
    #if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
      SETUP_RUN(card.mount());          // Mount media with settings before first_load
    #endif
  #endif

@makerbase-mks
Copy link
Contributor

MKS has test it and display is OK!

@sjasonsmith
Copy link
Contributor

Why do these displays require this change, when no others LCDs to this?

@rhapsodyv
Copy link
Member

rhapsodyv commented Sep 5, 2020

If I understood it right, the fix is to force mount the card before the first load even if SDCARD_EEPROM_EMULATION is not active (the only reason that it was mounted before), when using MKS_LCD12864 or MKS_MINI_12864.

MKS SGEN_L is LPC. SD is on SPI 2 and LCD is on SPI 1. The current LPC code will force Software SPI (it only forces sw spi if the spi is shared)
MKS Robin E3/E3D are STM32F1. SD and those LCD share SPI 2.

The only things that comes to my head to explain that needed card pre-init is: wrong/missing the right calls to spiInit/spiBegin... or wrong/missing CS pin logic...

For example: Could be missing a simple "write(SS_PIN, HIGH)" in the initialisation, to force deactivate the SD CS and LCD CS... when doing the lcd communication, if the CS pin of the SD is LOW, so it send the commands o SD and not to LCD... or generate unexpected behaviour if both are selected... Then mounting the SD before, it put the pins to the right state after run, and the LCD could run fine...

Or a missing spi setup somewhere the lcd code... that is fixed when sd mount, as its does a spi full setup...

Something like this...

@thisiskeithb
Copy link
Member

thisiskeithb commented Sep 5, 2020

Great! I can confirm that both the LCD12864B and MKS Mini 12864 display work correctly on the Robin E3 & SGEN-L motherboards (though, I think you meant Gen-L and the MKS LCD12864A which I can't test).

the fix is to force mount the card before the first load even if SDCARD_EEPROM_EMULATION is not active

That would explain why the LCD no longer worked after changing the default EEPROM emulation to FLASH_EEPROM_EMULATION. I hadn't connected the two before.

@sjasonsmith
Copy link
Contributor

If I understood it right, the fix is to force mount the card before the first load even if SDCARD_EEPROM_EMULATION is not active (the only reason that it was mounted before), when using MKS_LCD12864 or MKS_MINI_12864.

I didn't have to do this for them to work on an SKR Pro or GTR when I was working with them the other day. I wonder why these would be different.

@thisiskeithb
Copy link
Member

Closing in favor of #19271 since @rhapsodyv identified (and fixed) the real issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants