Go Down

Topic: High speed vector graphics engine. 3.2" TFT Lcd screen. (Read 22437 times) previous topic - next topic

kyildirim

hi there pYro_65,
are you following this topic, do you plan to share your results as you wrote?
regards,
K
Objects are what is unalterable and subsistent;
their configuration is what is changing and unstable.
L.W.

loctite

hi i tried the above library it is much faster wow but.
i do have a problem i use 2 interupts pin 18 and 19 for my speedometer and rev counter

,the code and pins work fine with hennings library , is there anyway to fix this again .
please would be great to use the extra speed i am making a trip computer , for a car ,
i use  hall sensors to get trigger from wheel and camshaft , via interupts ,

also i sense inject pulse via a optocoupler , i had all this working on my 128x64 glcd but decided i wanted touch and touch start ,

please please any ideas thanks

Hernexto

Hi,

I know this topic is a bit old, but... has the pyro_65 work been lost or with mäel optimization is just 'enough' improvement?

I see pyro_65 is still quite (a lot) active in the forum...

pYro_65

No, my work isn't lost. Its just unfinished on an old hard drive. I have lots of things happening at the moment however I do want to put the parts I did finish up on my website one day.

I'll have to dig out the hard drive, however there were some problems with the library. It only works on certain SSD1289 displays. Some versions use different resistors in the COG panel and cannot use some of its features. I have a few programs using the library now, so it is not lost yet.


Deltoz


Here is my UTFT version with optimizations speed of execution and ROM space used.

BE CAREFUL : It's work only with SSD1289 screen on Arduino Mega.
Screen : SainSmart 3.2" TFT LCD Display+Touch Panel+PCB adapter SD Slot for Arduino 2560,
Shield : SainSmart TFT LCD Adjustable Shield for Arduino Mega 2560 R3 1280 A082 Plug.

To optimize I examined the most frequently used functions.
For example:
drawPixel calls SetXY, SetXY makes a test on the target screen and calls LCD_Write_COM, it calls LCD_Write_COM and LCD_Write_DATA, they test the type of transfer and call LCD_Writ_Bus. LCD_Writ_Bus tests the type of target screen and then writes the data to the destination ports of the screen !!!
LCDxxx methods are called very often then it is they need to optimize.
I remove the tests "switch (mode)" or "if (display_transfer_mode! = 1)", which become useless if I still have the same screen.
I'm simplifying and removing cascades calls are expensive (passing parameters to the stack, context switching, etc.).

In the zip archive, I put a new example : Bench.ino (use this one to test), I removed some tools.

I also made a mode "x terminal" which sending display information to the serial port.
I wrote a program (in C #) that runs on the PC, he receives display information and draws on the PC screen: this is a simulator screen.
I left this feature in the code archive. It is off by a compiler directive (so this code is disabled).
Example :

Code: [Select]

void UTFT::drawPixel(int x, int y)
{
//don't worry about this code. this code is not compiled (Terminal_x not defined)
#ifdef TERMINAL_X
 //terminal x
 //0x81 [ID], [size], [datas]  
 uint8_t Trame[7];
 Trame[0] = 0x81; //ID de Terminal X
 Trame[1] = sizeof(Trame)-1; //taille de la sous-trame (à partir de cet endroit, on compte la size mais pas l'ID termX
 Trame[2] = TX_DRAWPIXEL; //ID ordre d'aff pixel
 Trame[3] = x >> 8; //MSB x1
 Trame[4] = x; //LSB x1
 Trame[5] = y >> 8;
 Trame[6] = y;
 Serial.write(Trame, sizeof(Trame));
 //return;
#endif
...


If anyone is interested, I can share my C # program...
I preferred share code in the current state, because if I take the time to clean it before, it will never be perfect and finally I will send nothing  ;)

Finally, Perhaps the best is make a depot GIT.
I hope that pYro_65 will could give us his optimizations or ideas for a common version. :)

(Sorry if I speak bad English, I took lessons ;) )

bye.
Maël.


hello Mael, I am using your optimized  library and I congratulate you because it's really fast.
But I have a problem, with the original UTFT I used also  libraries UTFT_tinyFAT and UTFT_Geometry while your library can not use them, it gives me an error. You probably need to be changed.
Can you help me somehow?
Or is there someone else who can help me?
thanks
Excuse me for my LITTLE English  :*

Hernexto

I just tried Mael library version but... just... white screen, nothing more. I think my LCD is the same as yours. Any help?

Anyway I got those results (As I cannot see anything drawn I'm not sure if they can be trusted):
ready.
start...
37252 us : clrScr
24 us : DrawPixel
228 us : DrawPixel x 10
8 us : SetColor
8 us : SetBackColor
5800 us : FillRoundRect 40x40
636 us : DrawRoundRect 40x40
916 us : drawLine 40x40
152 us : draw Vertical Line 40
144 us : draw Horizontal Line 40
1484 us : FillRect 40x40
8 us : SetSmallFont
2300 us : Print 001
2300 us : Print Abc
2584 us : printNumI(123)
12 us : SetBigFont
4336 us : Print 001
4420 us : printNumI(123)
2416 us : draw bitmap 32x32
16 us : Touch Screen DataAvailable
40 us : Touch Screen Read
16 us : Touch Screen getX, getY
finish in 84308 us.


With the original library:

ready.
start...
114588 us : clrScr
212 us : DrawPixel
2064 us : DrawPixel x 10
12 us : SetColor
8 us : SetBackColor
14500 us : FillRoundRect 40x40
2244 us : DrawRoundRect 40x40
4160 us : drawLine 40x40
472 us : draw Vertical Line 40
472 us : draw Horizontal Line 40
4368 us : FillRect 40x40
16 us : SetSmallFont
7396 us : Print 001
7212 us : Print Abc
7468 us : printNumI(123)
8 us : SetBigFont
13552 us : Print 001
13676 us : printNumI(123)
11084 us : draw bitmap 32x32
16 us : Touch Screen DataAvailable
40 us : Touch Screen Read
16 us : Touch Screen getX, getY
finish in 217392 us.


pYro_65, I would like you to consider to just post your library as it is. You/We can always improve it later :)

by the way... has anybody seen this? Seems very related: http://gizmogarage.net/c-vs-assembler-performance-on-avr/


robtillaart


I just tried Mael library version but... just... white screen, nothing more. I think my LCD is the same as yours. Any help?

Anyway I got those results (As I cannot see anything drawn I'm not sure if they can be trusted):
...
pYro_65, I would like you to consider to just post your library as it is. You/We can always improve it later :)

by the way... has anybody seen this? Seems very related: http://gizmogarage.net/c-vs-assembler-performance-on-avr/

factor 2.5 is not bad, pity it didn't show anything.
imho you can trust these numbers (90% confidence) as they are not that extreme faster (even one slower)

Bookmarked that gizmogarage video. (awesome)
But as the author says it is generic code versus optimized dedicated code.
Really useful when you have a need for speed!
thanks for that link.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

MichaelMeissner

I dunno, if you have a need for speed, the first thing you should do is move up to a faster processor.  You can get Arm processors that support the Arduino libraries that run 4-8 times faster than a Mega (Teensy 3.1 runs at 96Mhz compared to 16Mhz for the Mega, and given the Teensy is a 32-bit processor, it means it does things in fewer cycles, which gives you an additional boost in speed).

Then if you are willing to change platforms, the Linux SBC's (single board computer) will run much, much faster, and they have hardware floating point in case you need it (Beaglebone Black runs at 1Ghz, Rasberry Pi at 700Mhz).

robtillaart

agree, but imho part of the Arduino fun is to get "most" speed from a "slow" processor
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

hampf

@Hernexto: Are you sure that you used the right init for the TFT?

I had to replace
Code: [Select]
UTFT myGLCD(0);
with
Code: [Select]
UTFT myGLCD(ITDB32S,38,39,40,41);

to get it working. I also had to add one "nop" in HW_AVR_defines.h to remove some unwanted glitch:

Code: [Select]
#define pulse_low_WR PORTG &= ~(1<<2); __asm__ volatile ("nop"); __asm__ volatile ("nop"); __asm__ volatile ("nop"); __asm__ volatile ("nop"); PORTG |= (1<<2)

BTW: I have tried to merge Maels extensions with the 2.75 version of Henning Karlsens UTFT to get UTFT_tinyFAT working and so that I can use
Code: [Select]
myGLCD.setBackColor(VGA_TRANSPARENT);

I have tested my result with Hennings "UTFT_Demo_320x240", Maels "Bench" and my own little Demo that uses SD card access with UTFT_tinyFAT and UTouch as well as UTFT. My attached version includes the additional "nop" already. Works fine for me, maybe you find it useful as well.

Maels "Bench" runs in 91720 usec instead of 217292 usec.

Duiker

hampf,

I tested your UTFT_optimised_275 library. This are my results with the "Bench" test.

ready.
start...
209900 us : clrScr
24 us : DrawPixel
196 us : DrawPixel x 10
12 us : SetColor
8 us : SetBackColor
5848 us : FillRoundRect 40x40
628 us : DrawRoundRect 40x40
800 us : drawLine 40x40
148 us : draw Vertical Line 40
144 us : draw Horizontal Line 40
1648 us : FillRect 40x40
8 us : SetSmallFont
2372 us : Print 001
2380 us : Print Abc
2652 us : printNumI(123)
8 us : SetBigFont
4552 us : Print 001
4648 us : printNumI(123)
2368 us : draw bitmap 32x32
16 us : Touch Screen DataAvailable
32 us : Touch Screen Read
16 us : Touch Screen getX, getY
finish in 257644 us.

I am most interested in the clrScr function. It is a lot faster as before. But your Bench test says the clrScr function is about 37252 us. That is a lot faster as here. I use a ATMEGA 2560 board.

Is there something i can do to speed this up?

Leon.

Go Up