Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-16 Thread Tom Harris
Tom Harris celephi...@gmail.com


On 13 March 2014 01:21, Chris Albertson albertson.ch...@gmail.com wrote:

  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.


Never present the customer with this sort of message. Something like
optimising settings or contacting boot sever... OK. Makes them think
that they have got value for money.
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread Chris Albertson
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 t...@patoka.org 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: 16800 Hz
 SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
 1600 16001600

 # 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: 16800 Hz
 SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
 1680042008400

 # 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++  0xF0) {
 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 -- time-nuts@febo.com
 To unsubscribe, go to https://www.febo.com/cgi-bin/
 mailman/listinfo/time-nuts
 and follow the instructions there.




-- 

Chris Albertson
Redondo Beach, California
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread Chris Albertson
 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
albertson.ch...@gmail.comwrote:


 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 t...@patoka.org 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: 16800 Hz
 SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
 1600 16001600

 # 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: 16800 Hz
 SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
 1680042008400

 # 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++  0xF0) {
 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 -- time-nuts@febo.com
 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 -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread d0ct0r


I am using old Wavetek 180 signal generator for the tests. I just hooked 
its TTL output directly to the pin of MCU. The STM32F4xx has core clock 
168 mHz and its inputs capable to handle pretty wide range of frequency. 
I don't think 1-2 mHz connected to the pin should be a problem. At least 
in my setup it shows me adequate result for that frequency. But its 
slows done the main loop a lot because its interrupting million time 
per second. For 2 mHz input, I'll need to wait several seconds to see 
the result. Of course I could remove averaging or decrease number of 
samples to improve that time.
I am still thinking why I have incorrect results for low frequency. May 
be counter overflows could impact the result.
The counter for my timer is 16 bit. That means it will generate overflow 
after 65535 counts. The timer frequency is 168 mHz. Then it will 
overflows around every 400 uS (or 2563.5 Hz). Probably any frequency 
which is lower than 2.5 kHz will shows me incorrect results. Probably 
I'll need to think how to handle that.


Regards,

V.P.

On 2014-03-12 10:18, Chris Albertson 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 t...@patoka.org 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: 16800 Hz
SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
1600         1600        1600

# 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: 16800 Hz
SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
16800        4200        8400

# 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++  0xF0) {
            accum += deltaREF; // Moving Average
            accum = (accum  1);
        } else {
            uwTIM1Freq = (uint32_t) SystemCoreClock / accum;
            printf(FREQ: %ulnr, uwTIM1Freq);
            accum = j = 0;
        }
    }

The counter is based on timer in input capture mode and driven by
interrupt:
[ See STM32F4xx_StdPeriph_ExamplesTIMTIM_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

[1]

--
WBW,

V.P.
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts [2]
and follow the instructions there.


--

Chris Albertson
Redondo Beach, California

Links:
--
[1]
http://www.qsl.net/va3iul/Homebrew_RF_Circuit_Design_Ideas/Sine-to-Square_Wave_BJT_Converter_Wenzel.gif
[2] https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts


--
WBW,

V.P.
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread d0ct0r


LCD connected to the same MCU. And it has relation to the core clock 
too. So, nothing on LCD before I reset entire MCU. I think initial 
incorrect core clock reading cause a lot of issues. Probably my only 
option will be to implement some external relay and timer to turn on MCU 
few seconds after OCXO. Or may be to put 10Mhz oscillator to PCB and 
connect OCXO output in parallel to it (not sure if its good idea or it 
will works).


Regards,
V.P.

On 2014-03-12 10:21, Chris Albertson wrote:

 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
albertson.ch...@gmail.com 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 t...@patoka.org 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: 16800 Hz
SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
1600         1600        1600

# 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: 16800 Hz
SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
16800        4200        8400

# 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++  0xF0) {
            accum += deltaREF; // Moving Average
            accum = (accum  1);
        } else {
            uwTIM1Freq = (uint32_t) SystemCoreClock /
accum;
            printf(FREQ: %ulnr, uwTIM1Freq);
            accum = j = 0;
        }
    }

