GTT Protocol Manual Rev 2.1 questions and issues

GTT TFT Support

Moderator: Mods

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 14, 2014 8:41 am

Hi,

I'm a happy owner of a GTT50A so far. I'm trying various drawing commands, and managing to make things work just fine so far, with one exception. Creating and updating a label works odd for me, it works sometimes, but not when I use multiple labels and multiple fonts. I suppose I'm sending the wrong commands somehow. With the update label command I'm not sure about the size and format of "Format", which is specified as "Fixed Decimal". What's fixed decimal? :) Is it a simple BYTE or a WORD or a 16-bit signed integer or ... ?

Currently I'm sending the following bytes to update my label in buffer index 0 and 1 respectively:

0xFE 0x11 0x00 0x00 ascii_character_sequence 0x00
0xFE 0x11 0x01 0x00 ascii_character_sequence 0x00

I'm using simple Ansi string with a trailing 0x00. Is it the right understanding of the command?

---

Another concern: I'm not sure I understand the manual on using of buffers. Can I use 256 individual buffer indexes for fonts, a separate 256 individual buffers for labels, a third separate 256 individual buffers for bitmaps, etc? So the device has 5x256 or 6x256 buffers in total?

Also, is it possible to use buffer index #0 and buffer index #255 freely, or are they reserved for special protocol use?

---

And the third and hopefully last issue: the protocol manual doesn't explain how to configure font size for labels. Do I have to issue the set font size command before creating a label? It didn't work for me for some reason. Or do I have to issue that before updating the label?

Thank you for your time.

Regards,
Fiery

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Tino » Mon Jul 14, 2014 9:32 am

Hi Tamas,

When sending the "Update a Label" command the Format parameter is sent as a simple Byte yes.

The commands look correct. Are the Labels you have set updating?


You have 256 buffers for each type of buffer yes. But keep in mind there is a limit 32MB of data that can be loaded into the ALL buffers at one time.
Buffers run from 0 to 255, with that being said 0 and 255 can be used as the index for your buffer.

Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 14, 2014 9:57 am

Thank you for the reply. My labels are updating, but with some weird issues. First I thought they use the same font while they shouldn't, but then I realized Tahoma and Verdana looks quite similar :) Now I'm trying to use Tahoma (tahoma.ttf) and Arial Black (ariblk.ttf), both saved from Win7 64-bit SP1 \Windows\Fonts folder and copied to the SD card. Now when I use the following sequence ...

GTT_LoadFont(0,'tahoma.ttf');
GTT_CreateLabel(0,10,310,250,40,0,2,2, 0 ,255,255,255);
GTT_SetFontSize(8);
GTT_UpdateLabel(0,0,'Tahoma');
Sleep(500);
GTT_SetFontSize(10);
GTT_UpdateLabel(0,0,'Tahoma');
Sleep(500);
GTT_SetFontSize(12);
GTT_UpdateLabel(0,0,'Tahoma');
Sleep(500);
GTT_SetFontSize(16);
GTT_UpdateLabel(0,0,'Tahoma');
Sleep(500);
GTT_SetFontSize(20);
GTT_UpdateLabel(0,0,'Tahoma');
Sleep(500);
GTT_SetFontSize(24);
GTT_UpdateLabel(0,0,'Tahoma');

... the "Tahoma" text on the screen grows as it should. But when I use the following sequence ...

GTT_LoadFont(1,'ariblk.ttf');
GTT_CreateLabel(1,10,410,250,40,0,2,2, 1 ,255,255,255);
GTT_SetFontSize(8);
GTT_UpdateLabel(1,0,'Ariblk');
Sleep(500);
GTT_SetFontSize(10);
GTT_UpdateLabel(1,0,'Ariblk');
Sleep(500);
GTT_SetFontSize(12);
GTT_UpdateLabel(1,0,'Ariblk');
Sleep(500);
GTT_SetFontSize(16);
GTT_UpdateLabel(1,0,'Ariblk');
Sleep(500);
GTT_SetFontSize(20);
GTT_UpdateLabel(1,0,'Ariblk');
Sleep(500);
GTT_SetFontSize(24);
GTT_UpdateLabel(1,0,'Ariblk');

... the "Ariblk" text stays the same size all the time. Maybe TTF fonts aren't handled similarly by the GTT device?

Also, sometimes the second label didn't appear at all, but now that I'm playing with my code and keep altering it, I can't reproduce that issue. I'll report back about this if I can reproduce it again.

Thanks,
Tamas

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 14, 2014 10:00 am

... forgot to add: the "Ariblk" text is displayed using the Arial Black font, and it looks okay, but it seems to use the 24 pt font size all the time, no matter what font size I set.

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 14, 2014 10:10 am

... and one more thing: now I've made it to update the labels with a different text after each set font size, to see if the label itself gets updated. It does, so the label keeps changing for both Tahoma and Arial Black font, but the Arial Black one doesn't seem to scale with font size setting at all, while the Tahoma one does. I've also tried to clear all buffers before doing anything on the LCD, but it didn't help.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Tino » Mon Jul 14, 2014 10:34 am

Hi Tamas

The default font is index '0'.

When you are updating the size be sure to use the "Set Font" command first to set the current font to the one you want to change the size of. For example

Load Font(1)
set font(1)
set font size
Create Label(1)
update label(1)
sleep
set font size
update label(1)
sleep
...
Load Font(2)
set font(2)
set font size
Update Label(2)
sleep
set font size
update label(2)
sleep


Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Tue Jul 15, 2014 2:43 am

The Set Font command did the trick, thank you! I assumed it's not necessary to hassle with that since when you create a label, you specify the font index to use :) And I'm trying to minimize the number of commands sent to the device, since once the user of our software drops 10 or 20 elements on the LCD designed UI, the number of drawing commands will quite easily grow to the hundreds :(

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 21, 2014 6:19 am

I've found another issue while writing my code for GTT. I'm trying to load bitmaps (BMP and PNG files) from the SD card, but it's quite erratic. Loading BMP files are almost always OK, only a very few cases I get an eErrorCode_FileNotFound error. Not 100% reliable still, and I'm wondering what could be the problem, but mostly it works. But, with PNG files it's a lot like 1 successful Load Bitmap per 10 tries. And it has a strange pattern: the first load into index#0 is always successful, the second load try to index#1 always fails, the third load try to index#2 is always successful, and the rest of tries always fail. And strangely, after doing a Clear All Buffers, I cannot load PNG files anymore, into any indexes. I have to issue a Reset Module command to get things back to normal. My test code now looks like this:

Code: Select all

GTT_ResetModule;  // just to make sure everything is clear before starting the test
sleep(5000);

GTT_LoadBitmap(0,'logo.png');  // first parameter is the bitmap buffer index, second parameter is the filename
sleep(500);
GTT_LoadBitmap(1,'logo.png');
sleep(500);
GTT_LoadBitmap(2,'logo.png');
sleep(500);
GTT_LoadBitmap(3,'logo.png');
sleep(500);
GTT_LoadBitmap(4,'logo.png');
sleep(500);
GTT_LoadBitmap(5,'logo.png');
sleep(500);
GTT_LoadBitmap(6,'logo.png');
sleep(500);
GTT_LoadBitmap(7,'logo.png');

sleep(5000);
GTT_ClearAllBuffers;
sleep(5000);

GTT_LoadBitmap(0,'logo.png');
sleep(500);
GTT_LoadBitmap(1,'logo.png');
sleep(500);
GTT_LoadBitmap(2,'logo.png');
sleep(500);
GTT_LoadBitmap(3,'logo.png');
sleep(500);
GTT_LoadBitmap(4,'logo.png');
sleep(500);
GTT_LoadBitmap(5,'logo.png');
sleep(500);
GTT_LoadBitmap(6,'logo.png');
sleep(500);
GTT_LoadBitmap(7,'logo.png');

sleep(10000);
(I've inserted a lot of sleeps in a desperate try to get things working, but didn't help...)

Out of the 16 tries, only the 1st and 3rd try will produce a successful Load Bitmap. Is there anything special about loading PNG files that I need to consider? Does Clear All Buffers clear PNG files from bitmap buffers?

The PNG file I'm trying to use is 17187 bytes long, 123x92 pixels, 32-bit ARGB, and is in the root folder of the SD card. When the file is successfully loaded, it can be displayed on the LCD without any issues. The error message (when the file fails to load) is always eErrorCode_FileNotFound.

When I change the above code by simply replacing the filenames with a BMP file that's also on the SD card, only one out of the 16 tries fails on average, but many cases all loads work out fine.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Tino » Mon Jul 21, 2014 8:34 am

Hi Tamas,

When loading a bitmap file you must keep in mind that you only have 32mb available in memory.
The memory includes loaded bitmaps and fonts.

Can I ask why you are loading the images and then clearing all the buffers?

When you receive the Error is it when the image is being loaded or when you are attempting to display the image?

Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 21, 2014 8:39 am

Thank you for your reply. The code above is only a test code. My regular code works erratically due to this issue, and I've had to make a test code to pinpoint the actual issue. My regular code simply cannot display PNG images after the LCD gets updated by issuing a Clear All Buffers and loading all fonts and bitmaps again. My test code doesn't load any fonts or any big bitmaps, so there's no chance the 32MB total buffer memory gets overflown. Unless of course loading a 17 KB PNG two times makes it overflow ;)

The error is received when I try to issue a Load A Bitmap command. When that command fails, I wouldn't try to display the bitmap.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Tino » Mon Jul 21, 2014 9:14 am

Hi Tamas,

Are you using the newest firmware for your GTT? Please check that you are using the newest firmware. Firmware can be downloaded here:
http://www.matrixorbital.ca/software/GTT2.0/

The error code you are seeing will happen if the buffer is full sometimes which is why I mentioned the buffer size.

If there only one image you are having an issue with? or multiple files?

thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 21, 2014 9:29 am

My GTT50A reports a Module Version of 2.0, and a Firmware Version of 2.1. It was purchased a mere 3 weeks ago, so I assume it is running the very latest firmware. Is it possible to check the firmware build number as well, or only 2.1 is available via GTT protocol calls?

I've tried it with a single, small PNG at first. But now I've tried it with another PNG file, and it acts absolutely similarly to the other PNG. First and third try loads the PNG, the rest of the tries all fail. I've also tried it now with a JPEG file, and loading it seems a lot slower, but it only failed once per 16 tries. It seems the firmware "headache" is caused by PNG somehow. I can of course send you the PNG files in email if you want, but I somehow suspect all PNG files would cause similar issues.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Tino » Mon Jul 21, 2014 9:41 am

Hi Tamas,

If you could send the files you are using and the process you are using to upload them all I can try to fully replicate what you are seeing.

Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Fiery
LCD Geek
Posts: 36
Joined: Wed Jul 09, 2014 2:38 pm
Location: Budapest, Hungary
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Fiery » Mon Jul 21, 2014 9:54 am

Thank you for looking into this. Here are the two PNG files that fails to load. My test code is above, and here's the GTT_LoadBitmap function:

Code: Select all

Function  GTT_LoadBitmap(by_idx:Byte;sa_filename:AnsiString):Boolean;

Var
  d_amount,d_len,d_read,d_written : DWord;
  i : Integer;
  bu_out : Array [0..1023] Of Byte;
  bu_in  : Array [0..4] Of Byte;

Begin
  Result:=False;

  If MatrixOrbitalGTTLCD_Init Then  // this is always true
  Begin
    d_len:=Length(sa_filename);
    If d_len>(SizeOf(bu_out)-4) Then Exit;

    bu_out[0]:=$FE;
    bu_out[1]:=$5F;
    bu_out[2]:=by_idx;
    For i:=1 To d_len Do bu_out[i+2]:=Byte(sa_filename[i]);
    bu_out[d_len+3]:=0;
    If FT_Write(mogttlcd_usb_dev_handle,@bu_out,d_len+4,d_written)=FT_OK Then
    If d_written=d_len+4 Then
    If FT_Read(mogttlcd_usb_dev_handle,@bu_in,SizeOf(bu_in),d_read)=FT_OK Then
    If d_read=SizeOf(bu_in) Then
    If (PDWord(@bu_in)^=$01005FFC) And (bu_in[4]=GTT_eErrorCode_Success) Then
    Begin
      Result:=True;
    End;
  End;
End;
Please feel free to remove the PNG files from my post after you've downloaded them. I don't mean to promote any products or companies with them, they are just part of my LCD layout I've built for testing purposes.
Attachments
lcd_splash_color_640x223.png
lcd_splash_color_640x223.png (31.87 KiB) Viewed 3274 times
logo.png
logo.png (17.4 KiB) Viewed 3274 times

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: GTT Protocol Manual Rev 2.1 questions and issues

Post by Tino » Mon Jul 21, 2014 10:38 am

Hi,

Thank you for the image files.

From the look of it, there shouldn't be an issue uploading them.
When you upload the image try placing a longer delay between the upload of the images.

Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest