Open-Smart TFT 3.2 and Adruino Due

Hi,

I would like to use this display with arduino due.

Do you have any experience with it?
Thanks.

I support OPEN-SMART shields as a SPECIAL with MCUFRIEND_kbv. But currently only Uno and Mega2560.

No one has ever asked for Due. If you want to use MCUFRIEND_kbv, please say. I will add the appropriate SPECIAL.

David.

Thank you David for the quick answer.

I just wanted to know if this display can be connected with due because the description has: Logic level: 5V / 3.3V. Due is only for 3.3V.

Yes, you can connect on a Due. I have just added USE_OPENSMART_SHIELD_PINOUT on DUE to mcufriend_special.h on GitHub

#elif defined(__SAM3X8E__) && defined(USE_OPENSMART_SHIELD_PINOUT)  //OPENSMART shield on DUE
#warning USE_OPENSMART_SHIELD_PINOUT on DUE
 // configure macros for the control pins
#define RD_PORT PIOA
#define RD_PIN  16
#define WR_PORT PIOA
#define WR_PIN  24
#define CD_PORT PIOA
#define CD_PIN  23
#define CS_PORT PIOA
#define CS_PIN  22
#define RESET_PORT PIOA
#define RESET_PIN  6
 // configure macros for data bus
#define BMASK         (1<<27)
#define CMASK         (0x12F << 21)
#define DMASK         (1<<7)
#define write_8(x)   {  PIOB->PIO_CODR = BMASK; PIOC->PIO_CODR = CMASK; PIOD->PIO_CODR = DMASK; \
                        PIOC->PIO_SODR = (((x) & (1<<0)) << 22); \
                        PIOC->PIO_SODR = (((x) & (1<<1)) << 20); \
                        PIOC->PIO_SODR = (((x) & (1<<2)) << 27); \
                        PIOD->PIO_SODR = (((x) & (1<<3)) << 4); \
                        PIOC->PIO_SODR = (((x) & (1<<4)) << 22); \
                        PIOB->PIO_SODR = (((x) & (1<<5)) << 22); \
                        PIOC->PIO_SODR = (((x) & (1<<6)) << 18); \
                        PIOC->PIO_SODR = (((x) & (1<<7)) << 16); \
					 }

#define read_8()      ( ((PIOC->PIO_PDSR & (1<<22)) >> 22)\
                      | ((PIOC->PIO_PDSR & (1<<21)) >> 20)\
                      | ((PIOC->PIO_PDSR & (1<<29)) >> 27)\
                      | ((PIOD->PIO_PDSR & (1<<7))  >> 4)\
                      | ((PIOC->PIO_PDSR & (1<<26)) >> 22)\
                      | ((PIOB->PIO_PDSR & (1<<27)) >> 22)\
                      | ((PIOC->PIO_PDSR & (1<<24)) >> 18)\
                      | ((PIOC->PIO_PDSR & (1<<23)) >> 16)\
                      )
#define setWriteDir() { PIOB->PIO_OER = BMASK; PIOC->PIO_OER = CMASK; PIOD->PIO_OER = DMASK; }
#define setReadDir()  { \
                          PMC->PMC_PCER0 = (1 << ID_PIOB)|(1 << ID_PIOC)|(1 << ID_PIOD);\
						  PIOB->PIO_ODR = BMASK; PIOC->PIO_ODR = CMASK; PIOD->PIO_ODR = DMASK;\
						}
#define write8(x)     { write_8(x); WR_ACTIVE; WR_STROBE; }
//#define write8(x)     { write_8(x); WR_ACTIVE; WR_STROBE; WR_IDLE; }
#define write16(x)    { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst)   { RD_STROBE; RD_ACTIVE; dst = read_8(); RD_IDLE; RD_IDLE; }
#define READ_16(dst)  { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); }
 // Shield Control macros.
#define PIN_LOW(port, pin)    (port)->PIO_CODR = (1<<(pin))
#define PIN_HIGH(port, pin)   (port)->PIO_SODR = (1<<(pin))
#define PIN_OUTPUT(port, pin) (port)->PIO_OER = (1<<(pin))

Untested. If anyone has an OPENSMART shield they can try it on a Due.

Your 3.2" shield says that it has HX8352-B. I only support HX8352-A
Do you have the HX8352-B ? Would you be willing to test it ?

David.

I have put a test_8352B Branch on GitHub for you. If you are a GitHub member you can switch Branch.

If you install via Library manager, you must leave IDE, delete current library folder. Download the test_8352B Branch as a ZIP. Install from ZIP.

The test_8352B Branch is already configured for SPECIAL USE_OPENSMART_SHIELD

Obviously completely Untested. Please report back.

David.

David thank you.

I'm going to order the display.
When I will have a display, then I test it.
I'll let you know the test results.

Zdeno

So you do not have the display on your desk !!

Please let me know how/if it works when it arrives.

David.

The display will arrive in 3-5 weeks.
Of course, I will let you know.

Zdeno

I have an Open-Smart TFT 3.2 HX8352B only for 3.3V.
Arduino UNO R3 logic level is only for 5V.
Tell me which PINs you need to reconcile.
I can test your library. Throw off on E-mail

If you have a genuine HX8352-B the driver is in the current Master Branch i.e. v2.9.8-Beta
You have to enable the SUPPORT_8358B in the MCUFRIEND_kbv.cpp ID=0x0065

Please post a photo or link to your HX8352-B pcb
If it is on a standard Uno Shield it should work out of the box
If it is just a 3.3V breakout, make sure that you use Zero, Due, STM32, ... which have 3.3V GPIO.
Wire like a standard Uno Shield.

If it has special wiring you should check the SPECIALs already published.
Your photo will enable me to advise.

I found this breakout with Google.

All the pins are clearly labelled. Connect to a Zero, Due, ... as if it was a Uno shield e.g
DB0 to digital#8, DB1 to digital#9, DB2 to digital#2 ...
LCD_RD to analog#0, WR to analog#1, ...
3.3V to 3.3V, ...

It is a mystery why anyone would pay good money for a breakout when the pcb has footprints for the normal Open-Smart electronics and Uno Shield pins.
Or you could buy this bundle and get started immediately.

David.

https://drive.google.com/file/d/1zJVJTqHcxPldEQkUO9z75Y61T8MKB_2_/view?usp=sharing

https://drive.google.com/file/d/1PGEbmi8MuEbxfGWDmuQmVaBwGpvS7krA/view?usp=sharing

https://drive.google.com/file/d/1DJ9euD5xpaJZysgvHEpKcqvYsiHz60Xc/view?usp=sharing

https://drive.google.com/file/d/1lSoMpp1EFkjHAAC6CoEDE4ViiqCAT_ru/view?usp=sharing

You have the regular Shield. It plugs straight into Uno or Mega2560.
You can either configure the current Beta (Master Branch)
Or use the test_8352B Branch that is already configured for the Open-Smart wiring.

What is the solder-bridge labelled 3.3V ?
Check the schematic. It looks like P4 to me. And the open solder-bridge labelled D3 looks like P3. So your backlight is permanently on i.e. with P4.

David.

When using the library MCUFRIEND_kbv-test_8352B the port monitor gave out:

diagnose_TFT_support
{
Diagnose whether this controller is supported
There are FAQs in extras/mcufriend_how_to.txt

tft.readID() finds: ID = 0x41

This ID is not supported
look up ID in extras/mcufriend_how_to.txt
you may need to edit MCUFRIEND_kbv.cpp
to enable support for this ID
e.g. #define SUPPORT_8347D

New controllers appear on Ebay often
If your ID is not supported
run LCD_ID_readreg.ino from examples/
Copy-Paste the output from the Serial Terminal
to a message in Displays topic on Arduino Forum
or to Issues on GitHub

}

