Author Topic: Using ESP32 and Neo-7N for precise frequency measurement  (Read 14057 times)

0 Members and 1 Guest are viewing this topic.

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Using ESP32 and Neo-7N for precise frequency measurement
« on: September 07, 2018, 12:36:54 pm »
I've found some older topic where both ESP32 and Neo-7N was mentioned but scope was rather signal reference than measurement so I've decided to create this topic.

After trying some cheap ready built OLED frequency meters from e-bay and from elsewhere (all were basically crap, not coming even close to a device using a half decent TCXO) I've decided to build one by myself.
ESP32, which I was familiar from other projects, looked as a good candidate and also found some examples about the PCNT usage and using RMT for gating.
I've had naturally some reservations about how good clock source ESP32 can have to use RMT for gating but nevertheless it was easy to check.
(As prescaler currently I use Fujitsu mb506, the leftover of the OLED meter, but plan to extend the range with HMC434.)

Result: ESP32 clock drifts something like 2ppm within 15 minutes from cold start in a stable temperature room.
Certainly better than the OLED variant that I've bought, but still not good enough even for my hobbyist use, and although I'd like to build something cheap, I'm still willing to invest a bit more to make it better.

So I've looked for a better gating source and found that Neo-7N gives out a high precision 1 sec period pulse signal by default. The pulse is 100ms and there is 900ms low value. To keep things simple I could directly use this with ESP32, use the 900ms low (negative) value as gate and process the measured counts in the remaining 100ms time.

There is a big question though that I've found no answer so far and I have nothing to check this (not even the GPS module, let alone any capable measuring device). So I understand that the period of the pulse is high precision but how about the 100ms/900ms division or other words has the 90% duty cycle similar precision as the period?
Has anyone experience with this or could check please?
« Last Edit: September 10, 2018, 01:25:26 pm by edigi »
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement and GPSDO
« Reply #1 on: September 10, 2018, 01:21:34 pm »
I've tried to check an answer to my question in various threads in eevblog and what I've realized that quite many people are planning to build (or has already built) their own GPSDO (many of which is based on some Neo GPS variants).
I don't know what are the precision expectations, but if one does not need very high precision that is the simplest case 0.01ppm (10 ppb) is sufficient or in a more demanding case 0.001ppm (1 ppb) a very simple setup can do it (so it makes me wonder why no-one has come up with the idea, or what are the pitfalls).

So to ramp up some interest let's see the bill of materials:
ESP32: ~7 USD
Neo 7N: ~12 USD (you could use also the cheaper 7M)
AD9834 DDS board: ~15 USD (in the more demanding case AD9910 but there is a diminishing return since AD9910 is not so cheap)
So core material is in the magnitude of ~35USD in the simplest case
+ probably some TFT display+rotary encoder etc. where you mileage may vary.

So basically instead of building a tailored PLL with special loop filter simply measure the frequency of the output of the DDS using the GPS for gating and after some digital filtering (in simplest case some averaging of the successive frequency measurements) the ESP32 can easily adjust DDS as needed to compensate for the error of the DDS reference clock source (that can be done in case of AD9834 with 28 bits precision, for practical purposes actually one bit less/nyquist theorem).

Since the ESP32 can measure up to 40MHz out of the box (there is only 15bit for counting, but on overflow an interrupt can be generated so counting can use as many bits as you wish) it's quite good match with the AD9834. Since prescalers (obviously) cannot increase the precision of the measurement, (gating) period must be extended to at least 3 sec for this use case even with AD9834 (ten times more with AD9910).

This design has the advantage that you can set arbitrary frequency reference (hence the rotary encoder) as after all that's the purpose of DDS and can have e.g. both sine and square right out of the box (depending on the DDS with very little phase noise + various extras that's available in the DDS). The disadvantage that without the GPS assistance the built in XO is probably very far behind an OCXO and is even probably well behind a good TCXO (I have checked this with ADF4351 of which I have 2 different designs, even the better one is only 2ppm and the worse is something like 10ppm).
However even with occasional (self) "calibration" with the GPS reference (so after all it's not necessary to connect the GPS all the time if less precision is OK, calibration offset can be saved to flash) the long term stability can be improved even probably beyond a good OCXO.

So what do you think?
Note: I used ADI products in my description (basically as example) as those are that I'm familiar with but this does not mean that you could not use many similar products as well (so as short disclaimer: I don't have any affiliation with ADI or any other vendor).


