Skip to main content
Louie88
Senior
August 10, 2021
Solved

How to enable touch screen interrupt in STM32H747I-DISCO board?

  • August 10, 2021
  • 1 reply
  • 1709 views

Hi,

I created a touch screen initialization function. The touch screen works just fine if a I poll the TS_State.TouchDetected flag. If I enable the touch interrupt from the initialization function I get a compiler error message:

uint32_t InitializeTouchScreen(void)
{
	TS_Init_t hTS;
	uint32_t ts_status;
 
	hTS.Width = LCD_GetXSize();	//800;
	hTS.Height = LCD_GetYSize();	//480;
	hTS.Orientation = TS_SWAP_XY | TS_SWAP_Y;
	hTS.Accuracy = 0;
	ts_status = BSP_TS_Init(0, &hTS);
	// Enable touch IT
	BSP_TS_EnableIT(0);
	return ts_status;
}

The error message:

... stm32h747i_discovery_ts.c:252: undefined reference to `HAL_EXTI_GetHandle'...

The "stm32Cube-bsp-drivers.pdf" manual does not help. It just lists the interrupt enable function but there is no explanation how to use it.

I also wonder how I can detect the touch interrupt (once it compiles). It is a GPIO pin in the HAL_GPIO_EXTI_Callback() callback function, GPIO PK.7, I guess:

// stm32h747I_discovery_ts.h line 88
#define TS_INT_PIN ((uint32_t)GPIO_PIN_7)
#define TS_INT_GPIO_PORT ((GPIO_TypeDef*)GPIOK)

Thank you for your help!

Louis

This topic has been closed for replies.
Best answer by Mike_ST

Hello,

>> undefined reference to `HAL_EXTI_GetHandle'...

Please check that you are actually compiling the stm32h7xx_hal_exti.c file.

And uncommented the #define HAL_EXTI_MODULE_ENABLED line in stm32h7xx_hal_conf.h

>> also wonder how I can detect the touch interrupt (once it compiles)

After you called BSP_TS_EnableIT(0), in stm32h7xx_it.c you can define EXTI9_5_IRQHandler to catch interrupts from GPIOK Pin 7.

1 reply

Mike_ST
Mike_STBest answer
Technical Moderator
August 10, 2021

Hello,

>> undefined reference to `HAL_EXTI_GetHandle'...

Please check that you are actually compiling the stm32h7xx_hal_exti.c file.

And uncommented the #define HAL_EXTI_MODULE_ENABLED line in stm32h7xx_hal_conf.h

>> also wonder how I can detect the touch interrupt (once it compiles)

After you called BSP_TS_EnableIT(0), in stm32h7xx_it.c you can define EXTI9_5_IRQHandler to catch interrupts from GPIOK Pin 7.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
Louie88
Louie88Author
Senior
August 10, 2021

Thanks Mike, excellent notes. Touch IT works just fine based on your suggestions.

Many thanks for your help.

Louis