2025-06-26 2:39 AM
Greetings!
I am testing a touch button in a custom board using stm32u585 mcu.
I try to follow the following workshops available on YouTube:
Workshop 1
Workshop 2
The thing is, I tested in Debug Mode like in Workshop 1 in minute 15 and I could see the Delta value changing. Since the thing was working I try to implement the touch in my project. The thing is, now Delta is staying fixed, and I have absolutely no idea why it is happening. I can see the p_Data->StateId changing (PROX, DETECT, etc) but Delta value is the same. Any clue where I could be having the problem? I did not do the "MyTKeys[0].p_ChD->Delta /= 3;" in tsl_user.c, nor in the first test, and it worked at the first time.
So basically my code in main.c was something like this:
#include "tsl.h"
#include "touchsensing.h"
...
int main(void)
{
"ALL THE INITS"
tsl_user_Init();
tsl_user_status_t status;
while(1)
{
tsl_status = tsl_user_Exec();
if(tsl_status != TSL_USER_STATUS_BUSY)
{
if(MyTKeys[0].p_Data->StateId == TSL_STATEID_DETECT)
{
LED_TEST_SET;
}
/* else if(MyTKeys[0].p_Data->StateId == TSL_STATEID_PROX)
{
LED_TEST_SET;
} */
else
{
LED_TEST_CLR;
}
switch(tsl_status)
{
case TSL_USER_STATUS_BUSY:
break;
case TSL_USER_STATUS_OK_ECS_ON:
break;
case TSL_USER_STATUS_OK_NO_ECS:
break;
default:
break;
}
}
HAL_Delay(5);
}
2025-07-21 2:14 AM
Hello j_filipe ,
The easiest way to use the touch sensing is to take the example from the stmcube package available on st.com
https://www.st.com/en/embedded-software/stm32cubeu5.html#get-software
From the example you can easily setup the sensors.
Regards,
Stassen
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.