Git Product home page Git Product logo

mcufriend_kbv's People

Contributors

luzso avatar prenticedavid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcufriend_kbv's Issues

How to move data pins from interrup pins 2 and 3

Hi,

All these shields use digital interrupt pins 2 and 3 as part of data pins. Moving these pins to (e.g. 9 and 10) that are often used by SD card would free up interrupt fields for use with e.g. encoders.

I can physically rewire this shield and UNO board but I will have to change this code to properly use new 9 and 10 pins instead of 2 and 3 and this is the problem.

I have looked through the code and there is no definition for data pins that can be easily changed. I suspect that good starting point for code change is in mcufrined_shiled.sh line 25 but it is too complex to update without spending several hours first understanding complex byte shifting that is happening there.

Can somebody confirm that I am on right track before I do this or let me know better way of doing it ? I promise that I will publish all my work here.

Thanks!

LCD ID 1325 Not Supported

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

tft.readID() finds: ID = 0x1325

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

=========================================================
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) 13 25 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 00 00 Get Power Mode
reg(0x000C) 00 00 Get Pixel Format
reg(0x0061) 00 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 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 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 10 00 Power Control
reg(0x00D2) 06 00 06 00 06 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

I can supply a sample board if needed for troubleshooting

Teensy 3.6

Hello David,
I am trying to use MCUFRIEND_kbv with a teensy 3.6. I am using a 2.4" TFT LCD Shield connected as follows:
2.4" 8-Bit TFT LCD ILI9341 Display

LCD Teensy3.6


LCD_DB0 8
LCD_DB1 9
LCD_DB2 2
LCD_DB3 3
LCD_DB4 4
LCD_DB5 5
LCD_DB6 6
LCD_DB7 7

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RST A4

#include <SPI.h>
#include "Adafruit_GFX.h"
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

The error I get is #error MCU unsupported. Is there an updated library that will support the Teensy 3.6?
Thank you,
Victor

TFT.readID() Returns 0x0, white screen on display.

Hi,
I bought two MCUfriend displays the other day, one works fine with your library, but the other only shows a white screen. As mentioned in the title the ID is supposedly 0x0. I had a replacement arrive today from the seller and it is having the exact same problem. The PCB of the issue LCDs is different from the working LCD and both issue LCDs had a sticker reading "8340" on the back. I have tried forcing every ID I have come across (Don't have a list, so would be happy to try any recommended ones.) According to the seller the driver chip is a "7781".

I have tried several libraries and solutions found on forums to no avail. I am not really sure what to try next. I would appreciate if you could take a look at the register read below, and maybe point me in the right direction.

The Following is my result from running the readreg sketch. It is identical for both modules except for reg(0x0067) which reads 92 92 on the other issue module.

reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) DB DB DB DB DB Status Register
reg(0x000A) 00 00 Get Power Mode
reg(0x000C) 00 00 Get Pixel Format
reg(0x0061) 06 06 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) D9 D9 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 49 49 RDID3 HX8347-A
reg(0x0067) 93 93 RDID Himax HX8347-A
reg(0x0070) 28 28 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

backnotworking
white_screen

Thanks,
Daniel.

FeatureRequest: Fallback mode for "unknown" boards/cpu types.

One of the best things I did for the openGLCD library was to have a fallback mode for unknown environments.
This kicks in whenever the code is being built for an environment that does not have custom i/o routines or a custom pin configuration.
In fallback mode the standard digitalRead()/digitalWrite() functions are used.
In many cases it still actually performed quite well since other processors don't have the overhead like the AVR core code implementation. This would be particularly true on the ESP and pic32 based boards.

In openGLCD I had many different custom i/o routines/macros and for AVR I used my AVRIO code which allows doing raw port i/o but looks like the digitalRead()/digitalWrite() functions but also has extensions to do multi bit i/o. The AVRIO code allows pin configuration using defines and optimizes the i/o at compile time down to the best (minimum number of cycles i/o) that can be done for the given processor and Arduino variant. It will do byte, nibble or individual pin single cycle i/o or any combination depending on what is possible.

But the main thing is to have a fallback where the user can configure the pins for their needs.
openGLCD had configuration defines in a config file that configured top level library stuff including the ability to force fallback mode and then had pin configuration files for individual boards.
It was pretty elaborate.
The openGLCD repository is here if you want to have a look: https://bitbucket.org/bperrybap/openglcd/src

STROBE_16BIT delays only for SAM3X8E

I'm sorry if this isn't the proper way to deal with the issue but I still can't get my head around GITHUB. Since I resolved the problem by editing code outside the mcufriend_special.h file I thought it might be worth reporting.

After two days of cracking the library I managed to get it working on Teensy 3.6 in 16bit mode on SSD1963 (800x480) by adding the necessary section in the mcufriend_special.h. I couldn't get above 96MHz and was playing with the read and write delays and signal analysis on oscilloscope (short cables and signals looked good). The graphictest_kbv draws lines and other elements but there seems to be garbage left after each test. I tracked the issue to the #if USING_16BIT_BUS #if defined(SAM3X8E) section (fillRect method) in the cpp. It looks the longer delays in 16bit mode are ony for DUE. I've changed it and now got up to 216MHz and the whole test takes 1.12s. I know the library is mainly for the shields so if the custom code is worth sharing please let me know how.

HX8347G problem

I'm trying to use a 2.8 "TFT screen shield with arduino uno,
but I could not write anything on the screen, I tried the library of MCU_KBV and I am waiting for your help
Screen: MCUFRIEND HX8347G
Note: the SD card on the screen is working

17201292_10155036403959144_7139475389576506989_n
17190901_10155036403969144_603658339160435241_n

Display cropped, 3.97 inch

Hi, I have a (written on the back): "3.97" TFT LCF for arduino uno with spiflash for font ic".
It looks like a (about) 16:9 display but is detected as
`
tft.readID() finds: ID = 0x9488

PORTRAIT is 320 x 480
`

