cancel
Showing results for 
Search instead for 
Did you mean: 

Touch Sensing on STM32F0

eltar
Associate III
Posted on June 15, 2012 at 13:27

Hi, it is stated in STM32F051 RM that the MCU was designed to work with STM32 TSL. I attempted to build a prject with the TSL, however it supports only STM32L and would not build saying that ''instruction is unsupported''. How do I go about this? Unfortunately RM is not clear on how exactly to use TSC and there are no examples in SPL.

P.S. I'm using STM32F0-Discovery

#tsl #stm32f0
16 REPLIES 16
Thierry GUILHOT
ST Employee
Posted on June 15, 2012 at 17:01

Hi,

The STM32F0xx STMTouch Library is not yet officially released. Please find attached a beta version.

Best Regards,

Thierry,

eltar
Associate III
Posted on June 15, 2012 at 17:56

Thank you Sir,

I'll give it a try. Also it would be useful if there's an application note with an algorithm. E.g. I'm not getting if the trouble of switching IOs from input to output is something TSC takes a matter of or it is user who should implement it in software. I tried to go into STM32L TSL and it looks like that among defines there's explicit switching happens and the whole thing is not very automated (like ADC for example). Anyway, many thanks for your help!

Best,

A.

eltar
Associate III
Posted on June 15, 2012 at 18:04

Ooooops. Incomarabale:

  • STM8TL5x devices using the embedded ProxSenseâ„¢ patented acquisition technology
  • STM32F0xx devices using the embedded Touch-Sensing controller
  • STM32L1xx High-density devices using the Timer acquisition mode
Got it. On it.

eltar
Associate III
Posted on June 16, 2012 at 10:25

Hi Thierry,

Maybe you could help me with one more thing. I'm attempting to get a reading from a single channel. The board is powered from USB, there's also an ft232 USB<->UART dongle connected to UART1. I'm getting a periodic increase (or decrease) of the reading. This period doesn't seem to have anything with the time - as I play with SysTick there's no noticable effect. Here's the actual example with SysTick firing every second: Val - 3 Val - 63 Val - 185 Val - 3 Val - 2 Val - 2 Val - 46 Val - 165 Val - 11 Val - 2 Val - 2 Val - 31 Val - 137 Val - 263 Val - 2 Val - 2 Val - 10 Val - 130 Val - 235 Val - 2 Val - 2 If I'd built a graph, you would see that the spikes are very periodic. What confuses me even more is that I had EXACTLY the same picture when playing with touch sensing on PIC MCUs. That is like... my table has pulsing capacity.... Here's the related snippets of the code:


RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_TS, ENABLE);

GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_3);

GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_3);

GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_3);


GPIO_InitTypeDef GPIO_InitStructure;


GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOA, &GPIO_InitStructure);


GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOA, &GPIO_InitStructure);


union {

uint32_t TSC_CR_Uint32;

struct
{

uint8_t TSCE :1;

uint8_t START :1;

uint8_t AM :1;

uint8_t SYNCPOL :1;

uint8_t IODEF :1;

uint8_t MCV :3;

uint8_t unused :4;

uint8_t PGPSC :3;

uint8_t SSPSC :1;

uint8_t SSE :1;

uint8_t SSD :7;

uint8_t CTPL :4;

uint8_t CTPH :4;

} TSC_CR_Fields;

} TSC_CR_Reg;



TSC_CR_Reg.TSC_CR_Uint32 = 0;

TSC_CR_Reg.TSC_CR_Fields.CTPH = 0xF;

TSC_CR_Reg.TSC_CR_Fields.CTPL = 0xF;

TSC_CR_Reg.TSC_CR_Fields.SSD = 0x40;

TSC_CR_Reg.TSC_CR_Fields.SSE = 0;

TSC_CR_Reg.TSC_CR_Fields.SSPSC = 1;

TSC_CR_Reg.TSC_CR_Fields.PGPSC = 0b011;

TSC_CR_Reg.TSC_CR_Fields.MCV = 0b110;

TSC_CR_Reg.TSC_CR_Fields.IODEF = 0;

TSC_CR_Reg.TSC_CR_Fields.SYNCPOL = 0;

TSC_CR_Reg.TSC_CR_Fields.AM = 0;

TSC_CR_Reg.TSC_CR_Fields.START = 0;

TSC_CR_Reg.TSC_CR_Fields.TSCE = 1;


TSC->CR = TSC_CR_Reg.TSC_CR_Uint32;


TSC->IER = 0x00;

TSC->ICR = 0x03;


TSC->IOHCR &= 0xFFFFFFFD;

//TSC->IOASCR = 0x2;

TSC->IOSCR = 0x4;

TSC->IOCCR = 0x2;

TSC->IOGCSR = 1;

TSC->CR |= 2;


while
(1)

{

if
(flag) 
//flag is raised every second

{

GPIOC->ODR ^= GPIO_Pin_8; 
//LED

flag = 0;

TSC->ICR = 3;

TSC->CR |= 2;

while
(!(TSC->ISR & 1))

if
(TSC->ISR & 2)

{

TSC->ICR = 3;

TSC->CR |= 2;

printf(
''
Error..
''
);

}

printf(
''
Val - %u
''
, (uint16_t)TSC->IOGXCR[0]);

}

}

st239955_st
Associate
Posted on April 07, 2014 at 19:06

Hi Thierry, Please can you send me a copy of the touch library as well.

Regards,

Duncan

Thierry GUILHOT
ST Employee
Posted on April 08, 2014 at 23:01

Hi Duncan,

This firmware Library is now officialy released. You can find it on st.com using the TOUCH keyword. Here it is the 

http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/PF258655?s_searchtype=keyword

to the corresponding page.

Best Regards,

Thierry,

enmirc
Associate II
Posted on March 25, 2016 at 10:40

hi Thierry, 

it is possible that I have your email address? 

I wish to talk about STM32L1xx touch library, 

I have many many question ... regards M.

Amel NASRI
ST Employee
Posted on March 25, 2016 at 12:30

Hi mickey,

Thanks for your interest on our products and solutions.

I suggest you to submit your questions in separate discussions here in STM32 forum or contact your ST representative to get a direct assistance.

-Mayla-

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.

enmirc
Associate II
Posted on March 25, 2016 at 14:05

Hello Mayla,

I am very disappointed on this driver and .. I think 

public letter is not a place to talk about that so please give me 

a email address. Local help is not a help at all .