Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buydisplay 5 inch SSD1963 on Arduino Due not supported? #149

Closed
jponko opened this issue Jul 24, 2020 · 20 comments
Closed

Buydisplay 5 inch SSD1963 on Arduino Due not supported? #149

jponko opened this issue Jul 24, 2020 · 20 comments

Comments

@jponko
Copy link

jponko commented Jul 24, 2020

I have a buydisplay.com (EastRising) 5 inch SSD1963 display. I know you've helped others who have displays which us the SSD1963 driver but I can't seem to get MCUFRIEND_kbv to work on it with those suggestions. I tried to use
#define USE_SPECIAL
#define USE_DUE_16BIT_SHIELD
tft.begin(0x1963); //The ID is not detected

but not even the backlight isn't turned on. I uncommented the USE_DUE_!6BIT_SHIELD in mcufriend_special.h so I'm at a loss on what to try next.

All the information on the display (ER-TFTM050-5(800x480 Pixels) with Resistive Touch Panel) is included in the attached zip along with my simple Arduino code (MuTX.ino). I bought it as a package - display, adapter and Arduino Due. The display works with the UTFT library but the lack of large and scalable fonts forced me to abandon using it.
MuTX.zip

Regards,
Jerry Ponko, AC9NM

@prenticedavid
Copy link
Owner

prenticedavid commented Jul 25, 2020

The ER-AS-SSD1963 datasheet has the same wiring as the popular Mega2560 Adapter Shields (as used by UTFT)

#elif defined(__SAM3X8E__) && defined(USE_MEGA_16BIT_SHIELD)  //regular MEGA shield on DUE
#warning USE_MEGA_16BIT_SHIELD
#define USES_16BIT_BUS
// configure macros for the control pins
#define RD_PORT PIOA
#define RD_PIN  20     //D43
#define WR_PORT PIOC
#define WR_PIN  7      //D39
#define CD_PORT PIOC
#define CD_PIN  6      //D38
#define CS_PORT PIOC
#define CS_PIN  8      //D40
#define RESET_PORT PIOC
#define RESET_PIN  9   //D41

However these "Mega" Adapter Shields do not have a RD pin. You must force tft.begin(0x1963)
Or force the appropriate ID for other displays.

The "CTE Due Adapter" has different wiring (and no level shifters). I make a simple hardware mod to connect RD to D24. This makes the Adapter "readable". i.e. I can read Ebay 40-pin displays with the "CTE Due Adapter"

I suggest that you use:

#define USE_SPECIAL
#define USE_MEGA_16BIT_SHIELD

Your screen should work on the Due. Your screen should work on a Mega2560. (the ER Adapter has level shifters)

It is only necessary to provide links to ER documents. Or regular datasheets. Or regular libraries.
Obviously custom sketches need to be included in your ZIP.

Your ZIP does not seem to have the schematic for ER-AS-SSD1963.
I will look on BuyDisplay website. It might be possible to enable RD on the data bus buffers.

David.

Edit. Printed the Adapter schematic. It is NOT practical to make the data buffers read-write

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@prenticedavid
Copy link
Owner

Yes, you have missed the plot.

Those defines do not go into the sketch

You should edit utility/mcufriend_shield.h and utility/mcufriend_special.h
Then the compiler uses those MACROS when building the library

David.

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@prenticedavid
Copy link
Owner

I possess several "Mega2560 shields" i.e. 16-bit data bus on #22-#37. control on #38-#41
e.g. SSD1289, ILI9481, ILI9486, RM68140, ...

These can run on Mega or Due. Most have 10k resistor packs as serial resistors. Some have HC245 buffers.
They work fine. But obviously you need to force tft.begin(0x1289) ... or whatever.

I only have "CTE 40-pin Adapter for Due". This can run SSD1963 on a Due.
But I also run SSD1963 with a STM32 BluePill i.e. a home-made adapter from a piece of Protoboard.

I suggest that you start from scratch. i.e. make a fresh install and edit.

David.

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@prenticedavid
Copy link
Owner

No, I would like to get you working properly.

First off. Run a UTFT example with the BuyDisplay provided UTFT library.

Then remove the BuyDisplay library. Install and Run a UTFT example with the official RinkyDink UTFT library.

Quote example sketch by name. Post links to installed library. (actually I know it is UTFT_VERSION 283 )
And you have already included BuyDisplay stuff on your ZIP.

RinkyDink should work out of the box. My SSD1963 is 5.0 inch

C:\Users\David Prentice\Documents\Arduino\libraries\UTFT\examples\Arduino (ARM) + Teensy\UTFT_Demo_800x480\UTFT_Demo_800x480.ino

UTFT myGLCD(ITDB50,38,39,40,41);

David.

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@prenticedavid
Copy link
Owner

UTFT like using gobbledygook names e.g. ITDB50
#define ITDB50 13 // SSD1963 (16bit) 800x480

I would be pretty confident that MCUFRIEND_kbv would work just fine with:
I enabled USE_SPECIAL in utility/mcufriend_shield.
I enabled USE_MEGA_16BIT_SHIELD in utility/mcufriend_special.h

and tft.begin(0x1963);
The library build should report:
#warning USE_MEGA_16BIT_SHIELD

David.

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@prenticedavid
Copy link
Owner

I added the defines. And compiled an example that forces ID=0x9486 :


Compiling library "Mcufriend_kbv"
"C:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10812 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Due\"" "-IC:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\sam\\1.6.12\\system/libsam" "-IC:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\sam\\1.6.12\\system/CMSIS/CMSIS/Include/" "-IC:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\sam\\1.6.12\\system/CMSIS/Device/ATMEL/" "-IC:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\sam\\1.6.12\\cores\\arduino" "-IC:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\sam\\1.6.12\\variants\\arduino_due_x" "-IC:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\sam\\1.6.12\\libraries\\SPI\\src" "-IC:\\Users\\David Prentice\\Documents\\Arduino\\libraries\\Mcufriend_kbv" "-IC:\\Users\\David Prentice\\Documents\\Arduino\\libraries\\Adafruit_GFX_Library" "-IC:\\Users\\David Prentice\\Documents\\Arduino\\libraries\\Adafruit_BusIO" "-IC:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\sam\\1.6.12\\libraries\\Wire\\src" "-IC:\\Users\\David Prentice\\Documents\\Arduino\\libraries\\Mcufriend_kbv\\utility" "C:\\Users\\David Prentice\\Documents\\Arduino\\libraries\\Mcufriend_kbv\\MCUFRIEND_kbv.cpp" -o "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_337923\\libraries\\Mcufriend_kbv\\MCUFRIEND_kbv.cpp.o"
In file included from C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv\utility/mcufriend_shield.h:16:0,

                 from C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv\MCUFRIEND_kbv.cpp:35:

C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv\utility/mcufriend_special.h:741:2: warning: #warning USE_MEGA_16BIT_SHIELD [-Wcpp]

 #warning USE_MEGA_16BIT_SHIELD

  ^

In file included from C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv\MCUFRIEND_kbv.cpp:35:0:

C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv\utility/mcufriend_shield.h:18:2: warning: #warning WE ARE USING A SPECIAL CUSTOM DRIVER [-Wcpp]

 #warning WE ARE USING A SPECIAL CUSTOM DRIVER

and the library, memory use lines say:

Using library SPI at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\SPI 
Using library Mcufriend_kbv at version 3.0.0-Beta in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv 
Using library Adafruit_GFX_Library at version 1.9.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit_BusIO at version 1.3.2 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_BusIO 
Using library Wire at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire 
"C:\\Users\\David Prentice\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_337923/graphictest_glue.ino.elf"
Sketch uses 53992 bytes (10%) of program storage space. Maximum is 524288 bytes.

So I am 100% confident that ID=0x1963 should work for you.

The IDE installs v2.9.9 Release. I have v3.0.0-Beta on my PC but the code is identical (except for version number)

David.

p.s. I have the schematic. It would not be simple to make a hardware mod.
But most importantly, I have MCUFRIEND_kbv running on Due with a ILI9486 shield. It will build and run UTFT examples for ILI9486 too.

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@prenticedavid
Copy link
Owner

UTFT_Demo_800x480.ino does not have any digitalWrite(8. HIGH) for a backlight.
Because most Mega Adapter shields have the backlight hard-wired.

Please just run all the examples. Make notes if you don't understand something.

The underscore shows how fonts are rendered. e.g. from topline or baseline.

You don't need to agree. Just understand how to control printing how you want it to look.

I don't see any "photo attached". But I know how that example looks on a small 176x220 or a large 800x480 screen.

Note that your screen has an XPT2046 controller with the SPI signals on random GPIO pins. So I think you will have to use URTouch.h library. (copy URTouch constructor from BuyDisplay examples)

You will only see a Warning if the library is re-compiled. e.g. Orange text on the verbose report.
Once the library is up to date, subsequent sketch builds do not need to re-build the library.
If you want to force a re-build, edit one of the library files e.g. add a space and remove it.

David.

@jponko
Copy link
Author

jponko commented Jul 25, 2020 via email

@jponko
Copy link
Author

jponko commented Jul 26, 2020 via email

@sk8rsdad
Copy link

I found this very helpful in getting the non-shield version to work. I had to comment out the | INVERT_RGB when setting _lcd_capable, select table8_ads = SSD1963_480_regvalues, and set the height (*p16 = 272) to make graphicstest_kbv.ino fully functional.

The next step is to get an 8-bit parallel version to work.

Thanks David and Jerry for making things a little easier for some random stranger!

@prenticedavid
Copy link
Owner

Yes, if your screen is 480x272 you will need different init table to the 5 inch 800x480 or the 7 inch 800x480.

Please let me know if everything works 100%. i.e. rotations, colours, directions,...

@sk8rsdad
Copy link

sk8rsdad commented Jul 31, 2020

I think things are working as expected. Portrait and Landscape labels are messed up since the display's default is landscape and graphicstest_kbv.ino assumes portrait. Scrolling works but direction always seems to be vertical relative to landscape. I don't know if that's expected behaviour.

I recorded a video but it can't be posted here. Perhaps these screen captures will help.

2020-07-31 13_45_53-mcufriend_1
2020-07-31 13_45_53-mcufriend_2
2020-07-31 13_45_53-mcufriend_3
2020-07-31 13_45_53-mcufriend_4
2020-07-31 13_45_53-mcufriend_5

@prenticedavid
Copy link
Owner

Your photos imply that the rotations are good. And the Vertical Scroll is good too.

Note that your SSD1963 has got oodles of GRAM memory. (enough for 384000 pixels)
Your panel only displays 130k pixels.

It should be possible to build an image off-screen and flip to it.
There is no library support for this but you should find users that have done it with other libraries.

David.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants