2025-11-24 7:57 PM - edited 2025-11-24 7:58 PM
Hi there,
Chip: STM32L053R8Tx
I've encountered an issue where the code generated in tsl_user.h at the "/* Channel IOs definition */" is incorrect and does not match the chosen settings in the .ioc.
In TOUCHSENSING in the .ioc, with TSLPRM_TOTAL_TOUCHKEYS_B set to 8 (one key per sampling capacitor), the first three #define lines in the above section in tsl_user.h is incorrect. It would appear that these lines are hardcoded and unaffected by the code generator. I used the following settings in the .ioc
IO_TOUCHKEY_B1 is set to G5_IO4
IO_TOUCHKEY_B2 is set to G7_IO4
IO_TOUCHKEY_B3 is set to G1_IO2
IO_TOUCHKEY_B4 is set to G2_IO4
IO_TOUCHKEY_B5 is set to G3_IO3
IO_TOUCHKEY_B6 is set to G6_IO4
IO_TOUCHKEY_B7 is set to G8_IO3
IO_TOUCHKEY_B8 is set to G4_IO3
...and with these settings, the following code was generated:
/* Channel IOs definition */
#define CHANNEL_0_IO_MSK (TSC_GROUP1_IO2)
#define CHANNEL_0_GRP_MSK (TSC_GROUP1)
#define CHANNEL_0_SRC (TSC_GROUP1_IDX) /* Index in source register (TSC->IOGXCR[]) */
#define CHANNEL_0_DEST (0) /* Index in destination result array */
#define CHANNEL_1_IO_MSK (TSC_GROUP7_IO4)
#define CHANNEL_1_GRP_MSK (TSC_GROUP7)
#define CHANNEL_1_SRC (TSC_GROUP7_IDX)
#define CHANNEL_1_DEST (1)
#define CHANNEL_2_IO_MSK (TSC_GROUP1_IO2)
#define CHANNEL_2_GRP_MSK (TSC_GROUP1)
#define CHANNEL_2_SRC (TSC_GROUP1_IDX)
#define CHANNEL_2_DEST (2)
#define CHANNEL_3_IO_MSK (TSC_GROUP2_IO4)
#define CHANNEL_3_GRP_MSK (TSC_GROUP2)
#define CHANNEL_3_SRC (TSC_GROUP2_IDX)
#define CHANNEL_3_DEST (3)
#define CHANNEL_4_IO_MSK (TSC_GROUP3_IO3)
#define CHANNEL_4_GRP_MSK (TSC_GROUP3)
#define CHANNEL_4_SRC (TSC_GROUP3_IDX)
#define CHANNEL_4_DEST (4)
#define CHANNEL_5_IO_MSK (TSC_GROUP6_IO4)
#define CHANNEL_5_GRP_MSK (TSC_GROUP6)
#define CHANNEL_5_SRC (TSC_GROUP6_IDX)
#define CHANNEL_5_DEST (5)
#define CHANNEL_6_IO_MSK (TSC_GROUP8_IO3)
#define CHANNEL_6_GRP_MSK (TSC_GROUP8)
#define CHANNEL_6_SRC (TSC_GROUP8_IDX)
#define CHANNEL_6_DEST (6)
#define CHANNEL_7_IO_MSK (TSC_GROUP4_IO3)
#define CHANNEL_7_GRP_MSK (TSC_GROUP4)
#define CHANNEL_7_SRC (TSC_GROUP4_IDX)
#define CHANNEL_7_DEST (7)Swapping G5_IO4 out with any other value for IO_TOUCHKEY_B1 still generated the same defines.
The subsequent behaviour of this bug means that the touch key group missing from the definitions list does not function, and whichever touch key that I have manually assigned with GROUP1 triggers detect for CHANNEL_0 as well as the intended channel selected in the .ioc.
I have attached my .ioc file for reference.
Cheers!
2025-11-24 11:11 PM
Hello @h7-v ,
Let me thank you for posting.
I am currently checking this behavior, and I will get back to you ASAP.
Thanks.
Mahmoud
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.