« Last Edit: September 10, 2018, 01:24:58 pm by edigi »
 

Offline ArthurDent

  • Super Contributor
  • ***
  • Posts: 1193
  • Country: us
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #2 on: September 10, 2018, 09:56:27 pm »
I see a lot of buzz words and part numbers being thrown around but I'm not sure I see any real application information to connect any of this stuff together to make a working system. I wish you luck.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #3 on: September 10, 2018, 10:56:45 pm »
I have a vaguely similar interest in making this sort of project (if only because i have most the parts lying around), and would be quite interested in playing along at home with your build.

However, I wonder if people have a real use for a 10 ppb reference. I could see it being handy for checking calibration, but that is about it. Most of the world seems to be built on +/- 1% for most specs, and maybe +/-50ppm for frequency (about that of a cheap XTAL)

What are you going to do for an antenna?

Fun fact #1 - the clocks on-board the GPS Space Vehicles are not super-accurate in terms of absolute time keeping or frequency, but they are very predictable. Each Space Vehicle  transmits the coefficients for a polynomial equation, that is used to map the on-board time to back to the GPS time standard, for the current few days.

Fun fact #2 - GPS time also has been known to be break:

http://insidegnss.com/news/gps-experiences-utc-timing-iif-satellite-launcher-problems/
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Online DimitriP

  • Super Contributor
  • ***
  • Posts: 1307
  • Country: us
  • "Best practices" are best not practiced.© Dimitri
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #4 on: September 10, 2018, 11:49:04 pm »
Quote
So what do you think?

You seem to describe something that resembles this:

http://www.knology.net/~gmarcus/VFO/GPS_Sig_Gen_v1_1.pdf
   If three 100  Ohm resistors are connected in parallel, and in series with a 200 Ohm resistor, how many resistors do you have? 
 
The following users thanked this post: edigi

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4782
  • Country: pm
  • It's important to try new things..
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #5 on: September 11, 2018, 10:11:12 am »
I've been using an NEO-7M and an stm32 (with some additional circuitry and an OCXO) as a DYI counter.

NEO-7M:
1. 1PPS RMS jitter value as per spec is 65ns (in reality better, but it may depend an many factors)
2. NEO-7M can provide "any" ref freq at 1PPS pin - from 0.25Hz to 12MHz (you must configure the NEO-7M)
3. some output clocks (like the 10MHz) are "broken" (see the other threads with that topic), so I was using in my early experiments 12/8MHz as the REFclock for an reciprocal counter - with such an setup you may get 8 digits

Counter:
1. I would not use 1PPS directly for "gating" the input frequency and counting the pulses (the traditional old school counter)
even it is feasible with the 1sec 1PPS (mind the one-shot jitter there)
2. Use an "reciprocal counter design" instead
3. use the NEO for disciplining an OCXO and use the OCXO as the ref clock - the NEO's mid term stability is low (but better than a cheapo crystal), while the long term stability is high.

PS: fyi - with NEO's 12MHz ref clock (at its 1PPS pin) I saw around 450ps rms jitter (with my 150ps rms resolution measurements) with an external antenna (the cheapo 28dB one) and 6-8 sats in green.
« Last Edit: September 11, 2018, 11:18:21 am by imo »
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #6 on: September 11, 2018, 01:35:45 pm »
However, I wonder if people have a real use for a 10 ppb reference. I could see it being handy for checking calibration, but that is about it. Most of the world seems to be built on +/- 1% for most specs, and maybe +/-50ppm for frequency (about that of a cheap XTAL)

What are you going to do for an antenna?

Any RF engineer will frown on this who needs (at least occasionally calibrated) accurate reference? E.g. it's very typical to down mix. Also it's not uncommon (especially for hobbyist use) to down mix narrow band signals. From this on it's probably easy to figure. Sure for many digital stuff it does not matter.

