2019-06-03 03:45 AM
Hello,
i am trying to get the 32F0-TOUCH-LIB to work, but so far i didn't succeed.
Processor is an STM32F051C4Tx on a custom board, which works except for the touch functions. There is a touch button for Proximity sensing and two sliders for input.
The project was created with STM32CubeMx (Version 5.2.1):
TSC peripherial:
Middleware: Touchsensing
The code is generated for Atollicstudio and compiles.
And the following changes are made:
The tsl_user_Exec() always returns TSL_USER_STATUS_BUSY and no activity can be observed at the IO-Port with an oscilloscope.
I compared the functions calls with the STMTouch Driver user manual and everything matches. I even checked the TSL_tim_ProcessIT() call in the Systick ISR. The TSC IRQ doesn't seem to be used in the libraries, because the IRQ-flag gets polled in the tsl_user_Exec().
I believe i missed a small detail, but i can't figure it out myself. I hope that somebody, more experienced with this library can give me a hint...
Thanks in advance
Jan
2019-06-05 05:56 AM
I am still struggelling...
If I use the TSC Controller the manual way with the HAL, i atleast see pulses an the touch surfaces. But still no success with the Touch Sensing Library.
while (1)
{
HAL_TSC_IODischarge(&htsc, ENABLE);
HAL_Delay(1); /* 1 ms is more than enough to discharge all capacitors */
/*##-3- Start the acquisition process ####################################*/
if (HAL_TSC_Start(&htsc) != HAL_OK)
{
/* Acquisition Error */
Error_Handler();
}
/*##-4- Wait for the end of acquisition ##################################*/
/* Before starting a new acquisition, you need to check the current state of
the peripheral; if it�s busy you need to wait for the end of current
acquisition before starting a new one. */
while (HAL_TSC_GetState(&htsc) == HAL_TSC_STATE_BUSY)
{
/* For simplicity reasons, this example is just waiting till the end of the
acquisition, but application may perform other tasks while acquisition
operation is ongoing. */
}
// tsl_user_Exec();
/*##-5- Clear flags ######################################################*/
__HAL_TSC_CLEAR_FLAG(&htsc, (TSC_FLAG_EOA | TSC_FLAG_MCE));
/*##-6- Check if the acquisition is correct (no max count) ###############*/
if (HAL_TSC_GroupGetStatus(&htsc, TSC_GROUP1_IDX) == TSC_GROUP_COMPLETED)
{
/*##-7- Store the acquisition value ####################################*/
uhTSCAcquisitionValue = HAL_TSC_GroupGetValue(&htsc, TSC_GROUP2_IDX);
if ((uhTSCAcquisitionValue > TSCx_MIN_THRESHOLD) && (uhTSCAcquisitionValue < TSCx_LOW_MAXTHRESHOLD))
{
}
}
....
2019-07-02 11:42 PM
Note that there is a bug in HAL_TSC_GroupGetStatus so that it returns wrong status:
https://community.st.com/s/question/0D50X0000B2A2sNSQS/bug-haltscgroupgetstatus-gives-wrong-results