Why Does the TSC counter Increse and after a time Fall Down(like sawtooth wave)?
Hi,
I'm working on TSC, whit Stm32f051. At the end of equasition, I read the counter(TSC->IOGXR). this counter increses smoothly in period of time. After a certain level, it fall down(like the sawtooth wave).
My code is very simple az shown below:
Confige the TSC:
TSC->CR = (0xFUL << 28) |
(0xFUL << 24) | (0x6UL << 5);
TSC->IOHCR &= ~( (0xFUL << 4) | (0xFUL << 0));
TSC->IOSCR =( (8UL << 4) | (8UL << 0));
TSC->ICR = 3;
TSC-> IOGCSR |= 3;
TSC->CR |= 0X03;
while(1)
{
While((TSC->ISR & 0X1) == 0X00);
X = TSC->IOGXCR[0];
TSC->ICR |= 0x01;
TSC-CR |= 0X02;
for(uint8_t i = 0; i < 2; i++)
{
while( !USART_GetFlagStatus(USART1, USART_FLAGTXE);
USART_SendData(USART1, X >> i);
}
}
The pictuer of sample is shown below:

Why does this happen?