For trialing this kind of things either a good/affordable reference is required or measuring frequency with some precision. So maybe a 2ppm signal does not sound too bad. At 2.2GHz (lowest value of the VCO of the ADF4351) this is around 4 KHz. Once not so far in the past I had the idea of using the ADF4351 as signal source. There are several examples/cook books on the net about this. There are however some trade offs, as outside of the VCO range it outputs a divided down, thus square like signal. Also it cannot go below 34.375 MHz by its own.
So let's mix (as with this a huge range can be covered). I've actually made this exercise. To throw in even more part numbers beyond the ADF4351 I've used a mini circuits SIM-73L+ (what I like/so great about this mixer that it can mix with such low level LO that the ADF's output can be directly used without anything like balun, amplifier etc.) + ADF4355 (apart from register structure it's very similar to ADF4351 so for trialing the same cookbook can be used).
So let's down mix to e.g. 12 MHz. Oh wait, the 4 KHz  drift is still there but it's not 2ppm anymore...

You mean the GPS antenna I guess. Some cheapo stuff but may I could also build it from wires (basically nothing) if I'm really pushed.

I see a lot of buzz words and part numbers being thrown around but I'm not sure I see any real application information to connect any of this stuff together to make a working system. I wish you luck.

Connecting the RF stuff I've used SMA male to male cables so far and for the digital part some Dupont wire. Really nothing else.  :) True that I did not factor these in in the bill of materials as I have some of these lying around (although SMA stuff may actually be not so cheap). So connecting stuff together is mostly SW, not HW (where except for the averaging there are tons of SW examples on the net, e.g. for the ADF4351 I found at least 3, I've found DDS code as well for many DDSs), however I'd still like to avoid that due to limitation of the building components SW connecting cannot work even in theory, hence this thread.

Note: I've started out this thread as precise frequency measurement but as you can see thing are interchangeable and so wondered to GPSDO now. One of them is needed but having one, the other can be created with relative ease.

Quote
So what do you think?

You seem to describe something that resembles this:

http://www.knology.net/~gmarcus/VFO/GPS_Sig_Gen_v1_1.pdf

Exactly. Apart from using the more powerful ESP32 that does not need the extra circuitry for dividing down the signal (so less components, really just wiring; and also conversion can be faster) it pretty much covers what I've tried to describe.
As the AD9850 seems to have more bits so tuning can be more precise.
So to me it's not obvious at first checking what does actually limit the precision only to 0.3Hz @ 10 MHz. Anyhow, it's pretty much in the expected range.

So after all the idea existed quite some time already, just people are oriented towards the more specialized PLL+ special loop filter direction (that unfortunately cannot be built from off the shelf generic boards).

Counter:
1. I would not use 1PPS directly for "gating" the input frequency and counting the pulses (the traditional old school counter)
even it is feasible with the 1sec 1PPS (mind the one-shot jitter there)

But it would not be one shot, several measurements averaged so jitter averaged out. Look the conversion figure and the description of the linked material.


Well, it was a good discussion, thanks especially for DimitriP for the link.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #7 on: September 11, 2018, 06:48:14 pm »
I've been using an NEO-7M and an stm32 (with some additional circuitry and an OCXO) as a DYI counter.

NEO-7M:
1. 1PPS RMS jitter value as per spec is 65ns (in reality better, but it may depend an many factors)
2. NEO-7M can provide "any" ref freq at 1PPS pin - from 0.25Hz to 12MHz (you must configure the NEO-7M)
3. some output clocks (like the 10MHz) are "broken" (see the other threads with that topic), so I was using in my early experiments 12/8MHz as the REFclock for an reciprocal counter - with such an setup you may get 8 digits

Any chance you share more info about your counter? In case your design allows 10MHz OCXO/VTCXO, it basically is (supposedly) low cost GPS-disciplined 10MHz reference clock, good enough for most hobby labs and not only. Currently 10MHz GPSDO's on eBay are going for 160..200$.
 

