Go Down

Topic: MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields (Read 465671 times) previous topic - next topic

david_prentice

Seriously.   Buy a cheap Chinese Uno clone.   Shields are 100% reliable.

Run every example that comes with a library.   It is the best way to learn.   And it shows that your hardware is working ok.

David.

IY3775

Hi, I have a 3.5" ili9486 tft shield (8-bit) which was designed for Uno. I'm currently using it on a mega (not as a shield, but with Dupont extensions). The problem is it takes about 6 seconds to display a bmp image from SD card, while the Uno take about 4 seconds. I believe it's because the port mapping on mega splits the data bus into 3 PORTS.

I'd like to have the pin assignments changed so that all lcd data pins are on either PORT A or PORT C, both of which have 8 pins available.

Below is the wiki for the lcd I have:
http://www.lcdwiki.com/3.5inch_Arduino_Display-UNO

Regards,
Iyaadh.

david_prentice

Go on.   There is current thread about displaying RAW images.

There are often threads about wiring a Shield to PortA on a Mega2560.
e.g. USE_SPECIAL, USE_MEGA_8BIT_PROTOSHIELD

My showBMP example is designed for multiple formats.    It will run on Uno
If you strip it down to 24-bit .BMP files and increase buffer sizes,   it will run faster on a Mega.

Any "display from SD" will depend on SD hardware,  access of FAT filesystem, decode of image format,  blitting of pixels to TFT.

A Uno shield suffers from all these Mega features.
Hardware SPI is faster than bit-bang SPI.   Smaller files mean less SPI traffic.   .BMP images are big but simple to decode.    .RAW files are smaller and simpler.   .JPG files can be very SMALL but require CPU power and SRAM.

David.

IY3775

Thanks, what are the pin assignments in PORTA for data0 to data7? I didn't find any info about data pins in mcufriend_special file.

david_prentice

I assume that anyone prepared to use a SPECIAL will be able to work it out for herself.

LCD_D0 - LCD_D7 go to digital #22 - 29
The LCD control signals remain on Analog #0 - 4

My Protoshield Adapter routes the SD pins to the Mega SPI header.
Which means that I can use hardware SPI.

David.

luckyflyer

#2780
Sep 10, 2019, 06:47 pm Last Edit: Sep 10, 2019, 07:11 pm by luckyflyer
Hello to all, I'm new here and need some help. I've decided to build the graphing thermometer as described in the #2 2019 issue of nuts and volts. I have a 2650 board and a 3.5 lcd and almost all of the remaining hardware. I have downloaded the files from here https://github.com/Ed-EE-Eng/Graphics_Thermometer I have downloaded and installed the Arduino editor and loaded the ino files along with the required libraries which includes the  MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields. and a file named droid_mono_40pt7b.h . I have selected the 2560 mega board in the drop down and I've also loaded the program into the online web editor.

Now when I do a verify and save I get an error that states that  "FreeSevenSegNumFontPlusPlus.h:No such file or directory, compilation terminated".

In the MCUFRIEND library that I downloaded I see the  FreeSevenSegNumFontPlusPlus.h file that is readable by notepad but I don't know how to correct the error.

The author states that he compiled using IDE 1.8.5, I used 1.8.9 and he says that compiling using a different ide may cause problems.

I should also add that I did not use the lcd that the author used. I used a MCUFriend TFT Touch LCD for Arduino. bought here https://www.ebay.com/itm/3-5-inch-TFT-LCD-Touch-Screen-Display-Module-480X320-for-Arduino-Mega-2560-US/183891214796?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

I'm now concerned that even when I get this error corrected there may be other errors as the compile progresses. I don't want to become a arduino programing expert, I would just like to have this nice graphing thermometer, can you guys help me out?
Thanks

david_prentice

I suggest that you always install the v2.9.8 Release via IDE Library Manager.

"FreeSevenSegNumFontPlusPlus.h" is in the current Beta on GitHub.
Your project should not care whether it is present or not.

I will try the https://github.com/Ed-EE-Eng/Graphics_Thermometer project later.

David.

luckyflyer

2.9.8 is the version that I have installed.

Thank you sir.

david_prentice

I just built the project for a Mega2560 in IDE v1.8.9.
Code: [Select]

Using library RTClib at version 1.2.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\RTClib
Using library Adafruit_GFX_Library at version 1.5.6 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library
Using library Mcufriend_kbv at version 2.9.8 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv
Using library Bounce2 at version 2.52 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Bounce2
Using library DHT_sensor_library at version 1.3.2 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\DHT_sensor_library
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.9\hardware\arduino\avr\libraries\Wire
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.9\hardware\arduino\avr\libraries\SPI
Using library Adafruit_Unified_Sensor at version 1.0.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_Unified_Sensor
"C:\\Program Files (x86)\\Arduino-1.8.9\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_228763/Graphing_Thermometer_V3_10.ino.elf"
Sketch uses 65514 bytes (25%) of program storage space. Maximum is 253952 bytes.
Global variables use 4957 bytes (60%) of dynamic memory, leaving 3235 bytes for local variables. Maximum is 8192 bytes.

It was a successful build.   I have not got the necessary hardware to implement the whole project.

I have never used the "Online Compiler".   

As far as I know it has copies of every library supported by the Library Manager.
It always uses "up to date" library versions.