diagnose_Touchpins
{
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 37
Testing : (A2, D6) = 25
Diagnosing as:-
YP,YM: (A1, D7) = 37
XM,XP: (A2, D6) = 25
}

testcard_kbv
{Serial took 0ms to start
ID = 0x41
}

LCD_ID_readreg
{Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 40 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 44 44 44 44 Manufacturer ID
reg(0x0009) 48 48 48 48 48 Status Register
reg(0x000A) 48 1B Get Power Mode
reg(0x000C) 1F 0C Get Pixel Format
reg(0x0061) 20 20 RDID1 HX8347-G
reg(0x0062) 20 20 RDID2 HX8347-G
reg(0x0063) 20 20 RDID3 HX8347-G
reg(0x0064) 24 24 RDID1 HX8347-A
reg(0x0065) 24 24 RDID2 HX8347-A
reg(0x0066) 24 24 RDID3 HX8347-A
reg(0x0067) 24 24 RDID Himax HX8347-A
reg(0x0070) 20 20 Panel Himax HX8347-A
reg(0x00A1) 20 20 20 20 20 RD_DDB SSD1963
reg(0x00B0) 20 20 RGB Interface Signal Control
reg(0x00B4) 24 24 Inversion Control
reg(0x00B6) 24 24 24 24 24 Display Control
reg(0x00B7) 24 24 Entry Mode Set
reg(0x00BF) 2C 2C 2C 2C 2C 2C ILI9481, HX8357-B
reg(0x00C0) 00 03 03 03 03 03 03 03 03 Panel Control
reg(0x00C8) 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B GAMMA
reg(0x00CC) 0F 0F Panel Control
reg(0x00D0) 03 13 13 Power Control
reg(0x00D2) 13 00 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00D4) 04 17 17 17 Novatek ID
reg(0x00DA) 1B 08 RDID1
reg(0x00DB) 08 08 RDID2
reg(0x00DC) 0C 1F RDID3
reg(0x00E0) 33 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 GAMMA-P
reg(0x00E1) 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 GAMMA-N
reg(0x00EF) 2C 2C 2C 2C 2C 2C ILI9327
reg(0x00F2) 20 61 61 61 61 61 61 61 61 61 61 61 Adjust Control 2
reg(0x00F6) 65 24 24 24 Interface Control
}

Touch_shield_kbv
{Found unknown LCD driver
ID=0x41
Screen is 0x320
Calibration is:
LEFT = 920 RT = 150
TOP = 940 BOT = 120
Wiring is: PORTRAIT
YP=15 XM=16
YM=7 XP=6
}

TouchScreen_Calibr_native
{TouchScreen.h GFX Calibration
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 36
Testing : (A2, D6) = 25
Diagnosing as:-
YP,YM: (A1, D7) = 36
XM,XP: (A2, D6) = 25
ID = 0x41
}

TouchScreen_Calibr_new
{TouchScreen.h Calibration
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 36
Testing : (A2, D6) = 25
Diagnosing as:-
YP,YM: (A1, D7) = 36
XM,XP: (A2, D6) = 25
}

PS: backlight (D3 - TFT) is permanently on. Connected to PD3 (UNO)

Thanks for the report. I created the test_8352B Branch completely blind. I rely on User feedback.

I would expect the ID to be recognised as 0x0065 and not 0x0041. Perhaps I have bit#5 and bit#2 wrong.

Did you edit the defines in the LCD_ID_readreg sketch to match the Open-Smart pinout?
It says reg(0x0000) is 0x0040 and not the 0x0041 that the library found.

Open-Smart provide software. (actually they have just hacked a very OLD version of my library)
Do their examples work?

I presume that you have deleted their hacked library?
Otherwise the IDE will not know which "MCUFRIEND_kbv" to use.

Please ediit the defines and run the LCD_ID_readreg sketch for me.

David.

Hi Everyone,

I have the exact same TFT LCD shield and I tested it with the code in the branch on both UNO and MEGA but it does not seem to work too (I only have flickering variations of whites during the tests).

Mine also has an 0x0041 ID but I have 0x0012 (and sometimes 0x0000) in reg(0x0000). I checked the pin mapping in readreg and it seems OK. I also tried to map pins RD, WR… to A0-A4 instead of 0-4 in mcufriend_special.h but without any result.

Here is my readreg output if this can help. To be honest I don’t have a clue of where this 0x41 ID comes from…

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 12 ID: ILI9320, ILI9325, ILI9335, …
reg(0x0004) 16 16 16 16 Manufacturer ID
reg(0x0009) 1A 0B 0B 0B 0B Status Register
reg(0x000A) 0B 08 Get Power Mode
reg(0x000C) 0C 0C Get Pixel Format
reg(0x0040) 00 00 RDID1 HX8347-G
reg(0x0061) 20 20 RDID1 HX8347-G
reg(0x0062) 20 20 RDID2 HX8347-G
reg(0x0063) 20 20 RDID3 HX8347-G
reg(0x0064) 24 24 RDID1 HX8347-A
reg(0x0065) 24 24 RDID2 HX8347-A
reg(0x0066) 24 24 RDID3 HX8347-A
reg(0x0067) 24 24 RDID Himax HX8347-A
reg(0x0070) 20 20 Panel Himax HX8347-A
reg(0x00A1) 20 20 20 20 20 RD_DDB SSD1963
reg(0x00B0) 20 20 RGB Interface Signal Control
reg(0x00B4) 24 24 Inversion Control
reg(0x00B6) 24 24 24 24 24 Display Control
reg(0x00B7) 24 24 Entry Mode Set
reg(0x00BF) 2C 2C 2C 2C 2C 2C ILI9481, HX8357-B
reg(0x00C0) 00 03 03 03 03 03 03 03 03 Panel Control
reg(0x00C8) 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B GAMMA
reg(0x00CC) 0F 0F Panel Control
reg(0x00D0) 03 11 11 Power Control
reg(0x00D2) 11 00 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00D4) 04 15 15 15 Novatek ID
reg(0x00DA) 19 08 RDID1
reg(0x00DB) 08 08 RDID2
reg(0x00DC) 0C 1D RDID3
reg(0x00E0) 31 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 GAMMA-P
reg(0x00E1) 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 GAMMA-N
reg(0x00EF) 2C 2C 2C 2C 2C 2C ILI9327
reg(0x00F2) 20 61 61 61 61 61 61 61 61 61 61 61 Adjust Control 2
reg(0x00F6) 65 24 24 24 Interface Control
reg(0x00FE) 2C 2C 2C 2C —

You would edit the LCD_ID_readreg defines for Open-Smart:

//-- Arduino UNO or Mega 2560 Plugged as OPEN_SMART shield 
#define LCD_RST A4  //unused
#define LCD_CS A3
#define LCD_RS A2
#define LCD_WR A1
#define LCD_RD A0

#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 10 //2
#define LCD_D3 11 //3
#define LCD_D4 4
#define LCD_D5 13 //5
#define LCD_D6 6
#define LCD_D7 7

I would expect consistent results. The pcb does not have access to the LCD_RST for program control. You would only get that if you connect as a breakout. However, you should be able to read the registers even if there has not been a hardware Reset.

The readreg sketch should work on any Arduino. It does not even use any libraries.

David.

After the replacement with
//-- Arduino UNO or Mega 2560 Plugged as OPEN_SMART shield
#define LCD_RST A4 //unused
#define LCD_CS A3
#define LCD_RS A2
#define LCD_WR A1
#define LCD_RD A0

