Go Down

Topic: UTFT library with R61581 and 3.6" TFT 400x270 (Read 124 times) previous topic - next topic

George Matthews

Feb 21, 2015, 06:26 pm Last Edit: Feb 21, 2015, 08:34 pm by George Matthews
Empty as prior draft was posted as well as latest draft that follows.

George Matthews

I recently purchased a 400x270 3.6" TFT display shield for Mega2560.
It uses a R61581 driver chip. Be aware that others have found different driver chips installed.

After reading many threads, and trying many settings, it became obvious that the UTFT library was not setup for this board. The screen was mirror inverted, and flickered horribly.
I have managed to get the display to work properly... except it is not bright enough.
The hardware brightness using PWM is not used on this display shield.

When I upload new code to my mega2560, the white screen presented during reset is about four times brighter. This leads me to believe there is something not right with the UTFT  myGLCD.clrScr(); and or the RGB layers added to a base brightness value.

Anyone have similar experience?


I found a data sheet for the R61581 here, and used it to modify the r61581/initlcd.h file.
This link to Dropbox is the modified UTF Library.

Code: [Select]

// UTFT_Demo

// This demo was made for modules with a screen resolution
// of 400x270 pixels.
//
// This program requires the attached UTFT library.
//


#include <Arduino.h>
#include <Streaming.h>   // Serial.print alternative

#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
// extern uint8_t LargeFont[];
// extern uint8_t hallfetica_normal[];

// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------

// Arduino Mega:
// -------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Mega      : <display model>,38,39,40,41
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(R61581,38,39,40,41);

//Don't need these
#define DISABLE_HX8347A
#define DISABLE_HX8352A
#define DISABLE_ILI9327
#define DISABLE_SSD1289
#define DISABLE_ILI9325C
#define DISABLE_ILI9325D
#define DISABLE_ILI9325D_ALT
#define DISABLE_HX8340B_8
#define DISABLE_HX8340B_S
#define DISABLE_ST7735
#define DISABLE_ST7735_ALT
#define DISABLE_S1D19122
#define DISABLE_PCF8833
#define DISABLE_SSD1963_480
#define DISABLE_SSD1963_800
#define DISABLE_SSD1963_800_ALT
#define DISABLE_S6D1121
#define DISABLE_ILI9481
#define DISABLE_S6D0164
#define DISABLE_ST7735S
#define DISABLE_ILI9341_S4P
#define DISABLE_ILI9341_S5P
#define DISABLE_ILI9486
#define DISABLE_CPLD
#define DISABLE_HX8353C

void setup()
{
  randomSeed(analogRead(0));
  
    Serial.begin(115200);
    
// Setup the LCD
  myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);

  //Serial <<  R61581_ALT << endl;
  //Serial <<  myGLCD.getDisplayXSize() << endl;
  //Serial <<  myGLCD.getDisplayYSize() << endl;
 // Serial <<  myGLCD.getxFerMode() << endl;
 
 // Clear the screen and draw the frame

  
//  myGLCD.lcdOff();
//  myGLCD.setBrightness(255);
//  myGLCD.lcdOn();
      
myGLCD.clrScr();
myGLCD.setColor(255,0,0);
myGLCD.fillRect(0,0,399,269);
  
  
  myGLCD.setBackColor(VGA_RED);
  myGLCD.setColor(VGA_WHITE);
  myGLCD.print("1234567890123456789012345", LEFT, 224);
 
}

void loop()
{
  // Do nothing
}


avr_fred

#2
Feb 22, 2015, 08:53 pm Last Edit: Feb 22, 2015, 08:59 pm by avr_fred Reason: added link
What leads you to believe is is 400x270?  I'd bet it is anything but.

400x240 or 480x320 are the two different resolutions that board has appeared in. The R61581 version is typically 480x320 and can usually be identified by counting the resistor sip packs on the back of the board - IIRC it has 8 10k sips. The 400x240 has an ili9327 chip with 6 each 10k resistor sip packages on the back of the board.

The 480x320 display is setup with a 16 bit data path, the 400x240 is 8 bit which explains why the 480x320 board needs two extra resistor packs as there are 4 resistors per pack, all in series with the data lines. In either case UTFT will need mods to work correctly with the boards. I have a modified version of UTFT that works with the 400x240 board, you can find a copy on a previous thread about these boards. http://forum.arduino.cc/index.php?topic=282144.msg1982590#msg1982590

George Matthews

My board has 7 10k packs in a row and two others off to the side.
The seller says it is 400x270, but I now know from drawing rectangles it is definitely 400x240.

I definitely have the R61581 chip and 16 bit. It is the only init that would work at all.
I initially tried your modified UTFT but as I said it is not a ILI93278.

My remaining problem is a very dim display.

rdinallo

Also bought the same board lately. I tested with some libraries available on the internet, however I did not succeed with any of them.

George Matthews

rdinallo  Did you try the library I linked to in my second message?

rdinallo

I tried, however also did not work. The screen is all white.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy