2.4" TFT Display Using CTE Shield to DIsplay BMP Files from onboard SD a Due

I recently received a Due, a 2.4" TFT and a CTE TFT controller with on board SD.

I was able to use the UTF libraries to display things but I had trouble getting the SD to read using the SD libraries. After a bit of research on the shield I determined that jumper 8 needed to soldered closed allowing pin 53 to become the CS pin.

I failed using the ITDB02_tinyFAT16 and the demo example to display raw files because the library, as of this date, does not support the DUE. Having a bit of experience with Adafruit libraries and the SD library I opted to modify the bmpDraw routine from the Adafruit TFTLCD library example TFTBMP.

I can now display bmp files. I have placed the code on GITHUB at https://github.com/mboroff/UTF_Display_BMP_Files.git. Feel free to take a look.

Hi,

thank you very much! This is really helpful!

But: is there a way to speed this up? A 779x348p bmp takes about 22s to load (24 bit). Unfortunately bmps with a bit depth of 8 or 4 won`t be recognized :/

Vile

1.- Read this post and download lib (UTFT_tinyFAT and UTFT_tinyFAT.cpp)

View images from SD card on TFT display

2.- BMP 24 bits to RAW format: tool ImageConverter 565 v2.1 (from UTFT lib). Save RAW files in SD card

3.- Example: Multiple image test

RAW size: 320x240 px
Time to load single image: 289 ms

Code

#include <SdFat.h>
#include <UTFT_tinyFAT.h>
#include <UTFT.h>

UTFT myGLCD(2,38,39,40,41);  // TFT HY32D
UTFT_tinyFAT myFiles(&myGLCD);  // start up an instance to read images from the SD card

// SD chip select pin
const uint8_t chipSelect = 44;

int initime;
int endtime;

// file system
SdFat sd;

void RAWfiles()  
{
  initime = millis();
  myFiles.loadBitmap(0, 0, 320, 240, "Example1.raw"); 
  endtime = millis();
  Serial.println(endtime - initime);  
  delay(1000);  

  initime = millis();
  myFiles.loadBitmap(0, 0, 320, 240, "Example2.raw");      
  endtime = millis();
  Serial.println(endtime - initime);  
    delay(1000);  
}

void setup() {
  myGLCD.InitLCD();
  myGLCD.clrScr(); // clear the screen

  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
  Serial.begin(9600);
  Serial.println("card initialized.");
}

void loop()
{
    RAWfiles();
}

Again: THX ghlawrence2000.

Hi Vile,

WHOOOAAAA, 22 seconds to display 779x348!!

Hmmmm. Having experienced the same problems mboroff had, I took a different approach and modified UTFT_tinyFat to use SdFatLib. This allows us to use any size SD card, and folders.

Images need to be converted to .raw using Hennings converter which is included with UTFT library.

My version of UTFT_tinyFAT draws the following image sizes from Class 6 Samsung 32GB SD to 5" CPLD CTE TFT using CTE Shield and Arduino DUE.

240x240 , 125ms 320x240 , 174ms 440x440 , 420ms 779x348 , 581ms 800x480 , 815ms

If you are interested, reply here.

Regards,

Graham

PS. TFTLCDCyg refers to my modified version of UTFT_tinyFAT. Be aware the earlier version has bad colour, you need the later version.

@TFTLCDCyg,

Do you think it is worth making a github for this and/or contacting Henning with a view to introducing this to the UTFT suit of libraries such that SD cards >2GB and nested folders are allowed and functional with AVR or DUE Arduino?

Regards,

Graham

By the way, big THANKS for mention on your YOUTUBE clip! :grin:

Hello,

If anyone interested, I ported the API driver HX8347A from Atmel ASF allowing Due via EBI/SMC to handle directly a 2.4 TFT LCD module drawing images from a SPI SD card breakout board. So far the time to load 320x240 bitmaps is 0.9 sec (it can be improved). I am working on the touchscreen feature.

Building an LCD TFT library for Arduino DUE

Regards,

p

@Palliser,

0.9sec for 320x240???? Are you sure that is what you mean?

My effort does a 320x240 raw image in 174ms......... = 0.174 sec!!

Regards,

Graham

Hello Graham,

900ms to refresh a pure bitmap picture 320x240, bit depth 24 (225 KB) .

Regards,

p

Hi ghlawrence2000, I found your modified tiny_UTFT and it works well, just what I was looking for. Now I can view large images really fast. Thank you for this library :)

Vile

ghlawrence2000: @Palliser,

0.9sec for 320x240???? Are you sure that is what you mean?

My effort does a 320x240 raw image in 174ms......... = 0.174 sec!!

Regards,

Graham

Hello Graham,

I think 0.9 vs 0.174 secs is mostly because my slow SPI SDcard board, thus, and only for speed performance test purposes, I am going to use the internal 512KB FLASH of Due with my TFT library and draw a couple of 320x240 bitmaps to measure the refresh rate. Now, I am aloso thinking to use a Winbond W25QXX flash memory with Due to show short video clips. Regards,

p

Hi palisser,

I have a dozen of the winbond 25Q128FVSG, that I intend to create my own font/icon ic similar to the CTE display and shield, but I have not got far with it yet as a result of my due falling apart and other things :wink: but I would be VERY interested to see how far you get with video!! That would be amazing if you can pull off SEVERAL frames per second!!

Best wishes,

Graham

How far have you got with video? I have got 320*240 running at 5.7fps from Class 4 4GB SD. Any advances? Would love to swap notes… :wink: :grin:

Regards,

Graham