2020-05-20 02:31 AM
In Group 1 G1_IO4 is a sampling capacitor and G1_IO3 is a sheild and in Group 2 G2_IO2 is sampling capacitor and G2_IO1 is input touch key. In Group 3 G3_IO4 is a sampling capacitor and G3_IO2 is a input touch key. so when i programmed with this configuration it detect touch from the shield not from the touch keys.
My touch key code is this
if(MyTKeys[0].p_Data->StateId == TSL_STATEID_DEB_RELEASE_DETECT)
{
HAL_GPIO_WritePin(LED2_GPIO_Port,LED2_Pin,RESET);
HAL_GPIO_WritePin(LED1_GPIO_Port,LED1_Pin,SET);
}
if(MyTKeysB[1].p_Data->StateId == TSL_STATEID_DEB_RELEASE_DETECT)
{
HAL_GPIO_WritePin(LED2_GPIO_Port,LED2_Pin,SET);
HAL_GPIO_WritePin(LED1_GPIO_Port,LED1_Pin,RESET);
}
Please give me the solution why the touch detect from shield not form Touch keys.
2020-05-20 03:42 AM
any solution please ????
2020-07-17 04:46 AM
See reply here. Active shield can not be used as a sensor. Active-shield increase sensor sensitivity and protect against noise.
https://community.st.com/s/question/0D53W000007Y5LfSAK/stm32wb55-tsc-is-not-working
Regards.
2020-08-30 07:09 AM
Hello!
The example code is doing really well, if you just use 3 channel and 1 sampling.
****************
MX_TOUCHSENSING_Init();
/* USER CODE BEGIN 2 */
tsl_user_Init();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
//start polling
HAL_TSC_Start(&htsc);
**************
tsl_status = tsl_user_Exec();
if(tsl_status != TSL_USER_STATUS_BUSY)
{
Process_Sensors(tsl_status);
}
**************
void Process_Sensors (tsl_user_status_t status)
{
if (MyTKeys[0].p_Data->StateId == TSL_STATEID_DETECT)
{
HAL_GPIO_WritePin(LD1_GPIO_Port,LD1_Pin,GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(LD1_GPIO_Port,LD1_Pin,GPIO_PIN_RESET);
}
if (MyTKeys[1].p_Data->StateId == TSL_STATEID_DETECT)
{
HAL_GPIO_WritePin(LD3_GPIO_Port,LD3_Pin,GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(LD3_GPIO_Port,LD3_Pin,GPIO_PIN_RESET);
}
if (MyTKeys[2].p_Data->StateId == TSL_STATEID_DETECT)
{
HAL_GPIO_WritePin(LD2_GPIO_Port,LD2_Pin,GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(LD2_GPIO_Port,LD2_Pin,GPIO_PIN_RESET);
}
}
****************************************
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, LD2_Pin|LD3_Pin|LD1_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : B1_Pin */
GPIO_InitStruct.Pin = B1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : LD2_Pin LD3_Pin LD1_Pin */
GPIO_InitStruct.Pin = LD2_Pin|LD3_Pin|LD1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : B2_Pin B3_Pin */
GPIO_InitStruct.Pin = B2_Pin|B3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}