#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 10 //2
#define LCD_D3 11 //3
#define LCD_D4 4
#define LCD_D5 13 //5
#define LCD_D6 6
#define LCD_D7 7


Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 65 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 65 00 00 00 Manufacturer ID
reg(0x0009) 00 8F 8F 8F 8F Status Register
reg(0x000A) 8F 00 Get Power Mode
reg(0x000C) 00 01 Get Pixel Format
reg(0x0061) 01 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 04 RDID2 HX8347-A
reg(0x0066) 04 00 RDID3 HX8347-A
reg(0x0067) 00 20 RDID Himax HX8347-A
reg(0x0070) 20 00 Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 00 Inversion Control
reg(0x00B6) 00 00 00 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00 Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 00 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 GAMMA-P
reg(0x00E1) 03 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 GAMMA-N
reg(0x00EF) 08 48 48 48 48 48 ILI9327
reg(0x00F2) 48 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

Here with these libraries from dx.com everything works

libraries.zip (1010 KB)

Thanks for running LCD_ID_readreg with the OPEN-SMART defines. This verifies reg(0) is 0x0065.

Yes, your "libraries.zip" should work. It is an obsolete version of my library hacked by Open Smart.

I would like to support your HX8352-B like I already support the other Open-Smart boards.

  1. leave the IDE
  2. delete the hacked MCUFRIEND_kbv directory from your libraries folder.
  3. switch to test_8352B Branch on GitHub.
  4. download the ZIP
  5. start the IDE.
  6. install library from ZIP with the Library Manager
  7. run graphictest_kbv example
  8. what ID is reported by the Serial Terminal?
  9. force tft.begin(0x0065) in graphictest_kbv sketch. Run.
  10. run the diagnose_TFT sketch.
  11. copy-paste the Serial output to your message.

If you are already a GitHub member and have cloned the library, you can switch Branches at will.
Life is easier than messing with ZIPs.

I do not own any Open-Smart boards. Open-Smart have never asked before hacking my library (without changing the name of the class).
I rely on feedback from owners. I appreciate your time and effort.

David.

graphictest_kbv
{Serial took 0ms to start
ID = 0x65
}
When you download sketch, the IDE reports:
In file included from C:\Users…\Documents\Arduino\libraries\MCUFRIEND_kbv-test_8352B\MCUFRIEND_kbv.cpp:32:0:

C:\Users…\Documents\Arduino\libraries\MCUFRIEND_kbv-test_8352B\utility/mcufriend_shield.h:5:2: warning: #warning WE ARE USING A SPECIAL CUSTOM DRIVER [-Wcpp]

#warning WE ARE USING A SPECIAL CUSTOM DRIVER

^

Скетч использует 26516 байт (82%) памяти устройства. Всего доступно 32256 байт.
Глобальные переменные используют 1581 байт (77%) динамической памяти, оставляя 467 байт для локальных переменных. Максимум: 2048 байт.
Недостаточно памяти, программа может работать нестабильно.

diagnose_TFT_support
{Diagnose whether this controller is supported
There are FAQs in extras/mcufriend_how_to.txt

tft.readID() finds: ID = 0x65

PORTRAIT is 240 x 400

Run the examples/graphictest_kbv sketch
All colours, text, directions, rotations, scrolls
should work. If there is a problem, make notes on paper
Post accurate description of problem to Forum
Or post a link to a video (or photos)

I rely on good information from remote users
}
When you download sketch, the IDE reports:
In file included from C:\Users…\Documents\Arduino\libraries\MCUFRIEND_kbv-test_8352B\MCUFRIEND_kbv.cpp:32:0:

C:\Users…\Documents\Arduino\libraries\MCUFRIEND_kbv-test_8352B\utility/mcufriend_shield.h:5:2: warning: #warning WE ARE USING A SPECIAL CUSTOM DRIVER [-Wcpp]

#warning WE ARE USING A SPECIAL CUSTOM DRIVER

^

Скетч использует 15614 байт (48%) памяти устройства. Всего доступно 32256 байт.
Глобальные переменные используют 1550 байт (75%) динамической памяти, оставляя 498 байт для локальных переменных. Максимум: 2048 байт.
Недостаточно памяти, программа может работать нестабильно.


The following appears on the display: