Skip to main content
Rohit.1
Associate III
April 3, 2020
Question

Gauge application working directly from touchgfx but not working when trying to run it through STM32CubeIDE. Please help to solve this issue

  • April 3, 2020
  • 21 replies
  • 5046 views

..

This topic has been closed for replies.

21 replies

Alexandre RENOUX
Visitor II
April 15, 2020

Hello,

I know it has been a while and sorry for that...

Could please elaborate your issue ? What board do you use ? What is the Gauge application you are talking about ?

What is the setup when it is working and when it is not with CubeIDE ?

This way we will be able to give you a proper answer.

/Alexandre

Rohit.1
Rohit.1Author
Associate III
April 15, 2020

Thanks for the reply.

I am talking about the application given on the link below:

https://github.com/touchgfx/touchgfx-open-repository/tree/master/widgets/Gauge

Using STM32F746G-DISCO board, STM32CubeIDE v1.2.0 and TouchGFX v 4.13.0

When implemented this Gauge example using TouchGFX directly then it worked.

But after adding same thing from STM32CubeIDE then the screen on which added this widget is not responding and the whole application freezes.

Alexandre RENOUX
Visitor II
April 16, 2020

Hello,

When you say adding the same thing from CubeIDE, what exactly did you do ?

Are you using the AT 3.0.0 STM32F746G-DISCO available in TouchGFX Designer ?

I need more information to help you with your problem.

/Alexandre

Rohit.1
Rohit.1Author
Associate III
April 17, 2020

Yes I am using the AT 3.0.0 STM32F746G-DISCO available in TouchGFX Designer

I followed the procedure given on the link below:

https://www.youtube.com/watch?v=12KXreXaLp0

then added Gauge.cpp and Gauge.hpp files in the screen1_screen generated under TouchGFX/gui/ in the STM32CubeIDE.

Below is my Screen1View.hpp

#ifndef SCREEN1VIEW_HPP
#define SCREEN1VIEW_HPP
 
#include <gui_generated/screen1_screen/Screen1ViewBase.hpp>
#include <gui/screen1_screen/Screen1Presenter.hpp>
#include <gui/screen1_screen/Gauge.hpp>
class Screen1View : public Screen1ViewBase
{
public:
 Screen1View();
 virtual ~Screen1View() {}
 virtual void setupScreen();
 virtual void tearDownScreen();
protected:
 Gauge MyGauge;
private:
 static const uint16_t CANVAS_BUFFER_SIZE = 7200;
 uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
};
 
#endif // SCREEN1VIEW_HPP

Basically tried to add Gauge widget in the generated project.

Alexandre RENOUX
Visitor II
April 17, 2020

Hello,

To me the Youtube video you are referring to is a strange way to get the code up and running with CubeIDE.

Please follow these steps:

  • Open Designer and select the AT v3.0.0 STM32F746G-DISCO
  • Generate code from Designer
  • Copy the Gauge.cpp and .hpp files respectively in TouchGFX\gui\src\common and TouchGFX\gui\include\gui\common
  • Modify your Screen1View.cpp and .hpp accordingly
  • You should have a folder called STM32CubeIDE/, enter this folder.
  • Double-click on the .project, it will open the project in CubeIDE
  • Include Gauge.cpp in your project by clicking and dragging the file from your Windows explorer to the folder architecture on the left (now CubeIDE knows that this file needs to be compiled)
  • Build project
  • If any errors, please post it here to see what's the problem

/Alexandre

Alexandre RENOUX
Visitor II
April 20, 2020

Hello,

It looks like you can build the project correctly but you cannot download the binary file and debug (correct me if I'm wrong). It seems to me that it's a problem related to your ST-Link or your launch configuration. 

Can you check your launch configuration (right-click on project > Properties > Run/Debug settings > Edit) ?

/Alexandre

Rohit.1
Rohit.1Author
Associate III
April 20, 2020

0693W000000W5aIQAS.bmp

This is my debug setting.

This setting works with my other projects.

Alexandre RENOUX
Visitor II
April 20, 2020

Hello,

The Debug probe should be ST-LINK (ST-LINK GDB server) and then enable external loader and select the correct one as shown below.

0693W000000W5jaQAC.png

You can also uncheck "Verify Flash Download" to accelerate the download process.

/Alexandre

Rohit.1
Rohit.1Author
Associate III
April 20, 2020

Now followed the exact steps mentioned by you.

Following is the problem:

0693W000000W7WSQA0.bmp

Rohit.1
Rohit.1Author
Associate III
April 20, 2020

I think I have figured out the solution for above mentioned problem.

Added startup_stm32f746nghx.s file from gcc folder to Application/User folder in the STM32CubeIDE.

But now we are again at the initial stage. Screen on which Gauge widget is added is not responding and the whole application freezes after loading this screen.

Alexandre RENOUX
Visitor II
April 21, 2020

Hello,

Indeed there's a issue with AT as the Application/ folder in STM32CubeIDE/ should have files inside.

  • STM32CubeIDE/Application/StartUp/startup_stm32f746nghx.s
  • STM32CubeIDE/Application/User/syscalls.c
  • STM32CubeIDE/Application/User/sysmem.c

We will try to correct this issue quickly.

You will find syscalls.c and sysmem.c in the attached archive.

After putting the files in the correct location, try running your application again.

I don't have the board with me so I cannot debug on my side. Please if it crashes or freezes, try to debug (with breakpoints if necessary) and see where is it failing so that I can try to find the reason.

/Alexandre

Rohit.1
Rohit.1Author
Associate III
April 21, 2020

After adding these files when application freezes it executes the following function from syscalls.c file:

void _exit (int status)

{

_kill(status, -1);

while (1) {} /* Make sure we hang here */

}

And as you mentioned application hangs at while(1){}

Alexandre RENOUX
Visitor II
April 22, 2020

Hello,

Can you show the call stack ?

/Alexandre

Alexandre RENOUX
Visitor II
April 27, 2020

Hello,

You can find the implementation of the gauge in the TouchGFX Demo 1 in TouchGFX Designer. This will probably help you with the implementation.

Can you try running the TouchGFX Demo 1 on your board ? If it works, this indicates that your gauge implementation is wrong. Otherwise, if it also freezes, it means that the AT is wrong.

Can you also check if you have the following USE_BPP=24 in your project ? If not please add it

0693W000000WUK0QAO.png

/Alexandre

Rohit.1
Rohit.1Author
Associate III
April 28, 2020

After adding the USE_BPP=24, TouchGFX Demo 1 worked through STMCubeIDE.

But then created new project in the touchGFX with balnk UI Template and added Gauge files as you mentioned previously.

This code hangs at void _exit (int status) function from the syscalls.c file.

Increased heap size to 0x2000 also set canvas buffer size to 7200.

USE_BPP=24 is also added.

Attached my application.

Rohit.1
Rohit.1Author
Associate III
April 30, 2020

Is there anything missing in this application. I am trying hard to make it work but no success.

Please help.

Alexandre RENOUX
Visitor II
May 1, 2020

Hello,

There were a few problems in your project.

First, the assets of the gauge were not the right size. You have a screen 480*272 and you want to fit a picture 359*359. Not possible.

0693W000000WmTUQA0.png

Second, the AT is 24bpp but the painter used for the gauge was a Painter565 which makes the application crashed. Did you try to run the simulator ? Because it was explicitly mentioned. Therefore I changed the painter to Painter888 (look at the variables in Gauge.hpp).

I also made a few changes to your Screen1View files because you were asking the needle to turn every 16 ms by 10 which would have a really strange behavior.

You will find enclosed the corrected project working (tested with gcc and CubeIDE).

Hope this will help you move forward in your project.

/Alexandre

Rohit.1
Rohit.1Author
Associate III
September 4, 2020

Thank You very much.

It is worked. :smiling_face_with_smiling_eyes:

Now I have developed a custom board using STM32F746BGTx. Using all other components same as on the STM32F746G-Disco board.

But some pins are changed. Can I use my existing project file which was created for STM32F746G-Disco board by matching the pins with new custom board.