Author Topic: Why MX_TouchGFX_Process crashes  (Read 3658 times)

0 Members and 1 Guest are viewing this topic.

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 2155
  • Country: ca
Why MX_TouchGFX_Process crashes
« on: March 18, 2021, 08:07:20 pm »
Hi,
I'm using keil MDK V5.34 and touchGFX V 4.16.1 , I made a minimal project with these settings using LTDC, and a simple default project, But the problem is that when the MX_TouchGFX_Process is called, the MCU crashes! what's going on wrong?
any Ideas








and here is the default code,

Code: [Select]
int main(void)
{
  /* USER CODE BEGIN 1 */
  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

/* Configure the peripherals common clocks */
  PeriphCommonClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_ADC1_Init();
  MX_I2C1_Init();
  MX_I2S1_Init();
  MX_LTDC_Init();
  MX_SPI4_Init();
  MX_TIM14_Init();
  MX_UART8_Init();
  MX_USART2_UART_Init();
  MX_USB_OTG_FS_PCD_Init();
  MX_USB_OTG_HS_HCD_Init();
  MX_DMA2D_Init();
  MX_CRC_Init();
  MX_TouchGFX_Init();
  /* USER CODE BEGIN 2 */
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

  MX_TouchGFX_Process();
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

What's going on wrong!
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 529
  • Country: ca
Re: Why MX_TouchGFX_Process crashes
« Reply #1 on: March 19, 2021, 05:17:14 pm »
Hi Ali. I have been active on the TouchGFX forum on the ST website. Have written some documentation on this toolchain based on mixed experiences but did manage to get it working enough for us to move forward with our embedded GUI interest.

As per my post on that forum,

suggest highly for you to consider your order of operations. Allow for their wizard to do the heavy work since they understand it best. As I always say, the code and procedure is written in a format that only twins will understand.

So,

1) Start a fresh project by launching the TouchGFX toolchain FIRST. This is the secret to it all. The latest release of their tools is quite nice but still needs a bit of hoop jumping on one leg while throwing black pepper over your left shoulder (not the right shoulder!).

2) Select the STM32H750B-DK in their displayed hardware kits. If your target CPU does not appear in the list then you really should post your interest in the forum and hope that one of the developers will offer the steps to enter this new world. Personally recommend highly to choose a CPU that is supported through their kit and code from there. We are experimenting with MIPI displays and starting to get our comfort level up but using a Solomon parallel to MIPI bridge device.

3) After selecting the above kit -> go to Edit pull-down menu on the top left -> Import Gui -> select the digital and analog watch / clock demo that is shown as an example.

4) Then select Run Simulator button on the top right of the screen. Does this compile and run the simulation of this analog and digital clocks ? They should. Exit this simulator and now select Generate Code. This will build again and do so without errors.

5) Once the Generate Code finishes -> go to the very bottom right of the same screen and select the Browse Code button / icon. Now you should see the folder that has been created with the wizard generated files to create this same GUI.

6) The file manager will show you the TouchGFX sub-folder. Go up one folder and note the file for the STMCube32MX tool. Double-click this file and this will launch the STMCube32MX tool. Allow for any imports / dependency file downloads. Go to Project Manager -> Leave the compiler to the default toolchain - found that the STMCubeIDE works while Keil / IAR failed when we tested it last. Proceed to Generate Code.

This process should allow you to build the same sample project and respectively so you can test on your target hardware (hoping that you have the same ST kit). It is worthwhile to do so for writing your own code.

Only once this is working should you proceed to alter and customize the project to build your own.

Hope this helps. If in a pinch, believe we have this same kit in the building for testing.
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 2155
  • Country: ca
Re: Why MX_TouchGFX_Process crashes
« Reply #2 on: March 19, 2021, 07:51:31 pm »
Dear mon2 thanks for the feedback, Actually it's a custom made PCB with a custom LCD for the STM32H750VB part, I have successfully written the SPI LCD driver code and switched it to parallel RGB interface, and luckily I managed to bring the TouchGFX up one time, But I made a simple change and change some IO in my project that was not related to LCD and regenerate the code, Now nothing works, even I bring back the change and nothing works again |O |O |O
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 2155
  • Country: ca
Re: Why MX_TouchGFX_Process crashes
« Reply #3 on: March 19, 2021, 08:56:57 pm »
I made some progress, I have enabled the caches on The Core in Cube, Now everything is working and the call to MX_TouchGFX_Process(); would do the process and passes, and it shows the first screen, But when I touch the LCD nothing happens! I have checked the Touch driver, it's working as expected and it would return correct coordinates respect to touch point.

 





any Idea what's going wrong with the touch?

ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 529
  • Country: ca
Re: Why MX_TouchGFX_Process crashes
« Reply #4 on: March 21, 2021, 02:04:19 pm »
https://support.touchgfx.com/docs/development/board-bring-up/how-to/09-touch-controller

What is the i2c bus address for your touch controller?

When a touch action is made on your panel, do you see i2c bus activity for this i2c slave?

Suggest to place a bus analyzer onto your i2c master port pin to confirm.
« Last Edit: March 21, 2021, 02:07:40 pm by mon2 »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6940
  • Country: es
Re: Why MX_TouchGFX_Process crashes
« Reply #5 on: March 21, 2021, 05:13:44 pm »
If he says the driver returns the correct coordinates, the I2C is clearly working?
Otherwise it would report nothing.

If I understand correctly "FT6336G_GetTouch" returns valid data (result, x , y).
Specially, check "result". The controller can read any coordinates, but if the result is not valid, it will discard everything.

I would follow the program to see where it goes, what happens to "result" and where are the "x, y" values used.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 2155
  • Country: ca
Re: Why MX_TouchGFX_Process crashes
« Reply #6 on: March 21, 2021, 08:46:00 pm »
Thanks for the feedbacks, I have made progeress, the Touch controller was working correctly and it was returning correct touch coordinates, I have rotated my LCD with some SPI commands before taking control with LTDC (The LCD controller is ili9488) , and I needed to adjust the new touch data with these values

Code: [Select]

*x = 320 - touchx;
*y = 480 - touchy;

Now it's working, But I have a few other weird new problems!
The first one is that I have made two screens each with a single button, and I made the screens move with slide transition, But the transition does not happen smoothly, it would just switch to the second screen almost instantly, (but it works as expected in the simulation) |O

Also, since I have not used any OS yet, when I use some HAL_Delay before calling MX_TouchGFX_Process(); the MCU crashes into HardFault_Handler() ! :'( |O

And the last one is I have coded an analog clock with the handleTickEvent() in one of the screens and it's working, But it works very fast! I have measured the LTDC_IRQHandler time and it's 16ms or 60Hz refresh time, maybe I got the handleTickEvent more than 60Hz because I could only use 1 frame buffer, because of the Limited internal ram of H750VB and my LCD is 480X320,

lastly, I got this nasty crash, when I change my analog clock with a digital one, the text rendering of the digital clock would crash to HardFault_Handler()! :palm:

It has these new problems, do you have any Idea what is going on wrong?

ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6940
  • Country: es
Re: Why MX_TouchGFX_Process crashes
« Reply #7 on: March 21, 2021, 10:32:29 pm »
Maybe you're running out of heap? Increase it in CubeMX project settings and try again...
I had a lot of trouble with malloc(), returning a correct address when it shouldn't.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 2155
  • Country: ca
Re: Why MX_TouchGFX_Process crashes
« Reply #8 on: March 22, 2021, 07:52:19 am »
Thanks david, I have increased the heap and now it would not crash, But still the screen transitions does not work, do you have any clue?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6940
  • Country: es
Re: Why MX_TouchGFX_Process crashes
« Reply #9 on: March 22, 2021, 08:59:13 am »
No idea... Didn't use touchgfx yet.
Although it caught my attention long time ago, will try it in my 429 discovery some day.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->