cancel
Showing results for 
Search instead for 
Did you mean: 

I'm using the stm32f0 series. I have it right now, so I'm doing it with a signal generator. I want to count every rising edge of the signal my code is as below but it is not counting prope

hdemi.1
Associate III

5 REPLIES 5
gbm
Lead III

Use the measured signal input as timer clock input. You cannot use capture function reasonably at 10 MHz.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

How fast is the STM32 clocking?

Not counting properly? Please expand on what it is doing..

Should be using External Clock modes, probably not measuring cycles.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

> TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV2;

Why? (although I don't think this makes any difference in this particular case)

> TIM1->SMCR |= TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1| TIM_SMCR_TS_2 | TIM_SMCR_TS_1;

That's TIM1_SMCR.SMS = 0b110 = Trigger Mode.

You probably want 0b111 = External Clock Mode 1, don't you.

Plus all the questions of TeslaDelorean.

JW

hdemi.1
Associate III

I don't quite understand what you mean, can you give an example?

I expect it to count every time a rising edge in but it doesn't