Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

3.5" TFT 320x480 seams to be in Black and White
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

3.5" TFT 320x480 seams to be in Black and White

by Raybakk on Fri Aug 28, 2020 1:58 pm

I purcased this TFT display from Adafruit:
https://www.adafruit.com/product/2050
And I try to use the examplefiles on Github:
https://github.com/adafruit/Adafruit_HX8357_Library
Together with the HX8357-D00/D01 data sheet
On my Nucleo board from ST. (NUCLEO -F030R8).

I try to simply fill parts of the screen with blue, green and red colors, just to se if the display (my code) work as expected.
But the colors I get is in different greyscales instead...

I am not an expert in how to use code ment for Arduino on other microcontrollers, and therefor I tried to make my own "lower level functions".
I am sending uint16_t data/commands to the display using SPI...

I think I have the hardware set up right, and I beliefe I have made the functions right (fingers crossed), so what I am unsure of is if I am sending the right data to the display.

Anyone have a clue on what might be wrong?

The initialization data I am sending is basically this (from the file Adafruit_HX8357.cpp, from line 250...):
initd[] = {
HX8357_SWRESET,
0x80 + 100 / 5, // Soft reset, then delay 10 ms
HX8357D_SETC,
3,
0xFF,
0x83,
0x57,
0xFF,
0x80 + 500 / 5, // No command, just delay 300 ms
HX8357_SETRGB,
4,
0x80,
0x00,
0x06,
0x06, // 0x80 enables SDO pin (0x00 disables)
HX8357D_SETCOM,
1,
0x25, // -1.52V
HX8357_SETOSC,
1,
0x68, // Normal mode 70Hz, Idle mode 55 Hz
HX8357_SETPANEL,
1,
0x05, // BGR, Gate direction swapped
HX8357_SETPWR1,
6,
0x00, // Not deep standby
0x15, // BT
0x1C, // VSPR
0x1C, // VSNR
0x83, // AP
0xAA, // FS
HX8357D_SETSTBA,
6,
0x50, // OPON normal
0x50, // OPON idle
0x01, // STBA
0x3C, // STBA
0x1E, // STBA
0x08, // GEN
HX8357D_SETCYC,
7,
0x02, // NW 0x02
0x40, // RTN
0x00, // DIV
0x2A, // DUM
0x2A, // DUM
0x0D, // GDON
0x78, // GDOFF
HX8357D_SETGAMMA,
34,
0x02,
0x0A,
0x11,
0x1d,
0x23,
0x35,
0x41,
0x4b,
0x4b,
0x42,
0x3A,
0x27,
0x1B,
0x08,
0x09,
0x03,
0x02,
0x0A,
0x11,
0x1d,
0x23,
0x35,
0x41,
0x4b,
0x4b,
0x42,
0x3A,
0x27,
0x1B,
0x08,
0x09,
0x03,
0x00,
0x01,
HX8357_COLMOD,
1,
0x55, // 16 bit
HX8357_MADCTL,
1,
0xC0,
HX8357_TEON,
1,
0x00, // TW off
HX8357_TEARLINE,
2,
0x00,
0x02,
HX8357_SLPOUT,
0x80 + 150 / 5, // Exit Sleep, then delay 150 ms
HX8357_DISPON,
0x80 + 50 / 5, // Main screen turn on, delay 50 ms
0, // END OF COMMAND LIST
};

With my functions (example):
RBtft.sendOneCommand(HX8357_SWRESET, 0, 0);
RBtft.Wait(50); // must wait at least 5 ms before display is reset.

uint16_t ui16SETEXTC_PARAM[3] = {0xFF, 0x83, 0x57};
RBtft.sendCommand(HX8357D_SETC, ui16SETEXTC_PARAM, 3);
RBtft.Wait(300);

....

The color test look like this:
RBtft.sendOneCommand(HX8357_RAMWR, HX8357_BLUE, 193600);
RBtft.sendOneCommand(HX8357_RAMWR, HX8357_GREEN, 90200);
RBtft.sendOneCommand(HX8357_RAMWR, HX8357_RED, 30200);

Note: I have not used CASET and PASET command to define the area of color.

Raybakk
 
Posts: 4
Joined: Tue Aug 11, 2020 5:51 pm

Re: 3.5" TFT 320x480 seams to be in Black and White

by Raybakk on Wed Sep 02, 2020 3:59 am

Solved (finally) :-)

The Himax datasheet refers to 16 bits command and parameter data in the command set. Where bits D15-8 was refered as "-", which I interpreted as "don't care (will not be read anyway)".
This made me belief that I could use 16 bit. However when I changed to 8 bit command and data it works.

So "-" does not mean "don't care", it means "not in use/don't use"...

Raybakk
 
Posts: 4
Joined: Tue Aug 11, 2020 5:51 pm

Please be positive and constructive with your questions and comments.