Unfortunately, the vertical resolution seems to be less than 320, as everything seems cropped in the test programs. (I tried to add #define SUPPORT_9488_555 to the ino-files, but this seems unrelated to my problems).
Pictures can be found here:
https://www.dropbox.com/sh/i60duov0t5ubmvn/AADFHS_o1blnf7aBdbpqId1Ga?dl=0&m=

Thank you very much for your help.

Best regards,

Pio

Weird graphical effect on R61580

Hi!
So i got a TFT LCD with the R61580 chip ID.
When i run a sketch it works, but it looks HORRIBLE.
Colors look incorrect and you can see like a scanline pattern over the screen.
Black looks for example gray and looking at the display can cause a bit of discomfort due to the scanline continuously moving. Is there something wrong with the display or is it because the display isn't tested yet since it says that in the code. Any help would be appreciated! :)

Issues with ID=0x5408

Hi,

Firstly thank you and well don with the library, an excellent piece of work.

I am using a TFT Shield on an Uno but getting a few minor issues. The first is that the text appears backwards. Simple fix that you might want to look at, or check to see if others are getting. Simple solution by changing the following in MCUFRIEND_kbv.cpp:

case 0x5408:
        _lcd_capable = 0 | REV_SCREEN | READ_BGR | INVERT_GS;
        goto common_9320;

to

case 0x5408:
        _lcd_capable = 0 | REV_SCREEN | READ_BGR;
        goto common_9320;

As you can see my display has ID 0x5408. Second issue is when running graphictest_kbv the black appears to flicker, like scan lines. Everything else works fine. Not sure if it helps but the LCD_ID_ReadReg output is:

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) 54 08	ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) C4 C4 C4 C4	Manufacturer ID
reg(0x0009) C9 C9 C9 C9 C9	Status Register
reg(0x000A) CA CA	Get Power Mode
reg(0x000C) CC CC	Get Pixel Format
reg(0x0061) E1 E1	RDID1 HX8347-G
reg(0x0062) E2 E2	RDID2 HX8347-G
reg(0x0063) E3 E3	RDID3 HX8347-G
reg(0x0064) E4 E4	RDID1 HX8347-A
reg(0x0065) E5 E5	RDID2 HX8347-A
reg(0x0066) E6 E6	RDID3 HX8347-A
reg(0x0067) E7 E7	RDID Himax HX8347-A
reg(0x0070) F0 F0	Panel Himax HX8347-A
reg(0x00A1) E1 E1 E1 E1 E1	RD_DDB SSD1963
reg(0x00B0) F0 F0	RGB Interface Signal Control
reg(0x00B4) F4 F4	Inversion Control
reg(0x00B6) F6 F6 F6 F6 F6	Display Control
reg(0x00B7) F7 F7	Entry Mode Set
reg(0x00BF) FF FF FF FF FF FF	ILI9481, HX8357-B
reg(0x00C0) C0 C0 C0 C0 C0 C0 C0 C0 C0	Panel Control
reg(0x00C8) C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8	GAMMA
reg(0x00CC) CC CC	Panel Control
reg(0x00D0) D0 D0 D0	Power Control
reg(0x00D2) D2 D2 D2 D2 D2	NVM Read
reg(0x00D3) D3 D3 D3 D3	ILI9341, ILI9488
reg(0x00D4) D4 D4 D4 D4	Novatek ID
reg(0x00DA) 00 00	RDID1
reg(0x00DB) 00 00	RDID2
reg(0x00DC) DC DC	RDID3
reg(0x00E0) E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0	GAMMA-P
reg(0x00E1) E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1	GAMMA-N
reg(0x00EF) EF EF EF EF EF EF	ILI9327
reg(0x00F2) F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2	Adjust Control 2
reg(0x00F6) F6 F6 F6 F6	Interface Control

Would appreciate any pointers.
Regards,
Nick

Axis Rotation

As I try to draw, the pen traces left to right but the display outputs it from right to left at the bottom of the screen. Whats the issue? it seems like an issue of inverted axis . How to solve it?

Open-Smart TFT shield not working after updating several library

hi David,

thx for all the great work!
i was tinkering with a TFT shield with HX8352B chip when i got an popup in the arduino IDE that there where some library updates. after updating the TFT no longer works (white screen). i've tried to downgrade several library but i don't remember al the ones i've updated. do you know wich one could cause the problem. or is there a log somewhere so that i can undo the right updates?
i hope you can point me in the right direction...
thanks anyway!

greetings,
Maikel

I LOVE YOU DAVID PRENTICE (totally in the admiration sort of way ...)

I just want you to know that your init sequence for the ili9235 has to be the only correct on eon the internet. I have tried for three days to get one of these screens to work on RPI with fb tft and in the end it was your init seq, that made it work.

If any one is looking for how to do this the answer is :

Option 8 Rev D (David Prentice): YES modprobe fbtft_device name=flexpfb rotate=180 fps=60 gpios=dc:3,reset:17,wr:2,cs:21,db00:9,db01:11,db02:18,db03:23,db04:24,db05:25,db06:8,db07:7 modprobe flexfb width=240 height=320 buswidth=8 regwidth=16 setaddrwin=1 init=-1,0x00E5,0x78F0,-1,0x0001,0x0100,-1,0x0002,0x0200,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0005,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-1,0x0007,0x0001,-2,200,-1,0x0010,0x1690,-1,0x0011,0x0227,-2,50,-1,0x0012,0x000D,-2,50,-1,0x0013,0x1200,-1,0x0029,0x000A,-1,0x002B,0x000D,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0404,-1,0x0032,0x0003,-1,0x0035,0x0405,-1,0x0036,0x0808,-1,0x0037,0x0407,-1,0x0038,0x0303,-1,0x0039,0x0707,-1,0x003C,0x0504,-1,0x003D,0x0808,-1,0x0060,0x2700,-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0000,-1,0x0007,0x0133,-3

AnyHow Thanks for being Awesome David Thats twice youve saved me :) ill buy you a beer sometime

MCUFRIEND TFT 2.8 Shield ID = 0x4747 not supported

diagnose_TFT_support in the Arduino IDE File>Examples>MCUFRIEND_kvb reports:

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

tft.readID() finds: ID = 0x4747

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 whether this controller is supported
There are FAQs in extras/mcufriend_how_to.txt

extras/mcufriend_howTo.txt reports this shield ID is supported.


LCD_ID_readregRead in the Arduino IDE File>Examples>MCUFRIEND_kvb reports:

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) 47 47 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 3F 3F 3F 3F 3F Status Register
reg(0x000A) 00 00 Get Power Mode
reg(0x000C) 01 01 Get Pixel Format
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 80 80 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 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) 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 GAMMA-P
reg(0x00E1) 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 GAMMA-N
reg(0x00EF) 49 49 49 49 49 49 ILI9327
reg(0x00F2) 10 10 10 10 10 10 10 10 10 10 10 10 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

SevenSegNumFontPlusPlus font

Hello,
I would like to use "SevenSegNumFontPlusPlus" font with the MCUFRIEND_kbv library but I don't know how to do this.
I included the SevenSegNumFontPlusPlus.c file in my project folder and I tried to use it as a normal freefont. But it doesn't work.
What are the different steps to use this font ?
Thanks in advance for your help.
Best regards
Fabien

Library License?

I didn't see a license for the library.
There is no license file and I didn't see anything in the actual source files either.
So "as is" it doesn't look like anybody can use it since there is no clear copyright information.
I'd recommend adding licensing and copyright information to the main files.
If you use the github guidelines for a license file, https://help.github.com/articles/licensing-a-repository/
then github's licensee script will auto detect it and show it on the main repository page.

BTW, if you are GPL v3.0 then I have some s/w that could make the AVR raw port i/o much easier.

stm32f411RE didn't compile

my issue is my new board
this because my measurement system needs a lot of ram
therfor i've changed from a stm32f103rb nucleo 64 to
stm32f411RE nucleo 64
but my code didn't compile with mcufriends_kbv

errormessage
Board is not supported
so i started to edit
mcufriends_shield.h


//####################################### STM32 ############################
#elif defined(__STM32F4__) || defined (__STM32F1__) || defined(STM32F103xB) || defined(STM32F411xE) || defined(STM32L476xx) // MAPLECORE or STM32CORE 

#if 0
#elif defined(STM32L476xx)
#define WRITE_DELAY { WR_ACTIVE; WR_ACTIVE; }
#define READ_DELAY  { RD_ACTIVE; RD_ACTIVE; RD_ACTIVE; RD_ACTIVE; }
#define REGS(x) x
#define PIN_MODE2(reg, pin, mode) reg=(reg&~(0x3<<((pin)<<1)))|(mode<<((pin)<<1))
#define GPIO_INIT()   { RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN | RCC_AHB2ENR_GPIOBEN | RCC_AHB2ENR_GPIOCEN; }
#define PIN_OUTPUT(port, pin) PIN_MODE2((port)->MODER, pin, 0x1)
#elif defined(ARDUINO_NUCLEO_F103C8) || defined(ARDUINO_NUCLEO_F103RB)  || defined(ARDUINO_NUCLEO_F411RE)//regular CMSIS libraries
#define REGS(x) x
#define GPIO_INIT()   { RCC->APB2ENR |= RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN | RCC_APB2ENR_AFIOEN; \
        AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_1;}
#else                                                                  //weird Maple libraries
#define REGS(x) regs->x
#endif
#if defined(__STM32F4__) || defined(__STM32F1__) || defined(STM32F103xB) || defined(STM32F411xE) || defined(STM32F411RE)
#define WRITE_DELAY { }
#define READ_DELAY  { RD_ACTIVE; }
#define GROUP_MODE(port, reg, mask, val)  {port->REGS(reg) = (port->REGS(reg) & ~(mask)) | ((mask)&(val)); }
#define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
#define GP_INP(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x44444444)
#define PIN_OUTPUT(port, pin) {\
        if (pin < 8) {GP_OUT(port, CRL, 0xF<<((pin)<<2));} \
        else {GP_OUT(port, CRH, 0xF<<((pin&7)<<2));} \
    }
#define PIN_INPUT(port, pin) { \
        if (pin < 8) { GP_INP(port, CRL, 0xF<<((pin)<<2)); } \
        else { GP_INP(port, CRH, 0xF<<((pin&7)<<2)); } \
    }
#endif
#define PIN_HIGH(port, pin)   (port)-> REGS(BSRR) = (1<<(pin))
#define PIN_LOW(port, pin)    (port)-> REGS(BSRR) = (1<<((pin)+16))

#if 0
#elif defined(ARDUINO_GENERIC_STM32F103C) || defined(ARDUINO_NUCLEO_F103C8)
#warning Uno Shield on BLUEPILL
#define RD_PORT GPIOB
#define RD_PIN  5
#define WR_PORT GPIOB
#define WR_PIN  6
#define CD_PORT GPIOB
#define CD_PIN  7
#define CS_PORT GPIOB
#define CS_PIN  8
#define RESET_PORT GPIOB
#define RESET_PIN  9

// configure macros for the data pins
#define write_8(d)    { GPIOA->REGS(BSRR) = 0x00FF << 16; GPIOA->REGS(BSRR) = (d) & 0xFF; }
#define read_8()      (GPIOA->REGS(IDR) & 0xFF)
//                                         PA7 ..PA0
#define setWriteDir() {GP_OUT(GPIOA, CRL, 0xFFFFFFFF); }
#define setReadDir()  {GP_INP(GPIOA, CRL, 0xFFFFFFFF); }

#elif defined(ARDUINO_STM_NUCLEO_F103RB) || defined(ARDUINO_STM_NUCLEO_F411RE) || defined(ARDUINO_NUCLEO_F103RB)  || defined(ARDUINO_NUCLEO_F411RE) || defined(ARDUINO_NUCLEO_L476RG) // Uno Shield on NUCLEO
#warning Uno Shield on NUCLEO
#define RD_PORT GPIOA
#define RD_PIN  0
#define WR_PORT GPIOA
#define WR_PIN  1
#define CD_PORT GPIOA
#define CD_PIN  4
#define CS_PORT GPIOB
#define CS_PIN  0
#define RESET_PORT GPIOC
#define RESET_PIN  1

// configure macros for the data pins
#define write_8(d) { \
        GPIOA->REGS(BSRR) = 0x0700 << 16; \
        GPIOB->REGS(BSRR) = 0x0438 << 16; \
        GPIOC->REGS(BSRR) = 0x0080 << 16; \
        GPIOA->REGS(BSRR) = (  ((d) & (1<<0)) << 9) \
                            | (((d) & (1<<2)) << 8) \
                            | (((d) & (1<<7)) << 1); \
        GPIOB->REGS(BSRR) = (  ((d) & (1<<3)) << 0) \
                            | (((d) & (1<<4)) << 1) \
                            | (((d) & (1<<5)) >> 1) \
                            | (((d) & (1<<6)) << 4); \
        GPIOC->REGS(BSRR) = (  ((d) & (1<<1)) << 6); \
    }

#define read_8() (       (  (  (GPIOA->REGS(IDR) & (1<<9)) >> 9) \
                            | ((GPIOC->REGS(IDR) & (1<<7)) >> 6) \
                            | ((GPIOA->REGS(IDR) & (1<<10)) >> 8) \
                            | ((GPIOB->REGS(IDR) & (1<<3)) >> 0) \
                            | ((GPIOB->REGS(IDR) & (1<<5)) >> 1) \
                            | ((GPIOB->REGS(IDR) & (1<<4)) << 1) \
                            | ((GPIOB->REGS(IDR) & (1<<10)) >> 4) \
                            | ((GPIOA->REGS(IDR) & (1<<8))  >> 1)))


