Sorry forgot to add this. As for delayed turn on. That can work but why not simply have the software go into a 5 or 10 second wait before it does anything else. Display "warming up" or "please wait" on the LCD.
On Wed, Mar 12, 2014 at 7:18 AM, Chris Albertson <[email protected]>wrote: > > Are you putting the "unknown signal" to be measured on an interrupt pin? > that will work for low enough frequencies but most uPs have a built-in > counter. It is a hardware register on the uP chip that will increment for > each pulse on a pin. then you read that number and divide by the gate > time. At some point the frequency will be to high for the counter pin so > then you switch in a hardware frequency diver as a pre-scaler. > > > On Tue, Mar 11, 2014 at 8:24 PM, d0ct0r <[email protected]> wrote: > >> >> Hello, >> >> I am experimenting to build frequency counter using external OCXO and >> ST32 MCU. The OCXO is external DATUM 2750013-1 device which produce 10Mhz >> sine wave. I connected its output to OC_IN on MCU. I have few challenges >> now. >> >> First, looks like I need to create some delay to turn on MCU _after_ >> OCXO. If I try to start both devices simultaneously, I got following result >> for 10 kHz TTL measurement: >> >> >> System Core Clock: 168000000 Hz >> SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency >> 16000000 16000000 16000000 >> >> # Starting SuperLoop... >> FREQ: 105197 >> FREQ: 105263 >> FREQ: 105263 >> FREQ: 105263 >> >> >> As soon as I push reset button on MCU, I got correct results for its >> clocks and correct value for the counter: >> >> >> System Core Clock: 168000000 Hz >> SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency >> 168000000 42000000 84000000 >> >> # Starting SuperLoop... >> FREQ: 10019 >> FREQ: 10019 >> FREQ: 10019 >> FREQ: 10019 >> FREQ: 10018 >> FREQ: 10019 >> >> >> Another challenge is the fact, that if I increase the input signal >> frequency, then performance of the MCU decreased. In the other word, I need >> to wait much more time to have a result. Probably MCU is super busy to >> handle the interrupt. Say for 10 kHz range its pretty fast. Then for 1 mHz >> its much slower. >> >> Here is main loop: >> >> while (1) { >> if(j++ < 0xF00000) { >> accum += deltaREF; // Moving Average >> accum = (accum >> 1); >> } else { >> uwTIM1Freq = (uint32_t) SystemCoreClock / accum; >> printf("FREQ: %ul\n\r", uwTIM1Freq); >> accum = j = 0; >> } >> } >> >> The counter is based on timer in "input capture" mode and driven by >> interrupt: >> [ See STM32F4xx_StdPeriph_Examples\TIM\TIM_InputCapture ] >> >> Also this counter shows incorrect results for low frequency. For example, >> for 100 Hz: >> >> FREQ: 4968 >> FREQ: 5030 >> FREQ: 5056 >> FREQ: 4916 >> >> I would be interesting to hear any advise how to improve it. >> >> And another question is: what will be "pros" and "cons" to transform >> 10Mhz sine to square to feed MCU ? I tried it, but didn't catch any >> difference. >> >> Here is schema >> http://www.qsl.net/va3iul/Homebrew_RF_Circuit_Design_ >> Ideas/Sine-to-Square_Wave_BJT_Converter_Wenzel.gif >> >> >> -- >> WBW, >> >> V.P. >> _______________________________________________ >> time-nuts mailing list -- [email protected] >> To unsubscribe, go to https://www.febo.com/cgi-bin/ >> mailman/listinfo/time-nuts >> and follow the instructions there. >> > > > > -- > > Chris Albertson > Redondo Beach, California > -- Chris Albertson Redondo Beach, California _______________________________________________ time-nuts mailing list -- [email protected] To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.
