cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Zones in Touch Sensing Library STM32L053

purkovic
Associate II
Posted on October 25, 2015 at 12:00

Hello, 

I'm currently working on a project where I have 8 touchkeys @ 3 banks.

This is working just fine. But to speed up my prox detection (wake up) of a device I would like to add one more bank (where all channels are used) and use zones to just sample on this bank. With this I would like to speed up the touch detection process in a wake up application.

Can anybody help me with information on how to make this setup?

Is it possible to create another bank with same dest and source?

 {&MyChannels_Src[0], &MyChannels_Dest[0], MyChannels_Data, BANK_0_NBCHANNELS, BANK_0_MSK_CHANNELS, BANK_0_MSK_GROUPS},

  {&MyChannels_Src[2], &MyChannels_Dest[2], MyChannels_Data, BANK_1_NBCHANNELS, BANK_1_MSK_CHANNELS, BANK_1_MSK_GROUPS},

  {&MyChannels_Src[5], &MyChannels_Dest[5], MyChannels_Data, BANK_2_NBCHANNELS, BANK_2_MSK_CHANNELS, BANK_2_MSK_GROUPS},

{&MyChannels_Src[0], &MyChannels_Dest[0], MyChannels_Data, BANK_3_NBCHANNELS, BANK_3_MSK_CHANNELS, BANK_3_MSK_GROUPS},

Zones:

TSL_tIndex_T MyBankSortingNormal_mode[4] = { 0, 1, 2, 3};

TSL_Zone_T MyZone2 = {

 MyBankSortingNormal_mode,

 0,

 3 // Number of Banks in the Zone

};

TSL_tIndex_T MyBankSortingFast_mode[4] = {3, 0, 1, 2};

TSL_Zone_T MyZoneFast_mode = {

 MyBankSortingFast_mode,

 0,

 1 // Number of Banks in the Zone

};

in tsl_user_Exec() I've added:

 if (TSL_acq_ZoneConfig(&MyZoneFast_mode , idx_bank) != TSL_STATUS_ERROR)

{

 // Old content of tsl_user_Exec();

}

 
1 REPLY 1
Thierry GUILHOT
ST Employee
Posted on November 04, 2015 at 16:41

Hi,

Personally, I do not see an interest to use a zone to manage a such use case.

Depending on the channel assignment to analog I/O groups, we can distinguish two different approaches:

  1. If all channels belong to different analog I/O groups, it is then possible to always acquire them using a single bank.  But as you did not perform this, I assume that some channels belong to the same analog I/O group.

  2. If some channels belong to a same analog I/O group, it is then required to define several banks to acquire sequentially the channels belonging to the same analog I/O group. But to speed up the proximity detection process, it is possible to define an additional bank where all the channels are acquired simultaneously. To do this, you will have however to make it in a proper way to not corrupt the acquisition results!

According to the provided information, I understand that banks are defined as followed (channel number may be incorrect):

  • Bank 0 -> Channel 0 and Channel 1

  • Bank 1 -> channel 2, channel 3 and channel 4

  • Bank 2 -> channel 5, channel 6 and channel 7

  • Bank 3 -> all 8 channels

Let’s assume that the analog I/O group assignment is the following one:

  • Group 1:  channel 0 (IO1) , channel 2 (IO2) and channel 5 (IO3)

  • Group 2: channel 1 (IO1), channel 3 (IO2) and channel 6 (IO3)

  • Group 4: channel 4 (IO1) and channel 7 (IO2)

Normally, channels which are acquired within the same bank belong to different analog I/O group. This will be not the case for the bank 3 where several channels of the same analog I/O group are acquired simultaneously. Practically, this means that the result of the acquisition of the group 1 will be the result of the acquisition of a pseudo channel composed of the channel 0, channel 2 and channel 5 (three electrodes connected all together). You can easily understand that the result will be different from the one of the channel 0 acquired alone. With your bank 3 settings, this will introduce some side effects such as no detection, permanent detection, acquisition error, … This is why, for the bank 3, it is required to define new specific channels.

Based on the above assumption, my proposal is to define these new channels and the corresponding bans as followed:

  • File tsl_user.h:

/* Channel IOs definition */

#define CHANNEL_8_IO_MSK    (TSC_GROUP1_IO1 | TSC_GROUP1_IO2 | TSC_GROUP1_IO3)

#define CHANNEL_8_GRP_MSK   (TSC_GROUP1)

#define CHANNEL_8_SRC       (TSC_GROUP1_IDX) /* Index in source register (TSC->IOGXCR[]) */

#define CHANNEL_8_DEST      (8) /* Index in destination result array */

