2017-06-19 11:29 PM
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?
2017-07-01 01:44 AM
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?