cancel
Showing results for 
Search instead for 
Did you mean: 

Input Capture using timers.

DebD21
Associate

Hi

I'm working on a BLDC Motor control project using STM8S Discovery Board (STM8S 105C6T6 MCU). I need to read the hall sensor inputs from my motor onto the three channels of TIM 2. So I thought of getting acquainted with the mechanism of input capture by running a simple program to generate a PWM signal from TIM 2 CH 1 (62.5 Hz, 50% duty cycle) and capture it onto TIM 1 CH 2, using interrupts. But every time I keep getting "a dc=100% and strange frequencies" from TIM2 CH1 on my oscilloscope.

I've been able to run the sample code given by ST for input capture i.e. directing the LSI clock output onto TIM1 CH2 pin successfully. My oscilloscope shows a 128 kHz, 50% duty ratio pulse train and the variable used to compute the LSI Clock Frequency also shows a close enough value on the Watch Window.

I want to share my code via email if someone's willing to help me out. I am using ST Visual Develop and Cosmic C Compiler.

Thanks!

0 REPLIES 0