Offline mino-fm

  • Regular Contributor
  • *
  • Posts: 143
  • Country: de
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #8 on: September 12, 2018, 08:11:38 am »
For precision frequency measurement you don't need a GPSDO. An 1 pps signal is sufficient for 7 – 8 digits/s.
I can give you some (german) information about a counter, which has two input channels: one to measure input frequency and a second one for measurement of internal reference clock generated by crystal, TCXO or OCXO.

A simple version uses ATmega162 which provides two input capture units. One channel offers 4 mHz – 50 MHz at 7 digits/s. The other one accepts 1 pps signal from a cheap GPS-module (EM-406A). Comparing (computing) the relation of input frequency and 1 pps pulse will give the true result: http://mino-elektronik.de/fmeter/fm_software.htm#bsp2 Here you can find a picture (demonstration board): https://www.mikrocontroller.net/topic/241150#2467565

The same GPS stabilising I use at other counters with STM32F407: http://mino-elektronik.de/FM_407/fmeter_407.htm. The last one of these counters offers up to 10 digits/s: http://mino-elektronik.de/FM_407/fmeter_407.htm#c3.

Of course you can use a GPSDO but it is not mandatory.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #9 on: September 12, 2018, 08:35:00 am »
For precision frequency measurement you don't need a GPSDO.

Besides frequency counter, there are other instruments that needs frequency reference like generators, spectrum analyzers and so on.
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #10 on: September 12, 2018, 01:58:25 pm »
For precision frequency measurement you don't need a GPSDO. An 1 pps signal is sufficient for 7 – 8 digits/s.

Yes, that was the idea in my first post. I have no doubt now that it can work and I can hardly wait the GPS module that I've bought to arrive.
For the frequency measurement no DDS is needed but it's good to have some kind of prescaler (like MC12080 used in the linked description or the Fuji MB506 that I use) but those are so cheap (1 USD per part) that doesn't even worth mentioning.

As no answer arrived at that point to my question I've started to look around and found that for what most people use the GPS module is to build a GPSDO but I started wondering why most people seem to use special PLL instead of the simpler DDS (ready made cheap boards available), since the DDS is more flexible that is if you need 10 MHz (that most measuring devices use) you can set that or if you need 25 MHz you can set that or basically any value (which can have also its own good use e.g. ADF4351 VCO can be stepped only with FREF/4096 step, however if one can change the FREF in very fine steps that limitation is also very easy to overcome...).
 

Offline mino-fm

  • Regular Contributor
  • *
  • Posts: 143
  • Country: de
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #11 on: September 12, 2018, 03:24:17 pm »
For precision frequency measurement you don't need a GPSDO. An 1 pps signal is sufficient for 7 – 8 digits/s.

Yes, that was the idea in my first post.

Please tell us which resolution do you expect (digits/s) and about your desired input frequency range. You should use reciprocal counting in any way. Don't thing about gatetimes of 1 s or something like that.
I don't know anything about ESP32 but if you are familiar with this chip, you should know more about its internal timers and capture units. This could solve your problem with little extra hardware like D-FF, inverter and GHz prescaler as desired.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #12 on: September 12, 2018, 07:03:24 pm »
I started wondering why most people seem to use special PLL instead of the simpler DDS (ready made cheap boards available)

Most likely just because VCO approach of building GPSDO is more mature/popular and usually lower cost as well.

Quote
ADF4351 VCO can be stepped only with FREF/4096 step, however if one can change the FREF in very fine steps that limitation is also very easy to overcome...

Don't. Fractional-N or Integer-N synthesizer is worst thing you can use to build reference oscillator. Compare phase noise specs of ANY synthesizer to what you can get with DDS and you will see why.

http://www.analog.com/en/analog-dialogue/articles/dds-vs-analog-pll.html

Because of the frequency division, C-DDS-based solutions have a clear advantage over analog PLL synthesizers in output phase-noise. The output phase noise of a C-DDS synthesizer is actually better than that of its reference clock source, while analog PLL-based synthesizers have the disadvantage of actually multiplying the phase noise present in their frequency reference.
« Last Edit: September 12, 2018, 07:09:35 pm by ogden »
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #13 on: September 13, 2018, 11:50:54 am »
For precision frequency measurement you don't need a GPSDO. An 1 pps signal is sufficient for 7 – 8 digits/s.

