2021-08-10 09:34 PM
Hi,
MCU: STM32L072
MCU is using TSC and ST touch sense library.
When there is no stop mode involved, the measurement delta of no pressing is normal (-1, 0, 1).
If MCU enters stop mode and then exits stop mode for touch sensing measurement, the delta would be much higher (6, 7).
However, the delta would become normal again in following situation.
The clock setting should be the same because program would call SystemClock_Config() after exiting stop mode.
void EnterStopMode(void)
{
// Enable Ultra low power mode
HAL_PWREx_EnableUltraLowPower();
// Disable the fast wake up from Ultra low power mode
HAL_PWREx_DisableFastWakeUp();
// Select HSI as system clock source after Wake Up from Stop mode
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_HSI);
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
// In Stop mode
// Wake up
HAL_ResumeTick();
SystemClock_Config();
}
I would like to know why the TSC measurement need to wait a period of time after exiting stop mode in order to get normal reading.
Solved! Go to Solution.
2021-09-07 06:43 AM
John,
I reproduce and understand this behavior.
Find attached software example based on DISCO-L053.
Olivier
2021-08-25 02:19 AM
Hello John,
Can you share Measure, Reference and sampling capacitances values?
This can be due to incomplete charge/transfer/discharge cycles, ECS or parasitic capacitance:
// Get TSC/TSL keys status
TSL_obj_GroupProcess(&MyObjGroup);
// Point to first object
TSL_dxs_FirstObj(&MyObjGroup);
// Process ECS algo
if (TSL_tim_CheckDelay_ms(TSLPRM_ECS_DELAY, &ECSLastTick) == TSL_STATUS_OK){
TSL_ecs_Process(&MyObjGroup);
}
Regards.
2021-08-26 09:25 PM
Hi Olivier,
Touch setup:
Here is my test result:
The tricky part is that this would only happen after waking up from STOP mode. My program would make sure the touch measurement is completed before entering STOP mode.
2021-08-26 11:35 PM
John,
It looks like gpio parasitic capacitance is involved when we exit from STOP mode.
Usually Delta bellow 10 can be seen as noise (10% of Max value), Usual Delta value may reach 100..200.
To avoid this behavior I propose to set ECS and reset PROX. Doing this we will be able to adjust Ref on the fly.
In tsl_conf.h:
#define TSLPRM_ECS_K_SLOW (10*4)
#define TSLPRM_ECS_K_FAST (20*4)
#define TSLPRM_ECS_DELAY (500/5)
#define TSLPRM_USE_PROX (0)
In main.c:
while (1)
{
if(TSCAcqDone != 0){
myLedOn(LEDY);
TSCAcqDone = 0;
// Get TSC/TSL keys status
TSL_obj_GroupProcess(&MyObjGroup);
// Point to first object
TSL_dxs_FirstObj(&MyObjGroup);
// Process ECS algo
if (TSL_tim_CheckDelay_ms(TSLPRM_ECS_DELAY, &ECSLastTick) == TSL_STATUS_OK){
TSL_ecs_Process(&MyObjGroup);
}
// Application sensor processing
// Handle Led
for (IdLed=0; IdLed < TSLPRM_TOTAL_CHANNELS; IdLed++){
if(TKEY_DET(IdLed)){
myLedOn(IdLed);
}
else if(TKEY_REL(IdLed)){
myLedOff(IdLed);
}
}
// Restart all bank acquisition
TSCidxGroup = 0;
TSCAcqDone = 0;
// For FTB test, wait for 15ms
HAL_Delay(STMTBOX_WAIT_FOR_FFTB_TESTS);
TSL_acq_BankConfig(TSCidxGroup);
TSL_acq_BankStartAcq_IT();
myLedOff(LEDY);
// Handle STOP MODE......
}else{
__WFI();
}
}
2021-09-07 06:43 AM
John,
I reproduce and understand this behavior.
Find attached software example based on DISCO-L053.
Olivier
2021-09-07 06:30 PM
Thanks for the solution.