The counter is based on timer in input capture mode and driven
by interrupt:
[ See STM32F4xx_StdPeriph_ExamplesTIMTIM_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

[1]

--
WBW,

V.P.
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts [2]
and follow the instructions there.


--

Chris Albertson
Redondo Beach, California


--

Chris Albertson
Redondo Beach, California

Links:
--
[1]
http://www.qsl.net/va3iul/Homebrew_RF_Circuit_Design_Ideas/Sine-to-Square_Wave_BJT_Converter_Wenzel.gif
[2] https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts


--
WBW,

V.P.
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread cfo
On Wed, 12 Mar 2014 11:48:04 -0400, d0ct0r wrote:

 LCD connected to the same MCU. And it has relation to the core clock
 too. So, nothing on LCD before I reset entire MCU. I think initial
 incorrect core clock reading cause a lot of issues. Probably my only
 option will be to implement some external relay and timer to turn on MCU
 few seconds after OCXO. Or may be to put 10Mhz oscillator to PCB and
 connect OCXO output in parallel to it (not sure if its good idea or it
 will works).

You could start the MCU up on the internal clock , write to the lcd , 
wait 5 sec. And then switch to the external clock.


Btw: 
Is the Ext clock input on the STM fed directly from the OCXO ?
Can the STM handle the OCXO voltage swing ?

If you have a conditioning circuit betewwn the OCXO and the STM , i'd 
like to see it. As i have the need for one , trying to interface a 5v OCXO 
to a NXP 1114 Arm , that wants max 1.8v in the clockinput.

CFO

___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread Brian Lloyd
On Wed, Mar 12, 2014 at 10:48 AM, d0ct0r t...@patoka.org wrote:


 LCD connected to the same MCU. And it has relation to the core clock too.
 So, nothing on LCD before I reset entire MCU. I think initial incorrect
 core clock reading cause a lot of issues. Probably my only option will be
 to implement some external relay and timer to turn on MCU few seconds after
 OCXO. Or may be to put 10Mhz oscillator to PCB and connect OCXO output in
 parallel to it (not sure if its good idea or it will works).


Why not debounce reset from power-up using an RC network and a Schmitt
trigger? Set the time constant so that it will hold the mpu in reset until
power has been asserted long enough to ensure that the OCXO is producing
output.

-- 
Brian Lloyd, WB6RQN/J79BPL
706 Flightline Drive
Spring Branch, TX 78070
br...@lloyd.com
+1.916.877.5067
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread Chris Albertson
On Wed, Mar 12, 2014 at 9:10 AM, cfo xne...@luna.dyndns.dk wrote:

 On Wed, 12 Mar 2014 11:48:04 -0400, d0ct0r wrote:


 If you have a conditioning circuit betewwn the OCXO and the STM , i'd
 like to see it. As i have the need for one , trying to interface a 5v OCXO
 to a NXP 1114 Arm , that wants max 1.8v in the clockinput.


There are logic level converter chip made for this purpose or you can use a
comparator and compare the 5V clock to ground.  Or just a diode to clip the
sine wave.  If you connect a code.   Sometimes you can set buy with a pair
of resisters wired as a voltage divider.   I like the comparator best
because it will not load the clock.  Diodes will load it for other users.

-- 

Chris Albertson
Redondo Beach, California
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread Hal Murray

xne...@luna.dyndns.dk said:
 If you have a conditioning circuit betewwn the OCXO and the STM , i'd  like
 to see it. As i have the need for one , trying to interface a 5v OCXO  to a
 NXP 1114 Arm , that wants max 1.8v in the clockinput. 

What's wrong with a simple resistive divider?


-- 
These are my opinions.  I hate spam.



___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread cfo
On Wed, 12 Mar 2014 09:42:05 -0700, Chris Albertson wrote:


 There are logic level converter chip made for this purpose or you can
 use a comparator and compare the 5V clock to ground.  Or just a diode to
 clip the sine wave.  If you connect a code.   Sometimes you can set buy
 with a pair of resisters wired as a voltage divider.   I like the
 comparator best because it will not load the clock.  Diodes will load it
 for other users.

Could you come up with some part numbers please.

Ie. witch comparator would handle 10Mhz

CFO


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread Bruce Griffiths

Try:

http://www.linear.com/product/LTC6957

Bruce

cfo wrote:

On Wed, 12 Mar 2014 09:42:05 -0700, Chris Albertson wrote:

   
   

There are logic level converter chip made for this purpose or you can
use a comparator and compare the 5V clock to ground.  Or just a diode to
clip the sine wave.  If you connect a code.   Sometimes you can set buy
with a pair of resisters wired as a voltage divider.   I like the
comparator best because it will not load the clock.  Diodes will load it
for other users.
 

Could you come up with some part numbers please.

Ie. witch comparator would handle 10Mhz

CFO


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

   


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Frequency Counter using OCXO and MCU

2014-03-12 Thread Alex Pummer


Analog Devices, Linear Technology and Maxim have fast comparators
73
Alex


On 3/12/2014 11:02 AM, cfo wrote:

On Wed, 12 Mar 2014 09:42:05 -0700, Chris Albertson wrote:


There are logic level converter chip made for this purpose or you can
use a comparator and compare the 5V clock to ground.  Or just a diode to
clip the sine wave.  If you connect a code.   Sometimes you can set buy
with a pair of resisters wired as a voltage divider.   I like the
comparator best because it will not load the clock.  Diodes will load it
for other users.

Could you come up with some part numbers please.

Ie. witch comparator would handle 10Mhz

CFO


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


[time-nuts] Frequency Counter using OCXO and MCU

2014-03-11 Thread d0ct0r


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: 16800 Hz
SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
1600 16001600

# 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: 16800 Hz
SYSCLK_Frequency PCLK1_Frequency PCLK2_Frequency
1680042008400

# 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++  0xF0) {
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 -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.