cancel
Showing results for 
Search instead for 
Did you mean: 

How to use embedded touch sense controller (TS) on stm32L432kc?

maryam magdy
Associate II

For the software part, if someone can please show me on Github an example project code that implement the touch controller on L4

For hardware, do I add the sampling capacitors and sensing capacitors or they're already embedded on the nucleo stm32l432kc board?

9 REPLIES 9
T J
Lead

I reviewed the schematic,

it dosen't look like there is any Touch circuitry on that board. :(

I made my own board, its a very active interface... works very well

I didnt use the supplied Touch Middleware.

how many keys do you need ?

do you need sliders ?

maryam magdy
Associate II

Thank you for replying. It is written in documents that the stm32l43kc has up to 3 capacitive sensing channels so I guess it does have a touch controller but I have to add the capacitors myself. I found also touch sensing codes that would work on any MCU but I think it's not wise to use them instead of the embedded ones. Right now I just want to test the touch so one key would be enough. I'm using mbed compiler. I found this code: https://github.com/eleciawhite/STM32Cube/blob/master/STM32Cube_FW_F3_V1.3.0/Projects/STM32373C_EVAL/Examples/TSC/TSC_BasicAcquisition_Interrupt/Src/main.c but what I don't understand are these definitions:

IoConfig.ChannelIOs = TSC_GROUP8_IO1;

IoConfig.SamplingIOs = (TSC_GROUP7_IO4 | TSC_GROUP8_IO4);

IoConfig.ShieldIOs = TSC_GROUP7_IO3;'

Any idea what are these? Shouldn't I just define the channels?

L4 examples

STM32Cube_FW_L4_V1.12.0\Projects\STM32L476G-EVAL\Applications\TouchSensing\TouchSensing_1touchkey\Src\main.c

STM32Cube_FW_L4_V1.12.0\Projects\STM32L476G-EVAL\Examples\TSC\TSC_BasicAcquisition_Interrupt\Src\main.c

STM32Cube_FW_L4_V1.12.0\Projects\STM32L4R9I-EVAL\Applications\TouchSensing\TouchSensing_1touchkey\Src\main.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
T J
Lead

which pins are you expecting to use ?

In this diagram there are 6 pins used:

you only want to test 1 pin for touch effect, then you only need 4 pins.

eg, Group1 IO3 and IO4 as shown with Group2(Shield) IO3 and IO4.

I dedicated group 4 to the shield, and I cycle/scan the other keys with the end of acquisition interrupt., Full 21 key scan in 6mS.

T J
Lead

I attached an image, but I cant see it, can you see the image from AN4312 page 28 ?

maryam magdy
Associate II

@Community member​  Thank you a lot for the links. do you know if the code of BasicAcquisition_Interrupt is enough to implement a touch sensor? I just can't seem to understand the differences between the two codes and what each one does. The BasicAcquisition code is compiling fine on my stmL432kc board but the other one not.

maryam magdy
Associate II

@Community member​ Thank you I saw the image. From what I understand, IO3 is for the channel (where the touch is detected) and IO4 is for the sampling capacitor. is that correct?

T J
Lead

here is the Demo board image:

comparing to the Figure 25 AN4312, I sent before, there are two buttons and an active surround, called the shield.

on this demo board there is two buttons, IO1,IO2 on Group1 and the Shield from IO3 Group2 then both groups need the caps on IO4. please recheck figure 25 AN4312 to see a clear image

T J
Lead

did you get it working ?