cancel
Showing results for 
Search instead for 
Did you mean: 

Why MX_TouchGFX_Process crashes!

ali_dehbidi
Senior

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!

14 REPLIES 14
franck23
Senior

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
Senior

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
Senior

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
Senior

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
Senior

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
Senior

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
Senior

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
Senior

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
Senior

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?