#if defined(ARDUINO_NUCLEO_L476RG)
//                                   PA10,PA9,PA8           PB10,PB5,PB4,PB3                      PC7
#define setWriteDir() { setReadDir(); \
                        GPIOA->MODER |=  0x150000; GPIOB->MODER |=  0x100540; GPIOC->MODER |=  0x4000; }
#define setReadDir()  { GPIOA->MODER &= ~0x3F0000; GPIOB->MODER &= ~0x300FC0; GPIOC->MODER &= ~0xC000; }
#else
//                                 PA10,PA9,PA8                       PB10                   PB5,PB4,PB3                             PC7
#define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
#define setReadDir()  {GP_INP(GPIOA, CRH, 0xFFF); GP_INP(GPIOB, CRH, 0xF00); GP_INP(GPIOB, CRL, 0xFFF000); GP_INP(GPIOC, CRL, 0xF0000000); }
#endif

#elif defined(ARDUINO_MAPLE_REV3) // Uno Shield on MAPLE_REV3 board
#warning Uno Shield on MAPLE_REV3 board
#define RD_PORT GPIOC
#define RD_PIN  0
#define WR_PORT GPIOC
#define WR_PIN  1
#define CD_PORT GPIOC
#define CD_PIN  2
#define CS_PORT GPIOC
#define CS_PIN  3
#define RESET_PORT GPIOC
#define RESET_PIN  4

// configure macros for the data pins
#define write_8(d) { \
        GPIOA->REGS(BSRR) = 0x0703 << 16; \
        GPIOB->REGS(BSRR) = 0x00E0 << 16; \
        GPIOA->REGS(BSRR) = (  ((d) & (1<<0)) << 10) \
                            | (((d) & (1<<2)) >> 2) \
                            | (((d) & (1<<3)) >> 2) \
                            | (((d) & (1<<6)) << 2) \
                            | (((d) & (1<<7)) << 2); \
        GPIOB->REGS(BSRR) = (  ((d) & (1<<1)) << 6) \
                            | (((d) & (1<<4)) << 1) \
                            | (((d) & (1<<5)) << 1); \
    }

#define read_8()  (     (   (  (GPIOA->REGS(IDR) & (1<<10)) >> 10) \
                            | ((GPIOB->REGS(IDR) & (1<<7)) >> 6) \
                            | ((GPIOA->REGS(IDR) & (1<<0)) << 2) \
                            | ((GPIOA->REGS(IDR) & (1<<1)) << 2) \
                            | ((GPIOB->REGS(IDR) & (1<<5)) >> 1) \
                            | ((GPIOB->REGS(IDR) & (1<<6)) >> 1) \
                            | ((GPIOA->REGS(IDR) & (1<<8)) >> 2) \
                            | ((GPIOA->REGS(IDR) & (1<<9)) >> 2)))

//                                 PA10,PA9,PA8                   PA1,PA0                     PB7,PB6,PB5
#define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOA, CRL, 0xFF); GP_OUT(GPIOB, CRL, 0xFFF00000); }
#define setReadDir()  {GP_INP(GPIOA, CRH, 0xFFF); GP_INP(GPIOA, CRL, 0xFF); GP_INP(GPIOB, CRL, 0xFFF00000); }

#else
#error REGS group
#endif

#define write8(x)     { write_8(x); WRITE_DELAY; WR_STROBE; }
#define write16(x)    { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst)   { RD_STROBE; READ_DELAY; dst = read_8(); RD_IDLE; }
#define READ_16(dst)  { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); }

#elif defined(ESP32)       //regular UNO shield on TTGO D1 R32 (ESP32)
#define LCD_RD  2  //LED
#define LCD_WR  4
#define LCD_RS 15  //hard-wired to A2 (GPIO35) 
#define LCD_CS 33  //hard-wired to A3 (GPIO34)
#define LCD_RST 32 //hard-wired to A4 (GPIO36)

#define LCD_D0 12
#define LCD_D1 13
#define LCD_D2 26
#define LCD_D3 25
#define LCD_D4 17
#define LCD_D5 16
#define LCD_D6 27
#define LCD_D7 14

#define RD_PORT GPIO.out
#define RD_PIN  LCD_RD
#define WR_PORT GPIO.out
#define WR_PIN  LCD_WR
#define CD_PORT GPIO.out
#define CD_PIN  LCD_RS
#define CS_PORT GPIO.out1.val
#define CS_PIN  LCD_CS
#define RESET_PORT GPIO.out1.val
#define RESET_PIN  LCD_RST

Now i've the following error messages

/home/achim/mnt/Electronik/Pflamiku/arduino-micro-waage/micro-v1/pflamiku_2018_01_26_tft_stm32/pflamiku_2018_01_26_tft_stm32.ino:39:38: warning: large integer implicitly truncated to unsigned type [-Woverflow]
 UTFTGLUE myGLCD(0x0154,A2,A1,A3,A4,A0);
                                      ^
