cancel
Showing results for 
Search instead for 
Did you mean: 

Why Does the TSC counter Increse and after a time Fall Down(like sawtooth wave)?

Mohammad Rostamian
Associate III
Posted on June 20, 2017 at 08:29

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:

0690X00000603tcQAA.jpg

Why does this happen?

1 REPLY 1
Mohammad Rostamian
Associate III
Posted on July 01, 2017 at 10:44

I found the problem.

When  I change the the GPIOx_OSPEEDR to zero, it worked well. But other confige the problem  exists.

Can any body help why?