SAMSUNG S6D04H0X controller, NEED HELP

Ive bought a 2.4 inch TFT display and turns out it has a SAMSUNG S6D04H0X controller. The problem is I cant find a easy to use library fot it. All I have is this sketch wich works with the display, but I don`t know hot to use it to write some text on the display .Other libraries have easy commands like LCD_print() or something like that

Can someone please help me??

_9341uno.ino (7.64 KB)

Hi catalin123m, I have the exact same problem. Bought my display from banggood.com and saw that in the comments section people were using the Adafruit libraries but when I got my screen and started testing it the libraries did not function correctly. I sent them an email and they told me that now this screen had the Samsung controller and sent me a similar file.

Your file is missing some stuff in the loop. I am not sure if you deleted it before posting it here or not so I am just going to post the code in the loop function from my file to show something on the screen.

Here it is:

int p;
  for(int i=0;i<1000;i++)
  {
    Rect(random(300),random(300),random(300),random(300),random(65535)); // rectangle at x, y, with, hight, color
    /*LCD_Clear(0xf800);
    delay(1000);
    LCD_Clear(0x07E0);
    delay(1000);
    LCD_Clear(0x001F);
    delay(1000);
    LCD_Clear(0xffff);
    delay(1000);*/
  } 
//  LCD_Clear(0xf800);

The LCD_Clear function is incredibly slow. It takes something like 5-10 seconds to clear the whole screen.

Anyways, I have the exact same problem as catalin123m and hope there is some help out there.

Cheers!

I also bought this display from banggood and you are right I deleted the loop, but not intentionally. I tried something out and it did not worked

One of the main reasons why I bought it was because people were saying how easy they had managed to set it up and get it working with the Adafruit library in the comments section on banggood.com.

Now they have changed the controller :/

I have an Instructable here that has a library for the Samsung S6D02A1. I have looked at the data sheet for the S6D04H0X and the commands look identical, so the library for the S6D02A1 should work, it is called Adafruit_QDTech_AS

You will need to change the following two lines in the Adafruit_QDTech_AS.h file found inside the library folder to the correct display resolution (if needed):

define QDTech_TFTWIDTH 128

define QDTech_TFTHEIGHT 160

e.g. I do not know the resolution of your display, maybe:

define QDTech_TFTWIDTH 240

define QDTech_TFTHEIGHT 320

Let me know how you get on!

Nice. Yes. The display is 240x320 pixels.

Do you think we will need to change the connection pins in your library? This display we are using is a shield that goes on top of the Arduino Uno and the pin arrangement is impossible to change physically.

EDIT: BTW, here is the datasheet straight from banggood.com customer service: Controller datasheet

Change the connection pins in the sketch.

I hope the shield uses the hardware SPI pins otherwise display updates will be slow.

Find these definitions in the sketch:

#define sclk 13 // Don’t change
#define mosi 11 // Don’t change
#define cs 9
#define dc 8
#define rst 7 // you can also connect this to the Arduino reset

You can change pins 7, 8 and 9 to match your board

11 and 13 are the hardware SPI pins so are fixed

If the display uses different pins for sclk and mosi get back to me.

I am not sure if it uses SPI. Here is a quote from the webpage: "8 bit digital interface, plus 4 control lines Uses digital pins 5-13 and analog 0-3. That means you can use digital pins 2, 3 and analog 4 and 5. Pin 12 is available if not using the micro SD"

Since it uses so many pins then I doubt it is using SPI.

Ah!

All is not lost but I need to know what the pin connections are, or a link to the display details.

Is it the 2.4" TFT LCD Shield here?

Yes, I believe so. But I bought it together with an Arduino. This one: Arduino + TFT shield They seem to be the same.

Try the attached library and example in the library.

I have a similar board that claimed to have the Spfd5408 controller but actually has a ILI9341 compatible controller so I put this library together from the work of others.

Let me know if it works.

The 8 bit interface is not going to be as fast as SPI due to the way 8 data bits have been split across two microcontroller ports but you should find the performance reasonable with this library.

Currently size 1 text will not plot as the lower level GFX library assumes SPI but at least we will find out if we have the correct driver initialisation code!

TFT_Shield.zip (423 KB)

Wow! You are amazing! :)

It works. Here is the serial output with the benchmarks:

TFT LCD test
TFT size is 240x320
Benchmark                Time (microseconds)
Screen fill              1322060
Text                     379704
Lines                    3895628
Horiz/Vert Lines         135860
Rectangles (outline)     98160
Rectangles (filled)      3068100
Circles (filled)         1153564
Circles (outline)        1697108
Triangles (outline)      1236720
Triangles (filled)       1483228
Rounded rects (outline)  572648
Rounded rects (filled)   3567336
Done!

This is MUCH better than the code that we got from banggood.com. Filling the screen with one color took 10 seconds. With this library it takes around 250ms.

I am sure catalin123m will be very happy when he sees his thread next time :)

Not sure if I should dare ask but have you made any code that reads bitmaps from the SD card and displays the bitmap on the screen? :D

Thanks again.

Great, come back and check in a couple of days and I will have finished the library adaptions and will point you to where you can get the updated libraries.

Yes to the SD Card images. I created an Instructable recently to do just this but adaptions may be needed before you can use the sketch. I will test on my display now we know we have the same display driver.

OMG!!! it works :D:D:D A big thanx from the bottom of our hearts. I hope simmisj won`t mind I included him in this Thank You note :stuck_out_tongue:

