Hello,
Do not forget to update also GPIO settings in HAL_TSC_MspInit api.
HAL_TSC_MspInit should be located in stm32u5xx_hal_msp.c (for U5 example).
Regarding HAL_TSC_ErrorCallback source
Usually this api is called by driver on error cases. See stm32u5xx_hal_tsc.c file comments:
[..]
This function allows to reset following callbacks:
(+) ConvCpltCallback : callback for conversion complete process.
(+) ErrorCallback : callback for error detection.
(+) MspInitCallback : callback for Msp Init.
(+) MspDeInitCallback : callback for Msp DeInit.
This api is called by Interrupt handler (HAL_TSC_IRQHandler) in our case.
If you need to update or rewrite HAL_TSC_ErrorCallback code, copy paste this code:
__weak void HAL_TSC_ErrorCallback(TSC_HandleTypeDef *htsc)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(htsc);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_TSC_ErrorCallback could be implemented in the user file.
*/
}
into your main.c file without "__weak" keyword:
void HAL_TSC_ErrorCallback(TSC_HandleTypeDef *htsc)
{
my own way to handle errors
}
Regarding TKEY capacitance
You mean the Sensor capacitance or the Sampling capacitance?
Usually sensor capacitances around few pF (from 2pf to 15pF I will says).
Some tools allow to compute this value according PCB and overlay materials.
(See SENSE tool from Fieldscale for example).
Usually Sampling capacitance are from 10nF to 47nF.
See AN5105 "Getting started with touch sensing control on STM32 microcontrollers" for intormation.
Regards.