AnsweredAssumed Answered

Touch Sense Documentation Missing Non-STM32L Clarification

Question asked by Richard Lowe on Apr 4, 2017

ST, I love you guys, and in most cases your documentation is terrific. However, your Touch Sense Library is woefully lacking. I will detail my question with great care so I don't get a robotic "Read this: ..." answer. Just so we are upfront, here are the documents that I have read, re-read, shed tears over, and probably a few paper cuts as well:

 

UM1913 Great read, read over more than any of the others

AN4312 Very well documented

AN3236 Increasing touch keys are something I need, perfect

UM1606 User manual for the STMTouch driver user manual (Got some good tips, like I used too large of a cap on the sample lines)

AN4316 Good tuning guide

UM1913 Using CubeMX with touch sensing library

 

My MCU is the STM32L476 (Amazing little chip)

 

My sincere request is clarification is the configuration of banks, channels and sample lines in the tsl_user.h file. 

 

Here is how it looks in your examples for the STMF1 series:

// Channel IOs definition
#define CHANNEL_0_SRC    ((uint32_t)(GR11))
#define CHANNEL_0_DEST   (0)
#define CHANNEL_0_SAMPLE    (TSL_GROUP11_IO4)
#define CHANNEL_0_CHANNEL   (TSL_GROUP11_IO1)

#define CHANNEL_1_SRC    ((uint32_t)(GR11))
#define CHANNEL_1_DEST   (1)
#define CHANNEL_1_SAMPLE    (TSL_GROUP11_IO4)
#define CHANNEL_1_CHANNEL   (TSL_GROUP11_IO2)

#define CHANNEL_2_SRC    ((uint32_t)(GR11))
#define CHANNEL_2_DEST   (2)
#define CHANNEL_2_SAMPLE    (TSL_GROUP11_IO4)
#define CHANNEL_2_CHANNEL   (TSL_GROUP11_IO3)

// Banks definition
#define BANK_0_NBCHANNELS    (1)
#define BANK_0_SHIELD_SAMPLE        (TSL_GROUP6_IO4)
#define BANK_0_SHIELD_CHANNEL       (TSL_GROUP6_IO3)

#define BANK_1_NBCHANNELS    (1)
#define BANK_1_SHIELD_SAMPLE        (TSL_GROUP6_IO4)
#define BANK_1_SHIELD_CHANNEL       (TSL_GROUP6_IO3)

#define BANK_2_NBCHANNELS    (1)
#define BANK_2_SHIELD_SAMPLE        (TSL_GROUP6_IO4)
#define BANK_2_SHIELD_CHANNEL       (TSL_GROUP6_IO3)


And here is how it looks in the F3 L4 examples:

 

/*The touch sensing button is connected to PB12 port of STM32L476ZGT6 and the related
charge capacitor is connected to PB13. */

/* Channel IOs definition */
#define CHANNEL_0_IO_MSK    (TSC_GROUP1_IO1)
#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 */

/* Shield IOs definition */
#define SHIELD_IO_MSK       (TSC_GROUP4_IO1)

/* Banks definition */
#define BANK_0_NBCHANNELS    (1)
#define BANK_0_MSK_CHANNELS  (CHANNEL_0_IO_MSK | SHIELD_IO_MSK)
#define BANK_0_MSK_GROUPS    (CHANNEL_0_GRP_MSK)

 

So here is what I'm attempting to do:

 

 

Multi-touch from 3 groups

I've tried every combination I can come up with to configure them in such a pattern. Here is the current:

/* Channel IOs definition */
#define CHANNEL_0_IO_MSK    (TSC_GROUP1_IO1)
#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_GROUP1_IO2)
#define CHANNEL_1_GRP_MSK   (TSC_GROUP1)
#define CHANNEL_1_SRC       (TSC_GROUP1_IDX)
#define CHANNEL_1_DEST      (1)

#define CHANNEL_2_IO_MSK    (TSC_GROUP1_IO3)
#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_GROUP3_IO1)
#define CHANNEL_3_GRP_MSK   (TSC_GROUP3)
#define CHANNEL_3_SRC       (TSC_GROUP3_IDX)
#define CHANNEL_3_DEST      (3)

#define CHANNEL_4_IO_MSK    (TSC_GROUP3_IO2)
#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_GROUP3_IO3)
#define CHANNEL_5_GRP_MSK   (TSC_GROUP3)
#define CHANNEL_5_SRC       (TSC_GROUP3_IDX)
#define CHANNEL_5_DEST      (5)

#define CHANNEL_6_IO_MSK    (TSC_GROUP4_IO1)
#define CHANNEL_6_GRP_MSK   (TSC_GROUP4)
#define CHANNEL_6_SRC       (TSC_GROUP4_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)

/* Banks definition */
#define BANK_0_NBCHANNELS    ( 2 )
#define BANK_0_MSK_CHANNELS  ( CHANNEL_0_IO_MSK | CHANNEL_1_IO_MSK )
#define BANK_0_MSK_GROUPS    ( CHANNEL_0_GRP_MSK | CHANNEL_1_GRP_MSK )

#define BANK_1_NBCHANNELS    ( 2 )
#define BANK_1_MSK_CHANNELS  ( CHANNEL_2_IO_MSK | CHANNEL_3_IO_MSK )
#define BANK_1_MSK_GROUPS    ( CHANNEL_2_GRP_MSK | CHANNEL_3_GRP_MSK )

#define BANK_2_NBCHANNELS    ( 2 )
#define BANK_2_MSK_CHANNELS  ( CHANNEL_4_IO_MSK | CHANNEL_5_IO_MSK )
#define BANK_2_MSK_GROUPS    ( CHANNEL_4_GRP_MSK | CHANNEL_5_GRP_MSK )