Yes, that was the idea in my first post.

Please tell us which resolution do you expect (digits/s) and about your desired input frequency range. You should use reciprocal counting in any way. Don't thing about gatetimes of 1 s or something like that.
I don't know anything about ESP32 but if you are familiar with this chip, you should know more about its internal timers and capture units. This could solve your problem with little extra hardware like D-FF, inverter and GHz prescaler as desired.

Expected digits are in the above mentioned 7-8 range, that translates to 10-100 million counts needed per measurement. As apart from references I'm mostly interested in the RF range so the 1s gating is more than perfect, but as all of this SW based, if my need changes I can easily adjust.

ESP32 is nothing special, there are quite many different micro controllers that one can buy cheap (ATmega, STM32) but ESP32 is probably newer/more powerful and most devkits with WiFi and BT support (that I don't use in this case). It has 8 independent counting channels, that can be separately gated (from internal remote controller logic) or externally (pins as you wish, so it's just SW which is the gating and which is the counting input).
There are several examples (just google github ESP32 frequency counter) but almost all, if not all are broken as the authors nicely forget about that the HW can automatically continue from upper limit after zeroing and generate an interrupt at the same time so count length as you wish, but it's easy to fix (also it can count on both edges so e.g. 25 MHz generates 50 million counts; tested with 25MHz TCXO. Note: multi channel high frequency measurement can have issues due to the massive amount of interrupts generated but I've never tried this as this is way beyond my needs).
The logic interface is super fast, once I've tried it with a 100 MHz TCXO, it measured it as 20 MHz, if you're familiar with sampling you know why but my point is that it had no trouble with the 100 MHz signal...
I also have a ready made 8GHz 1000:1 ratio prescaler (input side is either HMC434 or some PLL that has pins for both divider input and output; never bothered to check) but I don't particularly like these high ratio dividers as precision is lost unless one is willing to wait quite long for the measurement (so they are really good only for the high frequency side).
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #14 on: September 13, 2018, 12:06:12 pm »
Note: multi channel high frequency measurement can have issues due to the massive amount of interrupts generated

Not true. 32 bit counter overflows at 2^32 = 4.3 billion counts. This means that gating (timer capture) interrupts will be more frequent than timer overflow interrupts. If you are using 16 bit counter for frequency measurement application, you are simply not using right parts. Other possibility: you are building your frequency counter wrong way.
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #15 on: September 13, 2018, 12:34:29 pm »
Note: multi channel high frequency measurement can have issues due to the massive amount of interrupts generated
This means that gating (timer capture) interrupts

Nope, gating is full HW without any interrupts, please try to read the specs before you make such bold statements and also there is no 32 bit counter either that you seem to miss also from my earlier post in this very topic (not to mention the spec again).
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #16 on: September 13, 2018, 12:50:24 pm »
Note: multi channel high frequency measurement can have issues due to the massive amount of interrupts generated
This means that gating (timer capture) interrupts

Nope, gating is full HW without any interrupts, please try to read the specs before you make such bold statements

Oh my :palm:

Please try to read as well. I said "gating (timer capture) interrupts". Don't you see timer capture mentioned? For someone familiar with hardware timers it shall be obvious what actually I did mean.

I mean timer capture and it's following interrupt initiated by gate timer (hardware) signal. Comprehendo?

Quote
and also there is no 32 bit counter either that you seem to miss also from my earlier post in this very topic (not to mention the spec again).

I love when people create unnecessary problems just to struggle solving them. Some form of EE masochism? Why don't you just pick MCU with 32bit timer?!
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #17 on: September 13, 2018, 01:25:20 pm »
Let's cut this discussion short: I don't have any issue with the counting and it's precision (it's already 7-8 digits). The issue is that the gating signal currently from XCO does not have long term (due to e.g. aging) or even mid/short term stability (due to temperature change). Actually counting precision is so good that I can see even the sub KHz warm up drift of the signal in 2 GHz range. That is what the pps signal from GPS expected to solve as it has super long/mid term stability.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #18 on: September 13, 2018, 01:42:52 pm »
That is what the pps signal from GPS expected to solve as it has super long/mid term stability.