In file included from /home/achim/Arduino/libraries/MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:31:0:
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:362:2: warning: #warning Uno Shield on NUCLEO [-Wcpp]
 #warning Uno Shield on NUCLEO
  ^~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/MCUFRIEND_kbv.cpp: In member function 'void MCUFRIEND_kbv::reset()':
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:38: error: 'struct GPIO_TypeDef' has no member named 'CRH'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                      ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:316:17: note: in definition of macro 'REGS'
 #define REGS(x) x
                 ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:326:43: note: in expansion of macro 'GROUP_MODE'
 #define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
                                           ^~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:24: note: in expansion of macro 'GP_OUT'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                        ^~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:78:5: note: in expansion of macro 'setWriteDir'
     setWriteDir();
     ^~~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:38: error: 'struct GPIO_TypeDef' has no member named 'CRH'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                      ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:316:17: note: in definition of macro 'REGS'
 #define REGS(x) x
                 ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:326:43: note: in expansion of macro 'GROUP_MODE'
 #define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
                                           ^~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:24: note: in expansion of macro 'GP_OUT'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                        ^~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:78:5: note: in expansion of macro 'setWriteDir'
     setWriteDir();
     ^~~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:65: error: 'struct GPIO_TypeDef' has no member named 'CRH'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                                                 ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:316:17: note: in definition of macro 'REGS'
 #define REGS(x) x
                 ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:326:43: note: in expansion of macro 'GROUP_MODE'
 #define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
                                           ^~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:51: note: in expansion of macro 'GP_OUT'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                                   ^~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:78:5: note: in expansion of macro 'setWriteDir'
     setWriteDir();
     ^~~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:65: error: 'struct GPIO_TypeDef' has no member named 'CRH'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                                                 ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:316:17: note: in definition of macro 'REGS'
 #define REGS(x) x
                 ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:326:43: note: in expansion of macro 'GROUP_MODE'
 #define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
                                           ^~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:51: note: in expansion of macro 'GP_OUT'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                                   ^~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:78:5: note: in expansion of macro 'setWriteDir'
     setWriteDir();
     ^~~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:92: error: 'struct GPIO_TypeDef' has no member named 'CRL'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                                                                            ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:316:17: note: in definition of macro 'REGS'
 #define REGS(x) x
                 ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:326:43: note: in expansion of macro 'GROUP_MODE'
 #define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
                                           ^~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:78: note: in expansion of macro 'GP_OUT'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                                                              ^~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/MCUFRIEND_kbv.cpp:78:5: note: in expansion of macro 'setWriteDir'
     setWriteDir();
     ^~~~~~~~~~~
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:406:92: error: 'struct GPIO_TypeDef' has no member named 'CRL'
 #define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
                                                                                            ^
/home/achim/Arduino/libraries/MCUFRIEND_kbv/utility/mcufriend_shield.h:316:17: note: in definition of macro 'REGS'
 #define REGS(x) x
                 ^

Have you some idea how we can solve this problem

Moving A4 pin (reset) to free up i2c SDA pin

Hi and sorry to bother.
I am designing a project that would require freeing up the i2c bus from the display pins. I wish to move the screen reset pin from pin A4 to A6 or preferably to digital pin 10. No, this would not mean "mutilating" the beautiful shield, because I have chosen to use an arduino nano (atmega328p-AU) which means using jumper cables anyways. I have tried redefining the pins in the sketch, but I have been unsuccessful at that. I have also tried modifying the mcufriend_special.h file (fearing that i would break something) and that didn't wok out either.
The display I'm using is this one: ebay link and it uses 2 SUM74HC245T chips. The datasheet claims them to be ILI9341 controller chips. Also i am not using the SD pins, so i think the software should not be able to use pins D10-D13.
Help would be appreciated. Thank you!

-Pepe.

id 0x1602.....how to solve LCD_ID_readreg.ino Output is ...please

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 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 38 80 00 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 08 08 Get Power Mode
reg(0x000C) 06 06 Get Pixel Format
reg(0x0061) 00 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 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 A6 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 02 Inversion Control
reg(0x00B6) 00 24 02 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 0A 0A 0A 0A 0A 0A 0A 0A 0A Panel Control
reg(0x00C8) 40 40 40 40 40 40 40 40 40 40 40 40 40 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 01 16 02 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 38 38 RDID1
reg(0x00DB) 80 80 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 22 23 25 08 10 14 40 7B 50 0B 1B 22 20 2F 37 GAMMA-P
reg(0x00E1) 00 0C 14 23 0E 14 15 36 59 46 0B 1F 27 1F 20 22 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 24 04 04 1E 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

ESP32 (Generic dev modules)

Hi, Thank you for the great development effort!

I have just purchased a couple of ESP32 modules and I was wondering if there is anybody that could give me some hints on how to make it work with the mcufriends_kbv library.

As usual, the 3.5" TFT works great on the UNO, but I am not sure where I need to change the GPIOs to have it work with the ESP32.
I have noticed that there is an ESP32 reference in the mcufriend_shield.h. I have tried changing the pins there, to match the wired pattern but with no result.
I would really appreciate some help.

I did try the LCD_ID test example but even that does not seem to give any result (0x0 unidentified id).

Thank you
Chris

HX8357B problem

default

I'm trying to use a 3.2 "TFT screen shield with arduino mega 2560,
but I could not write anything on the screen, I tried the library of MCU_KBV and I am waiting for your help
Screen: MCUFRIEND HX8357B

Support for MKR1000

It says support for Zero on its readme, but cant find its connection diagram or pin mapping for the same My case is i need to make this work with MKR1000

tft.readID() finds: ID = 0x4040 This ID is not supported

Hello,

I tried to run the library with an mcufriend LCD TFT 2.4 with no good results. This is the output on graphictest_kbv.ino: https://www.youtube.com/watch?v=Pyezm6JvmiY

This is the output from LCD_ID_readreg.ino:

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 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 00 08 Get Power Mode
reg(0x000C) 00 26 Get Pixel Format
reg(0x0061) 40 40 RDID1 HX8347-G
reg(0x0062) 40 40 RDID2 HX8347-G
reg(0x0063) 40 40 RDID3 HX8347-G
reg(0x0064) 40 40 RDID1 HX8347-A
reg(0x0065) 40 40 RDID2 HX8347-A
reg(0x0066) 40 40 RDID3 HX8347-A
reg(0x0067) 40 40 RDID Himax HX8347-A
reg(0x0070) 40 40 Panel Himax HX8347-A
reg(0x00A1) 40 FF FF 40 40 RD_DDB SSD1963
reg(0x00B0) 40 40 RGB Interface Signal Control
reg(0x00B4) 40 40 Inversion Control
reg(0x00B6) 40 40 40 40 40 Display Control
reg(0x00B7) 40 40 Entry Mode Set
reg(0x00BF) 40 41 62 55 60 42 ILI9481, HX8357-B
reg(0x00C0) 40 40 40 40 40 40 40 40 40 Panel Control
reg(0x00C8) 40 40 40 40 40 40 40 40 40 40 40 40 40 GAMMA
reg(0x00CC) 40 40 Panel Control
reg(0x00D0) 40 40 40 Power Control
reg(0x00D2) 40 40 40 40 40 NVM Read
reg(0x00D3) 40 40 40 40 ILI9341, ILI9488
reg(0x00D4) 40 40 40 40 Novatek ID
reg(0x00DA) 40 40 RDID1
reg(0x00DB) 40 40 RDID2
reg(0x00DC) 40 40 RDID3
reg(0x00E0) 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 GAMMA-P
reg(0x00E1) 40 FF FF 40 40 40 40 40 40 40 40 40 40 40 40 40 GAMMA-N
reg(0x00EF) 40 40 40 40 40 40 ILI9327
reg(0x00F2) 40 40 40 40 40 40 40 40 40 40 40 40 Adjust Control 2
reg(0x00F6) 40 40 40 40 Interface Control

What I should to do to make it work?

Kind regards,
Luiz

Changing the pinout is very unfriendly

Hello,

I would like to try the 2.4 display (0x0154) with a multichannel oscilloscope project, which uses the STM32. On the Arduino Mega2560 the dispay works well. But at the moment, I am not able to adapt the display pins, I made some changes to the file "mcufriend_shield.h", but it was not enough to work, could somebody tell me what is the most correct way to change the pinout for this below:

#define TFT_DATA GPIOB // Port data bits D0..D7:

//Control pins |RD |WR |RS |CS |RST|
#define TFT_RD PB10
#define TFT_WR PC15
#define TFT_RS PC14
#define TFT_CS PC13
#define TFT_RST PB11

The project originally uses ILI9341, and I can not change the layout of the board:
https://github.com/ardyesp/DLO-138

Schematic (better resolution):
https://jyetech.com/Products/LcdScope/UserManual_138_new.pdf

Original file "mcufriend_shield.h":

#elif defined(ARDUINO_GENERIC_STM32F103C) || defined(ARDUINO_NUCLEO_F103C8) || defined(ARDUINO_BLUEPILL_F103C8)
#warning Uno Shield on BLUEPILL
#define RD_PORT GPIOB
//#define RD_PIN 5
#define RD_PIN 0 //hardware mod to Adapter. Allows use of PB5 for SD Card
#define WR_PORT GPIOB
#define WR_PIN 6
#define CD_PORT GPIOB
#define CD_PIN 7
#define CS_PORT GPIOB
#define CS_PIN 8
#define RESET_PORT GPIOB
#define RESET_PIN 9

// configure macros for the data pins
#define write_8(d) { GPIOA->REGS(BSRR) = 0x00FF << 16; GPIOA->REGS(BSRR) = (d) & 0xFF; }
#define read_8() (GPIOA->REGS(IDR) & 0xFF)
// PA7 ..PA0
#define setWriteDir() {GP_OUT(GPIOA, CRL, 0xFFFFFFFF); }
#define setReadDir() {GP_INP(GPIOA, CRL, 0xFFFFFFFF); }

Modifield:

#elif defined(ARDUINO_GENERIC_STM32F103C) || defined(ARDUINO_NUCLEO_F103C8) || defined(ARDUINO_BLUEPILL_F103C8)
#warning Uno Shield on BLUEPILL
#define RD_PORT GPIOB
//#define RD_PIN 5
#define RD_PIN 10 //hardware mod to Adapter. Allows use of PB5 for SD Card
#define WR_PORT GPIOC
#define WR_PIN 15
#define CD_PORT GPIOC
#define CD_PIN 14
#define CS_PORT GPIOC
#define CS_PIN 13
#define RESET_PORT GPIOB
#define RESET_PIN 11

// configure macros for the data pins
#define write_8(d) { GPIOB->REGS(BSRR) = 0x00FF << 16; GPIOB->REGS(BSRR) = (d) & 0xFF; }
#define read_8() (GPIOB->REGS(IDR) & 0xFF)
// PA7 ..PA0
#define setWriteDir() {GP_OUT(GPIOB, CRL, 0xFFFFFFFF); }
#define setReadDir() {GP_INP(GPIOB, CRL, 0xFFFFFFFF); }

Thank you!

Display flipped horizontally

Ok, just received my mcufriend 2.4" 240x320. Plugged it into my MEGA2560. Downloaded the mcufriend library. Compiled the test card - displays on the TFT BUT everything is flipped left/right. I.e. it draws/prints from right to left. I see there's an option to rotate the display but these just, well, rotate the display.
Is there a switch option to correct this or have I bought a duffer? (It was very cheap from AliExpress)

Judgment of RM68140

Judgment of RM68140 is not right.
RM68140's Display ID Register is 0x04h.
And Register value is 32bit [xx 0x54 0x80 0x66]

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 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 54 54 80 66 Manufacturer ID -------------> This is RM68140
reg(0x0009) 00 00 61 00 00 Status Register

LCD TFT On / Off

After a lot of research, i didn't find any method to switch off and on the display
my display is a spfd5408 mcufriends version
what i found is https://github.com/PaxInstruments/STM32CubeF3/blob/master/Drivers/BSP/Components/spfd5408/spfd5408.h
for stm32.
so i think this should work in one or another way

the .h file

void     spfd5408_DisplayOn(void);
void     spfd5408_DisplayOff(void);

https://github.com/PaxInstruments/STM32CubeF3/blob/master/Drivers/BSP/Components/spfd5408/spfd5408.c
the c file

void spfd5408_DisplayOn(void)
{
  /* Power On sequence ---------------------------------------------------------*/
  spfd5408_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */
  spfd5408_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */
  spfd5408_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */
  spfd5408_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
  LCD_Delay(10);
  /* 262k/65k color selection */
  spfd5408_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color,  0x05 65k color */
  /* SET PANEL */
  spfd5408_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
 
  /* Display On */
  spfd5408_WriteReg(LCD_REG_40, 0x38);
  LCD_Delay(60);
  spfd5408_WriteReg(LCD_REG_40, 0x3C);
}

/**
  * @brief  Disables the Display.
  * @param  None
  * @retval None
  */
void spfd5408_DisplayOff(void)
{
  /* Power Off sequence ---------------------------------------------------------*/
  spfd5408_WriteReg(LCD_REG_23, 0x0000); /* default 0x06 262k color,  0x05 65k color */
  spfd5408_WriteReg(LCD_REG_24, 0x0000); /* Display frame rate = 70Hz RADJ = '0110' */
  spfd5408_WriteReg(LCD_REG_25, 0x0000); /* OSC_EN = 1 */
  spfd5408_WriteReg(LCD_REG_28, 0x0000); /* AP[2:0] = 111 */
  spfd5408_WriteReg(LCD_REG_31, 0x0000); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
  spfd5408_WriteReg(LCD_REG_54, 0x0000); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */

  /* Display Off */
  spfd5408_WriteReg(LCD_REG_40, 0x38);
  LCD_Delay(60);
  spfd5408_WriteReg(LCD_REG_40, 0x04);
}

BOBUINO & ili7783 (& ili9481)

I welcome you David.
I try to connect to Atmega 1284P the display on the ili7783 controller. everything is collected according to:

//################################### UNO SHIELD on BOBUINO ##############################
#elif defined(AVR_ATmega1284P) || defined(AVR_ATmega644P) //UNO shield on BOBUINO
#warning regular UNO shield on BOBUINO
#define RD_PORT PORTA
#define RD_PIN 7
#define WR_PORT PORTA
#define WR_PIN 6
#define CD_PORT PORTA
#define CD_PIN 5
#define CS_PORT PORTA
#define CS_PIN 4
#define RESET_PORT PORTA
#define RESET_PIN 3

#define BMASK 0x0F //
#define DMASK 0x6C //
#define write_8(x) { PORTB = (PORTB & ~BMASK) | ((x) >> 4);
PORTD = (PORTD & ~DMASK) | ((x) & 0x0C) | (((x) & 0x03) << 5); }
#define read_8() ( (PINB << 4) | (PIND & 0x0C) | ((PIND & 0x60) >> 5) )
#define setWriteDir() { DDRB |= BMASK; DDRD |= DMASK; }
#define setReadDir() { DDRB &= ~BMASK; DDRD &= ~DMASK; }
#define write8(x) { write_8(x); WR_STROBE; }
#define write16(x) { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst) { RD_STROBE; dst = read_8(); RD_IDLE; }
#define READ_16(dst) { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); }

#define PIN_LOW(p, b) (p) &= ~(1<<(b))
#define PIN_HIGH(p, b) (p) |= (1<<(b))
#define PIN_OUTPUT(p, b) *(&p-1) |= (1<<(b))

the controller is loaded, but on the screen only blinking in a step of program execution is observed. prompt where and what needs to be corrected for normal work?

Problem uploading with 3.5 MCU TFT

Just tried using the latest version and there's a bug with uploading to my Uno with a 3.5 TFT from mcufriend. The sketch begins to run on the Uno but the Arduino IDE shows its still uploading and throws a bunch of error messages.

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x00
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

Seems like there is a problem identifying the controller. I got it working on the official v2.9 from the Arduino thread by forcing an id of 0x9486. I found this controller id through trial and error which leads me to believe my shield has the ILI9486 controller. ID returned through serial monitor was 0xD3D3. I believe this means its a write-only shield and requires a forced id. Not forcing the id on v2.9 still results in the display working fine but color is inverted and display is flipped.

The latest version on the master branch causes the returned id to be 0x8357. Not sure why the id has changed. Without forcing the id of 0x9486 the upload will cause the Arduino IDE to hang and with the error above. Forcing the id of 0x9486 solves the problem.

I think this is a bug which needs fixing as most people will just upload the sketch without editing for the first time. This will cause the display to glitch and the IDE to hang. Not sure what the new default controller the library assigns.

How to use a fonts?

I run GLUE_Demo_480x320,

it working good, but I want to use FreeDefaultFonts.h
I'm comment #undef GFXFONT_H //comment this line to enable FreeFonts in UTFTGLUE,

i have
"exit status 1
'GFXglyph' does not name a type"

[SOLVED] Support for 3.5 inch ILI9481

Hello David,
Thanks for the nice LIB.
I have a 3.5 inch display (Aliexpress / Kuman).
You might want to add this to the supported boards:
(I am not too familiar yet with git, so i use this way to contribute)

// These are the pins for some typical shields!
// S6D0154: YP=A1, XM=A2, YM=7, XP=6
// ST7783 : YP=A2, XM=A1, YM=6, XP=7
// ILI9320: YP=A2, XM=A3, YM=8, XP=9
// ILI9325: YP=A1, XM=A2, YM=7, XP=6
// ILI9325BG: YP=A2, XM=A1, YM=6, XP=7
// ILI9341: YP=A2, XM=A1, YM=7, XP=6
// ILI9488: YP=A1, XM=A2, YM=7, XP=6
// R65109V: YP=A2, XM=A1, YM=6, XP=7
// ILI9481: YP=A3, XM=A2, XM=9, XP=8

} else if (identifier == 0xB509) {
name = "R61509V";
TS_LEFT = 889; TS_RT = 149; TS_TOP = 106; TS_BOT = 975;
SwapXY = 1;
} else if (identifier == 0x9481) {
name = "ILI9481";
TS_LEFT = 180; TS_RT = 910; TS_TOP = 950; TS_BOT = 158;

}

Best Regards,
John.

problem with ID = 0x1505

Hi ... after the update 2.9.7 does not work Touch_shield_kbv
on the beta version worked with editing Ravi_kanchan

ESP32 not compiling

GLUE_Demo_480x320.ino:11: In file included from
Error compiling project sources
Build failed for project 'GLUE_Demo_480x320'
UTFTGLUE.h: In member function void UTFTGLUE::print(String, int, int, int)

UTFTGLUE.h: 102:26: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
settextcursor(st.c_str(), x, y); MCUFRIEND_kbv*: print(st);}
UTFTGLUE.h:155: note initializing argument 1 of void UTFTGLUE settextcursor(char*, int, int)
void settextcursor(char *st, int x, int y) {

Inverted Color + glitch ILI9486 / ILI9481

I'm using two 3,5" TFT screen with an arduino mega, both of them has inverted color, for exemple black is 0xFFFF, orange is 0x07FF, cyan is 0xF800.

25129990_2101903243183918_348418968_o
25086878_2101903236517252_1695090994_o

after few seconds, some line, some characters or some pixels are displayed at the wrong place

21277986_1933375940254987_1360031956_o

The same sketch work perfectly on a third screen, with same pcb, i will check which driver is it.

iLI9488 colors are off.

Hi,I i have used your library for the ILi9488 MCUFRIEND Display made for Ardunio UNO and i confirmed it with the test sketch and it works but there were lines and boxes and it looked terrible and the colors were completely off!
I changed the following settings in the .cpp file from 0x3A, 1, 0x55, //Interlace Pixel Format [XX] to
0x3A, 1, 0x36, //Interlace Pixel Format [XX] and it made improvement but the colors were not 'punchy' like red,green,blue were bit off. Any Solutions?
Before:
img_20180323_100738
After changes :
img_20180323_111512
The display it self:
3 6tft-2

LCD_ID sketch:
reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 54 80 66 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 00 08 Get Power Mode
reg(0x000C) 00 06 Get Pixel Format
reg(0x0061) 00 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 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 93 30 93 30 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 02 Inversion Control
reg(0x00B6) 00 02 02 3B 3B Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 0E 0E 0E 0E 0E 0E 0E 0E Panel Control
reg(0x00C8) 00 B0 B0 B0 B0 B0 B0 B0 B0 B0 B0 B0 B0 GAMMA
reg(0x00CC) 00 03 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 00 0D NVM Read
reg(0x00D3) 00 00 94 88 ILI9341, ILI9488
reg(0x00D4) 00 97 00 00 Novatek ID
reg(0x00DA) 00 54 RDID1
reg(0x00DB) 00 80 RDID2
reg(0x00DC) 00 66 RDID3
reg(0x00E0) 00 00 07 0C 05 13 09 36 AA 46 09 10 0D 1A 1E 0F GAMMA-P
reg(0x00E1) 00 00 20 23 04 10 06 37 56 49 04 0C 0A 33 37 0F GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 58 04 12 02 22 22 FF 0A 90 14 88 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

SPFD5408

I tried SPFD5408(ID = 0x5408)

I changed a part of your code.
It's work fine.

(original)

case 0x5408: _lcd_capable = 0 | REV_SCREEN | READ_BGR; //Red 2.4" thanks jorgenv, Ardlab_Gent // _lcd_capable = 0 | REV_SCREEN | READ_BGR | INVERT_GS; //Blue 2.8" might be different goto common_9320;

(my change)

case 0x5408: _lcd_capable = 0 | REV_SCREEN | READ_BGR; //Red 2.4" thanks jorgenv, Ardlab_Gent // _lcd_capable = 0 | REV_SCREEN | READ_BGR | INVERT_GS; //Blue 2.8" might be different goto common_93x5;

Support for Adafruit 2050 TFT (HX8357D)

I'm using an Adafruit 2050 TFT/touch display with the TFT-VFO-ubitx2.9 (GitHub) project and for some reason the colors used for the display appear to be inverted. If I use the Adafruit TFTLCD-Library (with the ubitx code), the colors appear to be mostly normal. The only hardware difference is using the ATmega2560 pins 22-29 for data (TFTLCD-Library) instead of the UNO 2-9pins for data (MCUFriend).

I looked through the 8357 code to see if I could spot anything, not there did not appear to be anything obvious that would account for the color inversion.

I did try the invertDisplay() method, but it did not appear to have any effect.

Any ideas?

  • Mark

Display dimming

I am writing an app that uses the Arduino Mega2560 Pro Mini and an mcufriend 2.4" display. A rotary encoder is used to update fields on the display, one of which is a frequency display (e.g., 7.030.000 Mhz). Turing the encoder increments/decrements the frequency by a given amount. Each time I rotate the encoder, the call to tft.print(buffer) causes the display to dim for a fraction of a second and then return to full brightness. It's annoyingly noticeable. Now the interesting part: If I substitute a 3.5" display, there is no flickering/dimming. The project's display case is such that I need to use the smaller display.

Any ideas?

Jack, W8TEE

MCUfriend Due example using parallel 8bit and DMA?

I bought a 3.5" mcufriend shield.
All mcufriend examples are extremely slow so I think they use SPI and none of the DUE unique features.
Is there a fork of this library that make use of parallel and co?

Where is ADA_GFX_kbv.h in this project collection?

I noticed ADA_GFX_kbv.h was mentioned in the mcufriend_kbv.h file as an #include, but can't seem to find it. Can we use the original Adafruit_GFX.h as they wrote it instead? I'm having to transcribe new files since I currently don't have a way to download. My graphics ID is 5408. Thanks.

LCD ID:04 04

I have a controller which has 40pin breakout and it reads the following : any idea what controller it is ?
reg(0x0000) 04 04 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 04 04 04 04 Manufacturer ID
reg(0x0009) 05 05 05 05 05 Status Register
reg(0x000A) 06 06 Get Power Mode
reg(0x000C) 04 04 Get Pixel Format
reg(0x0061) 65 65 RDID1 HX8347-G
reg(0x0062) 66 66 RDID2 HX8347-G
reg(0x0063) 67 67 RDID3 HX8347-G
reg(0x0064) 64 64 RDID1 HX8347-A
reg(0x0065) 65 65 RDID2 HX8347-A
reg(0x0066) 66 66 RDID3 HX8347-A
reg(0x0067) 67 67 RDID Himax HX8347-A
reg(0x0070) 74 74 Panel Himax HX8347-A
reg(0x00A1) 25 25 25 25 25 RD_DDB SSD1963
reg(0x00B0) 34 34 RGB Interface Signal Control
reg(0x00B4) 34 34 Inversion Control
reg(0x00B6) 36 36 36 36 36 Display Control
reg(0x00B7) 37 37 Entry Mode Set
reg(0x00BF) 37 37 37 37 37 37 ILI9481, HX8357-B
reg(0x00C0) 44 44 44 44 44 44 44 44 44 Panel Control
reg(0x00C8) 44 44 44 44 44 44 44 44 44 44 44 44 44 GAMMA
reg(0x00CC) 44 44 Panel Control
reg(0x00D0) 54 54 54 Power Control
reg(0x00D2) 56 56 56 56 56 NVM Read
reg(0x00D3) 57 57 57 57 ILI9341, ILI9488
reg(0x00D4) 54 54 54 54 Novatek ID
reg(0x00DA) 56 56 RDID1
reg(0x00DB) 57 57 RDID2
reg(0x00DC) 54 54 RDID3
reg(0x00E0) 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 GAMMA-P
reg(0x00E1) 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 GAMMA-N
reg(0x00EF) 67 67 67 67 67 67 ILI9327
reg(0x00F2) 76 76 76 76 76 76 76 76 76 76 76 76 Adjust Control 2
reg(0x00F6) 76 76 76 76 Interface Control

Upgrade to Teensy

Hi David, I was working with your library with my lcd screen , working verywell on my UNO . I was trying to make it work on my Teensy 3.1, but There is a lot of thing that seems to be problematic, i am not even able to compile in the controller, do you have an idea of what should be modified to get it work with it except the pinout?

I'm using mcufriend_kbv.h

thank you

Compiler error [-fpermissive]

I use MCUFRIEND library for my 3.5 inch touch display. I only use the screen, not the touch part. I use a simple example to show some .bmp file on an Arduin Uno. Thats works perfect.

Now I try to change to an ESP32 and exact the same application can't compile and stops with an error.

In detail I get this error:
MCUFRIEND_kbv-master/UTFTGLUE.h:102:26: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

settextcursor(st.c_str(), x, y); MCUFRIEND_kbv::print(st);}

                           ^

Can you fix this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.