Skip to main content
ali_dehbidi
Associate III
March 18, 2021
Question

Why MX_TouchGFX_Process crashes!

  • March 18, 2021
  • 14 replies
  • 3489 views

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

[url=https://ibb.co/MV62hsP][img]https://i.ibb.co/swHmP2s/LCD1.png[/img][/url]

[url=https://ibb.co/Vgxpn4x][img]https://i.ibb.co/Lxrhj7r/LCD2.png[/img][/url]

[url=https://ibb.co/0cMt5rk][img]https://i.ibb.co/KXqwnWY/LCD3.png[/img][/url]

[url=https://ibb.co/VVrYCBb][img]https://i.ibb.co/6YV0tsG/LCD4.png[/img][/url]

[url=https://ibb.co/ypQnF3j][img]https://i.ibb.co/cwrchmn/LCD5.png[/img][/url]

[url=https://ibb.co/82GP2Qs][img]https://i.ibb.co/DkmwkjW/LCD6.png[/img][/url]

and here is the default code,

[code]

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 */

}

[/code]

What's going on wrong!

This topic has been closed for replies.

14 replies

franck23
Associate III
March 19, 2021

It could be plenty of reason, here is one that comes to mind:

Are you using an external memory to store images and text?

If you don't have external memory, check that TouchGfx Config tab => Default Image Configuration => Sectionand Extra Section are set to IntFlashSection.

ali_dehbidi
Associate III
March 19, 2021

Thanks for the feedback, I have corrected it, Now it would crash again!, But it would hang on the MX_TouchGFX_Process(); call, and it would not step out of it, when I hit stop in debug, it would just stop in some random function like this

[url=https://ibb.co/ph7wDzP][img]https://i.ibb.co/7kfCcWz/Untitled.png[/img][/url]

[url=https://ibb.co/pXtCtq5][img]https://i.ibb.co/KyMCMnS/Untitled2.png[/img][/url]

ali_dehbidi
Associate III
March 19, 2021

After several time experimenting with the code, and stopping it, It crashes again in HardFault_Handler , Now keil shows that setRenderingVariant has caused this! I have no clue!

[url=https://ibb.co/R9DYd60][img]https://i.ibb.co/t4JQF2s/Untitled3.png[/img][/url]

ali_dehbidi
Associate III
March 19, 2021

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.

[url=https://ibb.co/ZJXDKMC][img]https://i.ibb.co/GJpSk5j/Cache.png[/img][/url]

[url=https://ibb.co/5TKDz6S][img]https://i.ibb.co/6YXhpmT/Touch.png[/img][/url]

any Idea what's going wrong with the touch?

franck23
Associate III
March 19, 2021

From what I see on the Keil image, the setRenderingVariant function address is 0x00000000. To me, this means that the pointer to this function has not been initialized.

setRenderingVariant is used for D-caching.

I remember that it was some hardfault issues with TouchGfx when D-Cache was not enabled.

Try to enable D-Cache.

ali_dehbidi
Associate III
March 19, 2021

Thanks frank23 for the feedback, I have activated both the I-cache and D-cache, Now it works, But the problem is that the touch does not work?

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.

Please see the details in pictures in these links

[url=https://ibb.co/JkQnYdL][img]https://i.ibb.co/4NdWbfy/Cache.png[/img][/url]

[url=https://ibb.co/5TKDz6S][img]https://i.ibb.co/6YXhpmT/Touch.png[/img][/url]

ali_dehbidi
Associate III
March 20, 2021

I have found another problem, maybe this one is related to the touch too! I have made a simple screen transition to happen after 1S that does not need any touch, the transition occurs after about 30S !!! why is this happening? Note that my device is H750VB and the core clock is 480MHz and I have called SystemCoreClockUpdate(); before the call to MX_TouchGFX_Init(); and the SystemCoreClock value is 480000000, Also I have choosed the NO-OS option for the TouchGFX

franck23
Associate III
March 20, 2021

Yes, it could be related.

Your clock is running 30 times slower than you think.

Check that the quartz frequency on your board corresponds to the clock frequency in CubeMx => Clock Configuration.

Get an LED to blink once per second using HAL_Delay() to double-check the HAL tick frequency.

Then you should check your screen refresh rate.

Have a look at https://support.touchgfx.com/docs/development/board-bring-up/how-to/03-display-internal#check-the-framerate.

The screen refresh rate is used to clock the TouchGfx module, and how often the touchscreen function is called.

ali_dehbidi
Associate III
March 20, 2021

Dear Franck23, I have found the problem for the refresh rate, it was delayed because I was toggling an LED with some delay along calling the MX_TouchGFX_Process(); 

Now I have removed this additional routine and it works as expected, But Still I have no touch happening! my touch driver is working and I can get correct touch data coordinates, what might be wrong with the touch? why touchGFX does not respond to the touch events?

ali_dehbidi
Associate III
March 20, 2021

Dear Franck23 I have found the problem of touch and correct it, in a weird way, the touch data was like LCD data, But I had to change the coordinates like this in the code, so it would accept touch data as valid coordinates, my LCD is in portrait mode, so why should I change touch data?

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

Also I have another problem, I have made the screens to transition from one screen to the other one, But the transition almost happen instantly! why is this happening? I have measured my frame rate is 60Hz, and it has 16ms delay between each frame, How can I solve the transition speed? what might be wrong?