#define BANK_3_NBCHANNELS    ( 2 )
#define BANK_3_MSK_CHANNELS  ( CHANNEL_6_IO_MSK | CHANNEL_7_IO_MSK)
#define BANK_3_MSK_GROUPS    ( CHANNEL_6_GRP_MSK | CHANNEL_7_GRP_MSK )

 

The acquisition is going great, but having the following issues:

1. Detect on one channel is also on the other channels in the same bank

Channel: 0 -> RELEASE
Channel: 1 -> RELEASE
Channel: 2 -> CALIB
Channel: 3 -> CALIB
Channel: 4 -> RELEASE
Channel: 5 -> RELEASE
Channel: 6 -> CALIB
Channel: 7 -> CALIB

 

When channel 0 is in DETECT so will channel 1. They are in the same group but not connected:

2. Channels 2, 3, 6, 7 Never come out of calibration state

Yes I have everything configured to the same as the examples as far as I can tell:

/* Source and Configuration (ROM) */
CONST TSL_ChannelSrc_T READER_CHANNEL_SRC[TSLPRM_TOTAL_CHANNELS] =
{
  { CHANNEL_0_SRC, CHANNEL_0_IO_MSK, CHANNEL_0_GRP_MSK },
  { CHANNEL_1_SRC, CHANNEL_1_IO_MSK, CHANNEL_1_GRP_MSK },
  { CHANNEL_2_SRC, CHANNEL_2_IO_MSK, CHANNEL_2_GRP_MSK },
  { CHANNEL_3_SRC, CHANNEL_3_IO_MSK, CHANNEL_3_GRP_MSK },
  { CHANNEL_4_SRC, CHANNEL_4_IO_MSK, CHANNEL_4_GRP_MSK },
  { CHANNEL_5_SRC, CHANNEL_5_IO_MSK, CHANNEL_5_GRP_MSK },
  { CHANNEL_6_SRC, CHANNEL_6_IO_MSK, CHANNEL_6_GRP_MSK },
  { CHANNEL_7_SRC, CHANNEL_7_IO_MSK, CHANNEL_7_GRP_MSK }
};

/* Destination (ROM) */
CONST TSL_ChannelDest_T READER_CHANNEL_DEST[TSLPRM_TOTAL_CHANNELS] =
{
  { CHANNEL_0_DEST },
  { CHANNEL_1_DEST },
  { CHANNEL_2_DEST },
  { CHANNEL_3_DEST },
  { CHANNEL_4_DEST },
  { CHANNEL_5_DEST },
  { CHANNEL_6_DEST },
  { CHANNEL_7_DEST }
};

/* Data (RAM) */
TSL_ChannelData_T reader_channel_data[TSLPRM_TOTAL_CHANNELS];

/*============================================================================*/
/* Banks                                                                      */
/*============================================================================*/
/* List (ROM) */
CONST TSL_Bank_T READER_BANKS[TSLPRM_TOTAL_BANKS] =
{
  {&READER_CHANNEL_SRC[0], &READER_CHANNEL_DEST[0], &reader_channel_data[0], BANK_0_NBCHANNELS, BANK_0_MSK_CHANNELS, BANK_0_MSK_GROUPS},
  {&READER_CHANNEL_SRC[2], &READER_CHANNEL_DEST[2], &reader_channel_data[2], BANK_1_NBCHANNELS, BANK_1_MSK_CHANNELS, BANK_1_MSK_GROUPS},
  {&READER_CHANNEL_SRC[4], &READER_CHANNEL_DEST[4], &reader_channel_data[4], BANK_2_NBCHANNELS, BANK_2_MSK_CHANNELS, BANK_2_MSK_GROUPS},
  {&READER_CHANNEL_SRC[6], &READER_CHANNEL_DEST[6], &reader_channel_data[6], BANK_3_NBCHANNELS, BANK_3_MSK_CHANNELS, BANK_3_MSK_GROUPS}
};

 

Yes I have the tsl_conf.h file configured.

/** Total number of channels in application (range=1..255)
*/

#define TSLPRM_TOTAL_CHANNELS (8)

/** Total number of banks in application (range=1..255)
*/

#define TSLPRM_TOTAL_BANKS (4)

/** Total number of "Extended" TouchKeys in application (range=0..255)
*/

#define TSLPRM_TOTAL_TOUCHKEYS (8)

/** Total number of "Basic" TouchKeys in application (range=0..255)
*/

#define TSLPRM_TOTAL_TOUCHKEYS_B (0)

/** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)
  - Count also the 1-channel linear sensor used as TouchKey
*/

#define TSLPRM_TOTAL_LINROTS (0)

/** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)
  - Count also the 1-channel linear sensor used as TouchKey
*/

#define TSLPRM_TOTAL_LINROTS_B (0)

/** Total number of sensors/objects in application (range=1..255)
  - Count all TouchKeys, Linear and Rotary sensors
*/

#define TSLPRM_TOTAL_OBJECTS (8)

 

So my biggest question:

 

Seems is that the examples are quite sparse and few in number. The L4 example is ... pathetic. A 1 key press example. Kind of like, "hello world". That's fine, but without any clear documentation on how to configure the Banks, Channels, and Groups or examples to go along with expanding the touchpads like referenced in AN3236, you've pretty much abandoned me.

 

Please guide me through setting up the TSL for expanding the touchpads in a similar configuration found in your application note. Help me understand how the configuration should be in the tsl_user.h file. Help me understand why some channels never return from calibration states. Give me some hints on how to get separate readings from channels that are within the same bank.

 

Thank you for your time, I know how valuable it is.

Outcomes