You have other option as well - use 8MHz (or other integer ratio to 48 MHz), reciprocally measure your reference oscillator against GPS freq. Such way you possibly can have faster lock times after power-on. While local oscillator is not locked, you can use GPS freq as reference frequency source.
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #19 on: September 13, 2018, 03:25:28 pm »
That is what the pps signal from GPS expected to solve as it has super long/mid term stability.

You have other option as well - use 8MHz (or other integer ratio to 48 MHz), reciprocally measure your reference oscillator against GPS freq. Such way you possibly can have faster lock times after power-on.

OK, it can be done, not exactly the way as you've described (as internal XCO is not surprisingly also the measurement limit + I'd like to stick to ready made dev board, without extra discrete components, and also there is no easy access to the internal XCO signal in case of most boards as due to WiFi there is shielding) but I can measure in this way the gating precision and correct based on that, all SW again). A bit of flexibility gained probably but via some more complexity (not much by its own, but I have many other things to do as well). I'll decide when the GPS module arrives if it worth for my case the extra effort. I also would not like to loose the possibility of WiFi as it can have also its own advantages (like wireless logging, control etc).
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #20 on: September 13, 2018, 05:06:50 pm »
OK, it can be done, not exactly the way as you've described (as internal XCO is not surprisingly also the measurement limit + I'd like to stick to ready made dev board, without extra discrete components, and also there is no easy access to the internal XCO signal in case of most boards as due to WiFi there is shielding) but I can measure in this way the gating precision and correct based on that, all SW again). A bit of flexibility gained probably but via some more complexity (not much by its own, but I have many other things to do as well). I'll decide when the GPS module arrives if it worth for my case the extra effort. I also would not like to loose the possibility of WiFi as it can have also its own advantages (like wireless logging, control etc).

Indeed it can be done. At least on 1$ stm32. What I did tell you - was not question :D Also It can be done exactly the way I tell you. I am tired of challenges and don't want money of kids learning electronics, so you better just trust me.

I am afraid that you do not receive what I am saying. - Most likely because englisch is not my native language.

When I say "faster lock times" I actually mean "faster (DDS) frequency acquisition time to required precision". My suggestion does not require any access to XCO. Only additional circuit what's needed - signal wire that routes GPS module output clock to timer input clock pin.

Disclaimer: I am stm32 guy, know nothing about esp32 timers and do not plan to learn them. Also I don't plan to analyze which of my suggestions can be implemented on esp32 or particular devboard you use. Just if it is possible with generic stm32  - I suppose it can be done and I shoot it out.

« Last Edit: September 13, 2018, 05:14:00 pm by ogden »
 

Offline edigiTopic starter

  • Regular Contributor
  • *
  • Posts: 184
  • Country: hu
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #21 on: September 14, 2018, 09:11:13 am »
Indeed it can be done. At least on 1$ stm32. What I did tell you - was not question :D Also It can be done exactly the way I tell you. I am tired of challenges and don't want money of kids learning electronics, so you better just trust me.

It seems that you're obsessed with the idea that the only good way how it can be done is how you do it (both HW and SW) where in reality many solution variants exists that are roughly similar and can produce exactly the same result.

Let me reflect one thing that I did not want to reflect originally (and use it as an example). I use in my current solution zero number of timing interrupts because it's not needed, yet it can count with arbitrary precision (so precision is determined how long one is willing to wait for the counting. I'm willing to wait currently max 8 digits/magnitude of a second but if I wanted counting could be 15 digits precision also).

The HW does the counting by itself including the HW gating control. If gating signal allows it starts/continues if does not allow it stops/suspends by its own. The gating signal is also HW generated. The SW determines how many interface cycles (ABP clock) the gating should be allowed and the HW plays that. Of course the gating cannot be more precise than the clock source of the controller since it's a divided down version of the controllers clock and that naturally drifts. This was the issue that I was seeking a solution not counting precision (as most people seem to believe).

