cancel
Showing results for 
Search instead for 
Did you mean: 

Capacitive linear slider -- Delta values make sense, but position readout does not

JMuel.1
Associate II

I am trying to get a linear slider (capacitive touch) to work on the STM32F373. The Delta values for the individual electrodes make sense, but the position calculated by the TSL library does not. Please see the details and attached chart.

Using a three-segment linear slider, full electrodes (no half ends); I have chosen the M1 Basic type. I am using HAL, TSL, and the STM32CubeIDE code generator. Normalization of the Delta values is turned on, and I have determined suitable correction factors.

(a) The Delta values for the three electrodes look plausible when I scan my finger over the sensor -- see the three thin lines in the attached plot. But are they expected to be in the 1000s of counts? (Why can I only specify a detection threshold from 0..255 in the TSL parameters?!)

(b) The Position which TSL calclulates from these is total nonsense -- see the fat orange line in the plot. Note how the "position" flips just at the crossover points where another segment signal becomes the strongest one. What is up with this readout?! Am I reading the wrong variable? Is some critical parameter missing?

Thank you for you help!

4 REPLIES 4
JMuel.1
Associate II

Just a quick follow-up on my earlier post. I have been digging into the TSL source code for reading linear sliders, and it seems to me that the code is broken by design. It is meant to support sliders with many elements, identify the elements with the strongest signals, and interpolate the position between them. But the interpolation code seems messed up.

For the simple three-element slider I use, I have written my own position calculation based on the Delta values for the three segments. If the Deltas are d0, d1, d2, simply calculating (d2-d0)/(d0+d1+d2) gives a position between -1 and +1 with reasonable linearity.

Stassen.C
ST Employee

Hi JMuel.1

Please find attached a working example for the slider using the stm32f0 discovery.

Note that :

the TSLPRM_IODEF and TSLPRM_LINROT_USE_NORMDELTA must be set to 1 in the tsl_conf.h and that we are using half ended electrodes.

Kind Regards,

Stassen

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.

JMuel.1
Associate II

Thank you, Stassen. I will try to figure out the differences, but am not quite sure yet how to approach that. I don't have a Discovery Kit, hence cannot debug at runtime. And I have stared at TSL source code long enough...

Any idea why my Delta values might be so high -- 2000 to 6000 counts when the sensors are touched? That seems like the first thing that is off; the libraries (and the detection thresholds I can set in MX Cube) seem to assume a range of 0..255.

Stassen.C
ST Employee

Hello JMuel.1,

Couple of questions:

  • Do you have a plastic overlay on the sensor?
  • What is the clock configuration used?
  • What are the parameters of Init setup of the TSC (DIV, CTPL, CTPH)?
  • What are the values of the 3 sampling capacitors and series resistors?

Regards,

Stassen

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.