#define CHANNEL_9_IO_MSK    (TSC_GROUP2_IO1 | TSC_GROUP2_IO2 | TSC_GROUP2_IO3)

#define CHANNEL_9_GRP_MSK   (TSC_GROUP2)

#define CHANNEL_9_SRC       (TSC_GROUP2_IDX) /* Index in source register (TSC->IOGXCR[]) */

#define CHANNEL_9_DEST      (9) /* Index in destination result array */

#define CHANNEL_10_IO_MSK    (TSC_GROUP4_IO1 | TSC_GROUP4_IO2)

#define CHANNEL_10_GRP_MSK   (TSC_GROUP4)

#define CHANNEL_10_SRC       (TSC_GROUP4_IDX) /* Index in source register (TSC->IOGXCR[]) */

#define CHANNEL_10_DEST      (10) /* Index in destination result array */

/* Banks definition */

#define BANK_3_NBCHANNELS    (3)

#define BANK_3_MSK_CHANNELS  (CHANNEL_8_IO_MSK | CHANNEL_9_IO_MSK | CHANNEL_10_IO_MSK)

#define BANK_3_MSK_GROUPS    (CHANNEL_8_GRP_MSK | CHANNEL_9_GRP_MSK | CHANNEL_10_GRP_MSK)

  • File tsl_user.c:

/* List (ROM) */

CONST TSL_Bank_T MyBanks[TSLPRM_TOTAL_BANKS] = {

  {&MyChannels_Src[0], &MyChannels_Dest[0], MyChannels_Data, BANK_0_NBCHANNELS, BANK_0_MSK_CHANNELS, BANK_0_MSK_GROUPS},

{&MyChannels_Src[2], &MyChannels_Dest[2], MyChannels_Data, BANK_1_NBCHANNELS, BANK_1_MSK_CHANNELS, BANK_1_MSK_GROUPS},

{&MyChannels_Src[5], &MyChannels_Dest[5], MyChannels_Data, BANK_2_NBCHANNELS, BANK_2_MSK_CHANNELS, BANK_2_MSK_GROUPS},

{&MyChannels_Src[8], &MyChannels_Dest[8], MyChannels_Data, BANK_3_NBCHANNELS, BANK_3_MSK_CHANNELS, BANK_3_MSK_GROUPS},

};

You will have to acquire regularly the BANK 3 to detect if there is a proximity detection and if it is the case, then to acquire BANK 0 to BANK 2. Note that time to time you will still need to perform an acquisition of the BANK 0 to BANK 2 and even if there is no proximity detection. This is required to ensure the ECS to work properly. If not done, capacitance variation of the electrodes induced by temperature, humidity and voltage changes will be not compensated and the system will not behave properly.

I hope this is clear as it is not so easy to detail all of this through a simple text.

Best Regards,

Thierry,

Hello, 

I'm currently working on a project where I have 8 touchkeys @ 3 banks.

This is working just fine. But to speed up my prox detection (wake up) of a device I would like to add one more bank (where all channels are used) and use zones to just sample on this bank. With this I would like to speed up the touch detection process in a wake up application.

Can anybody help me with information on how to make this setup?

Is it possible to create another bank with same dest and source?

 {&MyChannels_Src[0], &MyChannels_Dest[0], MyChannels_Data, BANK_0_NBCHANNELS, BANK_0_MSK_CHANNELS, BANK_0_MSK_GROUPS},

  {&MyChannels_Src[2], &MyChannels_Dest[2], MyChannels_Data, BANK_1_NBCHANNELS, BANK_1_MSK_CHANNELS, BANK_1_MSK_GROUPS},

  {&MyChannels_Src[5], &MyChannels_Dest[5], MyChannels_Data, BANK_2_NBCHANNELS, BANK_2_MSK_CHANNELS, BANK_2_MSK_GROUPS},

{&MyChannels_Src[0], &MyChannels_Dest[0], MyChannels_Data, BANK_3_NBCHANNELS, BANK_3_MSK_CHANNELS, BANK_3_MSK_GROUPS},

Zones:

TSL_tIndex_T MyBankSortingNormal_mode[4] = { 0, 1, 2, 3};

TSL_Zone_T MyZone2 = {

 MyBankSortingNormal_mode,

 0,

 3 // Number of Banks in the Zone

};

TSL_tIndex_T MyBankSortingFast_mode[4] = {3, 0, 1, 2};

TSL_Zone_T MyZoneFast_mode = {

 MyBankSortingFast_mode,

 0,

 1 // Number of Banks in the Zone

};

in tsl_user_Exec() I've added:

 if (TSL_acq_ZoneConfig(&MyZoneFast_mode , idx_bank) != TSL_STATUS_ERROR)

{

 // Old content of tsl_user_Exec();

}