I'd not even trust any kind of timing interrupt precision here. Back early in my engineering carrier (decades ago) it was common practice to write codes for micro controllers in assembly (or check it in assembly) and count how many clocks cycles instructions use and if it can meet timing requirements.
You had total control both the HW and the SW.

Things have changed a lot since then and like it or not (it's still better to prepare for it) today even micro controller like thingies are multiple core (ESP32 is in fact dual core and this is what is/will be the trend) and have become so fast that caching is unavoidable.

So maybe it's possible to get down interrupt precision to the level of few microseconds but definitely not to nanoseconds because of multi-core and cache misses etc. and gating precision has to be interface clock precision or more that is in case of a 80 MHz interface is in the ballpark of 10 nanoseconds or less (it never hurst to have more precision and 10ns for 8 digits in 1sec measurement sounds a good target to me).

It does not mean that one never needs interrupts related to gating. E.g. if the time difference between measurements is so low (sub millisecond; I'd be too lazy to do it for a generous 100ms) then one needs to assign an interrupt for the gating signals edge that ends the measurement to notify the SW to start as quickly as possible collecting the result and reset counters before the next measurement starts. Here again can be multiple good solutions how the SW part that does the real job is notified (since in ISR one cannot spend too much time).

So all in all, please stop pushing your ideas. Although probably I did not get it totally (like it's visible I still don't see the need for gating timer interrupts) but I've seen enough of it that I can judge that I don't need it. Also I haven't faced any limitation that would force me to switch platform (in the middle of my hobby project for couple of bucks that I don't even need to spend since I have couple of spare controllers lying around , fracture of my budget for this hobby project). If I meet such limitation, I'll switch and I'm quite confident that as I could learn by myself ESP32, quite many various PLL/VCOs or DDS I'll be able to learn enough of any controller that I can use it for my needs.


 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #22 on: September 14, 2018, 09:41:38 am »
Indeed it can be done. At least on 1$ stm32. What I did tell you - was not question :D Also It can be done exactly the way I tell you. I am tired of challenges and don't want money of kids learning electronics, so you better just trust me.

It seems that you're obsessed with the idea that the only good way how it can be done is how you do it (both HW and SW) where in reality many solution variants exists that are roughly similar and can produce exactly the same result.


Really? Seems, your problems are far worse than you think mine are. You better stop your attitude and before you even consider to draw discussion into personal insults  - read this book, from cover to cover:

http://leapsecond.com/hpan/an200.pdf

You said "it can be done, not exactly the way as you've described. I corrected you "It can be done exactly the way I tell you". Please show me where I say "this is only good way how it can be done"?

Indeed you can measure frequency and time many ways. And many are "good ways". Read the book and you will see.  :rant:
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #23 on: September 14, 2018, 09:58:36 am »
So all in all, please stop pushing your ideas.

Brilliant. So you think you own this thread and if my input is not important to you - I shall stop writing here?  :-DD

[edit] Actually good idea. I will not waste my time for such an arrogant person. Bye. Have a nice design.
« Last Edit: September 14, 2018, 11:57:05 am by ogden »
 

Offline mino-fm

  • Regular Contributor
  • *
  • Posts: 143
  • Country: de
Re: Using ESP32 and Neo-7N for precise frequency measurement
« Reply #24 on: September 14, 2018, 10:48:22 am »
Let me reflect one thing that I did not want to reflect originally (and use it as an example). I use in my current solution zero number of timing interrupts because it's not needed, yet it can count with arbitrary precision (so precision is determined how long one is willing to wait for the counting. I'm willing to wait currently max 8 digits/magnitude of a second but if I wanted counting could be 15 digits precision also).

Don't be silly!
To get 8 digits/s your gated counter needs input frequencies >= 100 MHz. Any prescaler will reduce resolution obviously.
A reciprocal counter will give you 8 digits/s @ >= 1 kHz even if you are using your GHz 1000:1 prescaler. A reciprocal counter needs some SW calculation (especially 1/x) but counting and synchronising is done by hardware. Interrupts are NO problem!
I guess you are afraid of interrupts.

Your 15 digits precision looks very nice. Take your >= 100 Mhz signal and wait for 116 days for each result.
Do what you like to do but don't be silly.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf