cancel
Showing results for 
Search instead for 
Did you mean: 

Touc sense

Ephraimoved
Associate III

Dear Sir.

I migrated the code of TSV_BasicAcquisition_Interrupt to my board .

The IO rae different than the example

Example Custom Board,

PC7 PB6

PC6 PB5

PB13 PB12

PB14 PB13

I keep getting HAL_TSC_ErrorCallback,

  1. How can I tell the source of the HAL_TSC_ErrorCallback .
  2. I ist possible to calculate the capacitance of the TKEY ?.
  3.  

Please Advise.

1 ACCEPTED SOLUTION

Accepted Solutions
OlivierR
ST Employee

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.

View solution in original post

2 REPLIES 2
OlivierR
ST Employee

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.

Ephraimoved
Associate III

Hi

Thanks it is working