Skip to main content
canbu22
Associate III
December 6, 2018
Solved

Is high speed waveform display feature possible in TouchGFX?

  • December 6, 2018
  • 26 replies
  • 6339 views

Is there a template or a sample application that one can use to develop fast running waveform display feature in TouchGFX? (such as that of a oscilloscope waveform display and not a static or slow speed 1-dim graph display)

if not any suggestions? ..thanks..

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Hi canbu,

Could you define what you mean by fast-running? How large of a display and how large of a wave-form are we talking about? It's definitely possible, but depending on your needs, this may require a custom Widget that draws directly into the framebuffer; Something we've done for customers in the past to deliver specialized waveform/graph screens. We have examples of how to do standard graphs, but these are antialiased "Canvas" objects while drawing pixels straight into the framebuffer using interpolation could be faster.

Edit: Here's a simple application that shows how to use the Canvas Graph.

http://sw-center.st.com/touchgfx/TouchGFX/Community/GraphApplication.zip

Let me know!

Best regards,

Martin

26 replies

IB.1
Associate III
April 14, 2020

Hi @Martin KJELDSEN​ 

Thank you for your reply. We have modify TouchGFXConfiguration.cpp file by adding follow code to the touch_gfx_init() function

void touchgfx_init()
{
 Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(), BitmapDatabase::getInstanceSize());
 TypedText::registerTexts(&texts);
 Texts::setLanguage(0);
 
 FontManager::setFontProvider(&fontProvider);
 
 FrontendHeap& heap = FrontendHeap::getInstance();
 (void)heap; // we need to obtain the reference above to initialize the frontend heap.
 
 hal.initialize();
 
	#define CANVAS_BUFFER_SIZE (3600)
 static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
 CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
 
}

But it seems it didnt really helped. as soon as we enable:

Graph graph;

application crashes. Can you please advise if there is/are anything else we should look at.

Thank you for all your support.

Regards,

IB

Martin KJELDSEN
Principal III
April 14, 2020

Please beware that you're modifying a file in the "generated/" folder which will get overwritten if you should generate code from CubeMX again.

That being said, are you debugging? What's the application doing when it crashes?

/Martin

IB.1
Associate III
April 14, 2020

Hi @Martin KJELDSEN​ 

Thank you for reply.

Very good point on modifying "generated" files, at this point I just want to get it running.

here the screen shot from debugger when application ""crashed"

0693W000000VoZmQAK.jpg

Tracing it back:

0693W000000VoZwQAK.jpg

0693W000000Voa6QAC.jpg

0693W000000VoaGQAS.jpg

0693W000000VoaQQAS.jpg

While was typing I was thinking should I place any canvases or any other "UI elements" on screen while generating tuch GFX project?

Anything else I can provide you with? Please advise...

Thank you for all the support

Regards,

IB

Dejan Nedeljkovic
Associate III
April 15, 2020

Hi

Did you adapt the painter to your system?

I had a similar behaviour and then I changed from PainterRGB565 to PainterRGB888 in Graph.hpp.

It depends on your TouchGFX settings which painter class to use.

Regards

Dejan

Martin KJELDSEN
Principal III
April 15, 2020

This is also a very good point. The LCD class will assert if the format is not correct. People tend to copy the Graph from project to project without considering the pixel format.

/Martin

IB.1
Associate III
April 15, 2020

Hi @Martin KJELDSEN​ @Dejan Nedeljkovic​ 

This is definitely helps and I can see simple graph on the screen... Thank you for all your help.

Question what I have, how would you recommend to declare frame buffer without modifying "generated" files (TouchGFXConfiguration.cpp)

ie

void touchgfx_init()
{
 Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(), BitmapDatabase::getInstanceSize());
 TypedText::registerTexts(&texts);
 Texts::setLanguage(0);
 
 FontManager::setFontProvider(&fontProvider);
 
 FrontendHeap& heap = FrontendHeap::getInstance();
 (void)heap; // we need to obtain the reference above to initialize the frontend heap.
 
 hal.initialize();
 
#define CANVAS_BUFFER_SIZE (3600)								
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];							
CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);		
}

Thank you very much for all your help and support.

Regards,

IB

Dejan Nedeljkovic
Associate III
April 15, 2020

You can set the canvas buffer size in TouchGFX.

Select the Screen where your graph should be drawn and then you can set the canvas buffer to another value:

0693W000000Vs9xQAC.png

IB.1
Associate III
April 15, 2020

Thank you Gentlemen for all your Help