But it will have problems with libraries that have several RTClib variants.

Personally,  I am happier with libraries installed on my local PC.
I enable File->Preferences: Verbose Compile.
This shows me version and location of the libraries used in the build.

David.

IY3775

Is there a way to increase spi clock speed in the library? (For better SD card performance). Currently my 3.5" Uno shield on the mega takes 4704ms to display a 24-bit 320*480 bitmap. Pixel buffer is set to 80.

david_prentice

If you install the SdFat library it can read the SD on the Uno Shield.
There is not much you can do with bit-banged SPI.

If you can use hardware SPI pins,  SdFat.h is much faster than SD.h.

You have chosen an Uno Shield on a Mega2560.   TFT writing is slower.   SD card is not on hardware SPI pins.

Obviously Xmega, ARM or ESP all have DMA.   This can make tremendous difference to SD performance.

David.

luckyflyer

I used the libraries that you used and it compiled and uploaded on the first try. I thank you for your help.



I just built the project for a Mega2560 in IDE v1.8.9.
Code: [Select]

Using library RTClib at version 1.2.0 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\RTClib
Using library Adafruit_GFX_Library at version 1.5.6 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library
Using library Mcufriend_kbv at version 2.9.8 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Mcufriend_kbv
Using library Bounce2 at version 2.52 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Bounce2
Using library DHT_sensor_library at version 1.3.2 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\DHT_sensor_library
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.9\hardware\arduino\avr\libraries\Wire
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.9\hardware\arduino\avr\libraries\SPI
Using library Adafruit_Unified_Sensor at version 1.0.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_Unified_Sensor
"C:\\Program Files (x86)\\Arduino-1.8.9\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\DAVIDP~1\\AppData\\Local\\Temp\\arduino_build_228763/Graphing_Thermometer_V3_10.ino.elf"
Sketch uses 65514 bytes (25%) of program storage space. Maximum is 253952 bytes.
Global variables use 4957 bytes (60%) of dynamic memory, leaving 3235 bytes for local variables. Maximum is 8192 bytes.

It was a successful build.   I have not got the necessary hardware to implement the whole project.

I have never used the "Online Compiler".   

As far as I know it has copies of every library supported by the Library Manager.
It always uses "up to date" library versions.

But it will have problems with libraries that have several RTClib variants.

Personally,  I am happier with libraries installed on my local PC.
I enable File->Preferences: Verbose Compile.
This shows me version and location of the libraries used in the build.

David.

david_prentice

First off.   Does the project work 100% on your real hardware?


I am intrigued by your Online problem.
Please can you do an "Online Build" and Copy-Paste the Memory + Library Use lines e.g. like I did.

If it fails,  Copy-Paste the whole Error report to a .TXT file.   Then attach this file.

It would be interesting to know the Pros and Cons of an Online Build.

David.

luckyflyer

I can do that but schedule won't allow me to until tomorrow. I did have the same failure both online and with 1.8.5 and 1.8.9  which makes me think I didn't have the right or all libraries needed. And it looks like all routines and sub routines are working as they should.

jxid

Hi to all
I just got an MCUFRIEND 2.4" Shield.
I am trying to make it work with the graphics test project.
I get a white screen.
I have read many posts from here.
I tried to change the ID in tft.begin and made the ID 9320.
In this case i get some colors in the display but not right,
Also i can not see any text from the example.
I think that it is a driver problm.
So please if anyone can help me.
I post the serial monitor output from the LCD ID readreg example.

Code: [Select]
Read Registers on MCUFRIEND UNO shield
controllers either read 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) 97 97 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 97 97 97 97 Manufacturer ID
reg(0x0009) 97 97 97 97 97 Status Register
reg(0x0061) 97 97 RDID1 HX8347-G
reg(0x0062) 97 97 RDID2 HX8347-G
reg(0x0063) 97 97 RDID3 HX8347-G
reg(0x0064) 97 97 RDID1 HX8347-A
reg(0x0065) 97 97 RDID2 HX8347-A
reg(0x0066) 97 97 RDID3 HX8347-A
reg(0x0067) 97 97 RDID Himax HX8347-A
reg(0x0070) 97 97 Panel Himax HX8347-A
reg(0x00A1) 97 97 97 97 97 RD_DDB SSD1963
reg(0x00B0) 97 97 RGB Interface Signal Control
reg(0x00B4) 97 97 Inversion Control
reg(0x00B6) 97 97 97 97 97 Display Control
reg(0x00B7) 97 97 Entry Mode Set
reg(0x00BF) 97 97 97 97 97 97 ILI9481, HX8357-B
reg(0x00C0) 97 97 97 97 97 97 Panel Control
reg(0x00CC) 97 97 Panel Control
reg(0x00D0) 97 97 97 Power Control
reg(0x00D2) 97 97 97 97 97 NVM Read
reg(0x00D3) 97 97 97 97 ILI9341, ILI9488
reg(0x00DA) 97 97 RDID1
reg(0x00DB) 97 97 RDID2
reg(0x00DC) 97 97 RDID3
reg(0x00EF) 97 97 97 97 97 97 ILI9327
reg(0x00F2) 97 97 97 97 97 97 97 97 97 97 97 97 Adjust Control 2
reg(0x00F6) 97 97 97 97 Interface Control

Go Up