Rumba with MKS LCD12864A display

Good day to all forumites!

I thought I'll post this for everybody's reference since I spent quite some time getting it to work. Hopefully, someone would find this helpful. 

I've got a standard Rumba board (not the Rumba+) and got one of these cheap LCD displays that apparently work fine with a RAMPS setup. 

The Rumba board I got from Aliexpress: https://www.aliexpress.com/item/32674728859.html?spm=a2g0s.9042311.0.0.49d74c4dLDFUOf

The LCD display I got locally and I can't find any other reference to it on the web. This is the one: https://www.robotics.org.za/MKS-LCD12864A?search=MKS

You'll see a jumper on the back of the LCD that says 1768 SGEN_L on the one side and 2560 on the other. I had mine set on 2560.

To make sure the LCD does work with the Rumba board I wrote this small test app:

#include <U8glib.h>
const byte lcdSCK = 52;
const byte lcdMOSI = 51;
const byte lcdCS = 38;
const byte lcdA0 = 41;
// U8GLIB_MINI12864 u8g (lcdSCK, lcdMOSI, lcdCS, lcdA0, U8G_PIN_NONE);
// U8GLIB_MINI12864_2X u8g (lcdSCK, lcdMOSI, lcdCS, lcdA0, U8G_PIN_NONE);
U8GLIB_MINI12864_2X u8g (lcdCS, lcdA0, U8G_PIN_NONE);
void setup() {
  u8g.setColorIndex (1);
}
void draw (void) {
  u8g.setFont (u8g_font_6x12);
  u8g.drawStr (0, 22, "Howzit World!");
}
void loop() {
  u8g.firstPage ();
  do {
    draw ();
  } while (u8g.nextPage ());
  delay (500);
}

This code works like expected and prints "Howzit World!" on the display. Note that all three functions worked correctly (U8GLIB_MINI12864, U8GLIB_MINI12864_2X(5 params) and U8GLIB_MINI12864_2X(3 params). 

When I tried to get this to work with Repetier-Firmware, only the 3 params function would work. The option U8GLIB_MINI12864_2X_SW_SPI I could not get to work, only the backlight will start. So it seems that in Repetier only the hardware SPI version of the call would work (U8GLIB_MINI12864_2X_HW_SPI).

Anyway, to get this to work I did the following:

1) In the Configuration.h, make sure the correct motherboard is selected:
#define MOTHERBOARD 80
2) Still, in the Configuration.h, make sure the featured controller is 11 (RepRapDiscount Full Graphic Smart Controller 128x64, RAMPS, Rumba, Megatronics 2 & RAMBO):
#define FEATURE_CONTROLLER 11
3) In the DisplayList.h comment out U8GLIB_ST7920 and add U8GLIB_MINI12864_2X_HW_SPI:
 ...
//#define U8GLIB_ST7920
#define U8GLIB_MINI12864_2X_HW_SPI ...
4) Still, in the DisplayList.h, go down to MOTHERBOARD == 80 and add the two defines called UI_DISPLAY_RRA_CS and UI_DISPLAY_RRA_A0 like so:
#elif MOTHERBOARD == 80 // Rumba has different pins as RAMPS!
... ...
#define UI_DISPLAY_D4_PIN      18
#define UI_DISPLAY_D5_PIN      38
#define UI_DISPLAY_D6_PIN      41
#define UI_DISPLAY_D7_PIN      40 ... ...
#define UI_DISPLAY_RRA_CS      UI_DISPLAY_D5_PIN
#define UI_DISPLAY_RRA_A0      UI_DISPLAY_D6_PIN
5) Now open the ui.cpp and find initializeLCD(), and just a few lines below that U8GLIB_MINI12864_2X_HW_SPI. Change the u8g_InitHWSPI function like so:
void initializeLCD() {
... ...
#ifdef U8GLIB_MINI12864_2X_HW_SPI
    u8g_InitHWSPI(&u8g, &u8g_dev_uc1701_mini12864_2x_hw_spi, UI_DISPLAY_RRA_CS, UI_DISPLAY_RRA_A0, U8G_PIN_NONE);
#endif
6) Edit the contrast for the display in u8glib_ex.h. Find the u8g_dev_uc1701_mini12864_init_seq function and in there edit the contrast value from 0x027 to 0x034 like so:
static const uint8_t u8g_dev_uc1701_mini12864_init_seq[] PROGMEM = {
 ...
 ...
  0x081,    /* set contrast */
  0x034,    /* This was 0x027 -- contrast value */
  0x0ac,    /* indicator */
... ... 
I hope this helps someone that had issues to get this up and running.
Sign In or Register to comment.