Again all the health and fortune in the world for rowboteer :d

Two happy people, what greater reward could I ask for :slight_smile:

Some things will not work as I hacked the driver library together quickly and the libraries are not fully compatible at the moment due to legacy SPI code.

Come back in a couple of days for a link to an updated fully operational library set.

catalin123m, no problem. I am as happy as you are :)

rowboteer, I will be waiting patiently. Again, many thanks.

I have GOT to learn how to put together libraries like this.

Thank you so much for preparing the library.

I received the same screen from banggood.com a few days ago. I was really looking for just another arduino but for a few bucks extra, I thought the LCD would be a fun toy...

After a few hours trying various libraries (and making a lot of mistakes), I was able to get this screen working by forcing the Adafruit library to use 0x9341 identifier, but the colors are all off (e.g. black is white but white is red and red is blue). I am assuming this is due to the library and not the screen itself.

The pins on mine were soldered really badly. I imagine the person who did it was chasing after a bus while balancing a cup of hot coffee and soldering the pins with the other hand...that's how bad they were...I redid the pins and I hope the color issue is not due to connections...

I'll give the current hack a try tonight.

Okay, so I'm still getting incorrect colors. I see that it's setting the LCD identifier as 0x9341. @rowboteer, have you made any changes to the Adafruit library?

I did however notice a pattern in the colors, so after a quick investigation I found that I have to define the colors as

#define BLACK   0xFFFF - 0x0000
#define BLUE    0xFFFF - 0x001F
#define RED     0xFFFF - 0xF800
#define GREEN   0xFFFF - 0x07E0
#define CYAN    0xFFFF - 0x07FF
#define MAGENTA 0xFFFF - 0xF81F
#define YELLOW  0xFFFF - 0xFFE0
#define WHITE   0xFFFF - 0xFFFF

@simmisj and @catalin123m, are you seeing the correct color with roboteer's library?

To try, simply put

tft.fillScreen(BLACK); in loop() and then try the other colors.

Thanks

rpakdel: I'm still getting incorrect colors

OK, you have what is called colour inversion.

There are quite a few registers in the TFT controller that set a lot of things to do with the colours. During initialisation these registers have to be set to sensible values otherwise nothing will be displayed at all, or things will look odd even though the display is fully functional! The good news is that when you get anything at all displayed you are well on the way to figuring out which controller is built into the TFT screen.

Different controllers allocate different register addresses and bits to the different colour control parameters, it looks like your board is not getting initialised properly or the relevant bit is not getting to the controller due to a solder joint problem - lets assume it is not a solder joint problem for now as it is easy to make things worse...

In colour inversion, all bits in the 16 bit colour value are flipped by the TFT controller, hence the result you obtained. You have corrected this by flipping all bits in your colour definitions! Normally there is a function called invertDisplay(boolean i) that you could use to correct it but I have not sub-classed that one in the library!

Another control bit sets the colour ordering in the 16 bit pixel value it can be set to R-G-B or B-R-G !

I will be able to update the library this evening (UK time) but right now I have to: fix a fence, clear branches off the lawn and get a new refrigerators (otherwise the beer will get warm) :-)

The cheap "Arduino" products from China lack quality control and hence newbies should start with products from vendors that provide tech support, though these seem expensive there are good commercial justifications for this! It all depends what people value... viz time wasted or money saved!

I recently bought 10 ESP8266 boards from China for a project, 4 of them had 4.7 Ohm (4R7) resistors fitted in series with the power indicator LED instead of 4K7, a simple manufacturing error... by someone who needs to go to Specsavers. The LED conveniently got so hot it melted the solder and I pushed it off the board with a cocktail stick! The LED was still glowing dimmly as I pushed it off the board - probably because it was so hot rather than from the normal light emission mechanism! I figured out the problem and checked the other boards! The vendor gave me a full refund for all boards just for pointing out the error despite the fact that I said I had them ALL working after fixing them... so I now have 10 working boards for free (assuming 1 hour of my time is "free")! In summary I have absolutely no complaints about Chinese vendors but... I do pick sellers carefully based on the quality of the information they provide rather than go for the lowest price.

Beer is getting warm in the fridge and the wife wants me to go get a new one!

TTFN