Author Topic: Yet another DIY GPSDO - yes, another one  (Read 150289 times)

0 Members and 2 Guests are viewing this topic.

Offline enut11

  • Frequent Contributor
  • **
  • Posts: 933
  • Country: au
  • Love building/modifying/restoring test equipment
Re: Yet another DIY GPSDO - yes, another one
« Reply #325 on: October 15, 2021, 08:31:22 pm »
@AndrewBCN quote:
"PS: I have just noticed that STM32 Core version 2.1 has just been released a few days ago. It is the version I recommend for use with the STM32 GPSDO firmware.
« Last Edit: October 11, 2021, 07:32:22 pm by AndrewBCN »"

The latest Core for my Black Pill F401CC is version 1.9. Is this a problem?
enut11

Yes. Actually it's the other way around, the earliest Core for the Black Pill F401CC was version 1.9. Please uninstall version 1.9 (simply delete the whole directory) and then reinstall 2.1 from this link: https://github.com/stm32duino/Arduino_Core_STM32/releases/tag/2.1.0

V1.9 STM32 Cores is the only option I have in the Arduino setup and I don't know how to update to the later version.

Is it possible to run the GPSDO with STM32 Cores V1.9?
« Last Edit: October 15, 2021, 08:33:17 pm by enut11 »
an electronics nut from wayback...
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #326 on: October 15, 2021, 08:44:44 pm »

Is it possible to run the GPSDO with STM32 Cores V1.9?

STM32 Core 1.9 and 2.0 have several bugs that are fixed in 2.1.

Please uninstall both the STM8 and STM32 support packages you have installed (deleting the directories should do it), and reinstall the STM32 Core 2.1 package following the instructions on GitHub. This should take less than 5 minutes.

You should not have the DEPRECATED warning if you follow the installation instructions correctly to install STM32 Core 2.1.

https://github.com/stm32duino/Arduino_Core_STM32/#getting-started

If you are still unsure, please create a thread in the STM32duino forum and ask for detailed instructions. https://www.stm32duino.com/viewforum.php?f=35
 

Offline GigaJoe

  • Frequent Contributor
  • **
  • Posts: 484
  • Country: ca
Re: Yet another DIY GPSDO - yes, another one
« Reply #327 on: October 15, 2021, 09:45:13 pm »
 Serial2.print("$PUBX,41,1,0003,0003,115200,0*1C\r\n"); // 115200
a bit faster ...
 

Offline enut11

  • Frequent Contributor
  • **
  • Posts: 933
  • Country: au
  • Love building/modifying/restoring test equipment
Re: Yet another DIY GPSDO - yes, another one
« Reply #328 on: October 16, 2021, 12:38:59 am »
When I add
https://github.com/stm32duino/Arduino_Core_STM32/releases/tag/2.1.0
to the Arduino IDE Preferences, the only option that I can see in the Board Manager for 2.1 support is the deprecated version.
A little lost at the moment...

Posted a help request on Arduino STM32 forum.
« Last Edit: October 16, 2021, 05:01:10 am by enut11 »
an electronics nut from wayback...
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #329 on: October 16, 2021, 06:54:28 am »
Uninstall then reinstall the Arduino IDE.

Then in File menu -> Preferences

The "Preferences" dialog will open, then add the following link to the "Additional Boards Managers URLs" field:

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

Then in Boards Manager dialog you should have the option to install STM32 Core 2.1 without the DEPRECATED warning.
 
The following users thanked this post: enut11

Online bingo600

  • Super Contributor
  • ***
  • Posts: 1976
  • Country: dk
Re: Yet another DIY GPSDO - yes, another one
« Reply #330 on: October 16, 2021, 08:00:22 am »
@AndrewBCN
You should edit your first post, and add an url to your github repos

/Bingo
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #331 on: October 16, 2021, 08:13:31 am »
...
You should edit your first post, and add an url to your github repos
...
The link to my GitHub repo has been in my first post since the very first day.
 

Online bingo600

  • Super Contributor
  • ***
  • Posts: 1976
  • Country: dk
Re: Yet another DIY GPSDO - yes, another one
« Reply #332 on: October 16, 2021, 08:19:45 am »
Whoopzz -  :palm:

But where is SerialCommands.h ??
Ahh .. found it , it's also in the library manager
https://github.com/ppedro74/Arduino-SerialCommands

Success
Code: [Select]
Sketch uses 72460 bytes (13%) of program storage space. Maximum is 524288 bytes.
Global variables use 94244 bytes (71%) of dynamic memory, leaving 36828 bytes for local variables. Maximum is 131072 bytes.
« Last Edit: October 16, 2021, 09:00:54 am by bingo600 »
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #333 on: October 16, 2021, 09:21:13 am »
Whoopzz -  :palm:

But where is SerialCommands.h ??
Ahh .. found it , it's also in the library manager
https://github.com/ppedro74/Arduino-SerialCommands

Success
Code: [Select]
Sketch uses 72460 bytes (13%) of program storage space. Maximum is 524288 bytes.
Global variables use 94244 bytes (71%) of dynamic memory, leaving 36828 bytes for local variables. Maximum is 131072 bytes.

Well done.  :-+

Are you just compiling the firmware for fun or are you actually building an STM32 GPSDO?
 

Online bingo600

  • Super Contributor
  • ***
  • Posts: 1976
  • Country: dk
Re: Yet another DIY GPSDO - yes, another one
« Reply #334 on: October 16, 2021, 09:30:24 am »
I'm preparing a bit.
But i need to finish my favorite PICDIV Clone (1-PPS source) as per here
https://www.eevblog.com/forum/projects/yet-another-diy-gpsdo-yes-another-one/msg3663190/#msg3663190
And will prob do an alternate PhaseDetector too.

Do you still use the DAC or was that replaced by PWM ?
What gives the best resolution / voltage stability ?
I have some DAC's here

/Bingo
« Last Edit: October 16, 2021, 09:34:08 am by bingo600 »
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #335 on: October 16, 2021, 11:23:58 am »
...
Do you still use the DAC or was that replaced by PWM ?
I have both the DAC and the PWM circuit installed in my two working prototypes, but of course Vctl is only connected to one, and it's the PWM for now. If I need to go beyond 16-bit resolution, I might cook up a circuit that uses both.
What gives the best resolution / voltage stability ?
The 16-bit PWM works fine, but I can't really compare effective resolution and stability between it and the 12-bit DAC. There's simply too much noise in my breadboard prototypes.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #336 on: October 20, 2021, 02:16:56 am »
I got my ublox NEO-M9N in and was impressed with how much stuff is flying around. Visibile was 14 GPS, 7 GLONASS, 7 Galileo, 5 BeiDou. For somebody born before Sputnik, this is impressive. Ok, there's a ton more Iridium, Starlink, etc flying around.

Anyway, does this really get us a lot when we're dealing with a basic 16MHz clock as far as jitter goes?
 

Offline MIS42N

  • Frequent Contributor
  • **
  • Posts: 510
  • Country: au
Re: Yet another DIY GPSDO - yes, another one
« Reply #337 on: October 20, 2021, 03:08:50 am »
I got my ublox NEO-M9N in and was impressed with how much stuff is flying around. Visibile was 14 GPS, 7 GLONASS, 7 Galileo, 5 BeiDou. For somebody born before Sputnik, this is impressive. Ok, there's a ton more Iridium, Starlink, etc flying around.

Anyway, does this really get us a lot when we're dealing with a basic 16MHz clock as far as jitter goes?
The M9N is a navigation module and has similar jitter of previous navigation modules. Other people have indicated for timing it is better to listen to only one constellation (e.g. GPS) as each constellation has slightly different time base. More important if using a specific timing module where the GPS module reports the correction to the 1pps and the processor can correct it down to ns level. With a naviagtion module just have to put up with the jitter and rely on the software to smooth it out.
 
The following users thanked this post: AndrewBCN

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #338 on: October 20, 2021, 01:24:43 pm »
STM32 GPSDO new layout on two breadboards with the picDIV clocked by the OCXO.

The picDIV is programmed to output three 1PPS signals: 1Hz square wave (not used), 10ms pulse here shown connected to a green LED (so I know it's working), 100µs pulse which will be connected to the TIC to measure its phase difference with the 1PPS from the u-blox NEO-M8N GPS module. The TIC will be configured to measure up to 1000ns phase difference with a theoretical resolution of 0.25ns, but I'll check and report the real resolution here.

Note the use of a separate LM317T voltage regulator module (top left) that supplies +5V to the OCXO @ 600mA during warmup, 200mA in normal operation. The LM317T is attached to a small heatsink and gets to around 45C in normal operation (at 20C room temperature), well within operating parameters.
« Last Edit: October 22, 2021, 03:42:14 pm by AndrewBCN »
 

Offline JBeale

  • Frequent Contributor
  • **
  • Posts: 298
Re: Yet another DIY GPSDO - yes, another one
« Reply #339 on: October 20, 2021, 02:40:32 pm »
This is a tangent to the original topic of this post, but I'm just wondering if the Raspberry Pi Pico device would be an interesting choice for this kind of project. The reason I'm thinking that is that it has some programmable state machines that can be synchronously clocked up to 200 MHz (unofficially, but in my experience reliably), and their I/O can both generate and detect pulses at Fclock/2 meaning 100 MHz or 10 ns timing resolution. As I recall a PIC does not go so high.  I have not studied the code closely, but I'm wondering if a Pico might be able to serve the function of both the STM32 and the picDIV parts of this project.  The Pico board is also generally cheaper than a STM32.
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #340 on: October 20, 2021, 04:35:54 pm »
This is a tangent to the original topic of this post, but I'm just wondering if the Raspberry Pi Pico device would be an interesting choice for this kind of project.
You can base your GPSDO on just about any MCU (or even no MCU at all), but your choice of MCU will essentially determine how much can be done in hardware and how much will have to be done in software. I chose the STM32F411CEU6 because it is a comparatively powerful, fast MCU, has tons of RAM and flash, and a number of very flexible peripherals and interfaces.

Just to give you one parameter that would automatically exclude the RP2040: it has a single, dedicated 64-bit timer with µs resolution (RP2040 datasheet page 555). By contrast, the STM32F411 has 2 x 32-bit and 6 x 16-bit general purpose timers with capture and external triggers all internally clocked at 48MHz, plus a few more dedicated timers. There is simply no comparison in terms of flexibility.

Also, note that unlike the STM32F411CEU6, the RP2040 has no 5V tolerant pins at all.

Finally, and I won't even go into the details here, but the availability of I/O libraries for the STM32F411 was paramount in the development of the STM32 GPSDO software.

The reason I'm thinking that is that it has some programmable state machines that can be synchronously clocked up to 200 MHz (unofficially, but in my experience reliably), and their I/O can both generate and detect pulses at Fclock/2 meaning 100 MHz or 10 ns timing resolution. As I recall a PIC does not go so high.  I have not studied the code closely, but I'm wondering if a Pico might be able to serve the function of both the STM32 and the picDIV parts of this project.

You are welcome to try and port both the STM32 GPSDO and the picDIV firmwares to the RP2040, but I would not underestimate the amount of programming and debugging required to make the RP2040 "state machines" do what you want. Some people like the challenge of "reinventing the wheel" for their hobby projects, but me, I'll pass. YMMV of course.

The Pico board is also generally cheaper than a STM32.

You must consider the cost of the MCU development board in relation to the total BOM cost for the project.
When you can find the Pico, it costs more or less the same as the STM32F411CEU6 Black Pill + a PIC12F675, that is < 10€ (including taxes and shipping), with perhaps a few euros difference. Personally I would consider a difference of a couple of euros to be relatively irrelevant in this sort of project.
« Last Edit: October 23, 2021, 11:11:22 am by AndrewBCN »
 

Offline rmozel

  • Newbie
  • Posts: 4
  • Country: tr
Re: Yet another DIY GPSDO - yes, another one
« Reply #341 on: October 20, 2021, 06:37:41 pm »

@JBeale
Exactly.
You may like to check Time Nuts forum for Marek Dorsic's PicoDIV/PicoPET (RP2040) and Jeremy Elson's $5 Timestamper (STM32G4xxx) entries.
 

Offline Johnny B Good

  • Frequent Contributor
  • **
  • Posts: 811
  • Country: gb
Re: Yet another DIY GPSDO - yes, another one
« Reply #342 on: October 21, 2021, 03:34:55 am »
@AndrewBCN

 Thanks for reminding us all of the pitfalls of trying to use the Arduino IDE with a Rpi Pico (and, of course all the other pitfalls). After my initial misguided enthusiasm in comparing it as "An STM32F411 on steroids", I have to admit I'd been somewhat conned by the marketing hype in its abilities, most notably its 133MHz clock speed and the statements made in regard of being able to use the Arduino IDE to program it.

 Whilst it has some very interesting features (IO with programmable state machine features) and can, in theory, be programmed using the Arduino IDE, this is of little use when, as you reminded us all, there is little to no library support for peripherals for those of us who'd rather not have re-invent wheels in order to transition away from the AVR based Arduino MCU boards to this more powerful version of a nano. This is an issue I discovered for myself several weeks back.

 No doubt, given enough time, we may yet see a build up of libraries to support the common peripherals (BMP280 and the SSD1306 being two of some interest to my current needs) but there's no guarantee that this will happen within the next 12 months considering that it was released to the market some ten months ago now.

 Trying to persuade the Pico to do something more interesting than simply blinking or fading its on-board LED has been an exercise in futility for me so far, so it looks like I'm stuck with the arduino nano mcu for the time being or else acquaint myself with an STM32F411 which looks to be a better way to combine the ease of the Arduino IDE with a more powerful MCU. Unfortunately, with all the chip shortages, now is not the best time to go shopping for any of these STM32F411 based mcu boards so I'll carry on as best I can with my stock of pre-chip shortage mcu purchases and just hope it's not too long before the situation improves.
« Last Edit: October 21, 2021, 01:04:42 pm by Johnny B Good »
John
 

Online bingo600

  • Super Contributor
  • ***
  • Posts: 1976
  • Country: dk
Re: Yet another DIY GPSDO - yes, another one
« Reply #343 on: October 21, 2021, 01:10:15 pm »
@JBG

You can still buy STM32F411 (Blackpill) at ebay or aliexpress , for a reasonable price.
For many things the "Little Brother" STM32F401 is fully capable (just a little less flash/ram)  , and it's close to ½ price.

/Bingo
 
The following users thanked this post: Johnny B Good

Offline Johnny B Good

  • Frequent Contributor
  • **
  • Posts: 811
  • Country: gb
Re: Yet another DIY GPSDO - yes, another one
« Reply #344 on: October 21, 2021, 04:11:48 pm »
@bingo600

 Thanks for that tip (although I'd rather deal with Banggood than AliExpress). I'll check out those sources and take my chances with one of them if the price hasn't been hiked up too much.  :)

 I've just had a quick look and my best bet (UK supplier with free three day delivery and VAT inclusive pricing) is this ebay item at £7.99 one off price :-

https://www.ebay.co.uk/itm/234243041497?hash=item3689f928d9:g:fPUAAOSwMjNhbaLK

 I haven't pulled the trigger (I'm thinking buying two - for a two off price of £15.66, possibly even three for £23.01).

Banggood only had the lower spec 401 modules at a vat inclusive £6.29 and free delivery. AliExpress otoh, had a whole bunch of the 411s on this page:-

https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20211021081453&SearchText=STM32F411

 I checked out the first one here:-

https://www.aliexpress.com/item/1005001798664558.html?spm=a2g0o.productlist.0.0.1526692e24npFI&algo_pvid=92a76e03-1c86-4c4b-a392-789fd089af88&aem_p4p_detail=20211021091454609157465904160010711167&algo_exp_id=92a76e03-1c86-4c4b-a392-789fd089af88-4&pdp_ext_f=%7B"sku_id"%3A"12000017626172510"%7D

 After adding the postage (10 day delivery) and 20% VAT onto the whole deal, it came to £7.08  Quite frankly, AliExpress is my last resort, either to buy an item not sold elsewhere or a widely available item that's outrageously overpriced by their competitors (mainly Amazon).

 The ebay seller seems to be my safest option (relatively local seller and ebay's money back promise when the seller fails to remedy any shortcomings). However, I thought I'd best seek your opinion on these options before placing my order.  :)
« Last Edit: October 21, 2021, 04:51:30 pm by Johnny B Good »
John
 

Offline Johnny B Good

  • Frequent Contributor
  • **
  • Posts: 811
  • Country: gb
Re: Yet another DIY GPSDO - yes, another one
« Reply #345 on: October 21, 2021, 04:56:48 pm »
@bingo600

 Just in case you missed my previous edited post... er, it's, well, been edited with the results of my search for suppliers.  :)

[EDIT] Never mind, I've pulled the trigger on that ebay order for three modules. They should be with me by Monday, just possibly even sooner.
« Last Edit: October 21, 2021, 06:50:23 pm by Johnny B Good »
John
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
STM32 GPSDO KiCad schematic version 0.6.1
« Reply #346 on: October 21, 2021, 05:40:47 pm »
Two small changes to the STM32 GPSDO KiCad schematic, so a schematic version bump from 0.6 to 0.6.1:

  • The MCU output pin that connects to the picDIV "Arm" input was changed from PB5 to PB3.
  • The MCU PB5 output pin now generates a 2kHz square wave test signal. As usual, this is optional and can be disabled in the source code.

 

Online bingo600

  • Super Contributor
  • ***
  • Posts: 1976
  • Country: dk
Re: Yet another DIY GPSDO - yes, another one
« Reply #347 on: October 22, 2021, 04:35:10 pm »
@JBG

The US seller is prob. as good as Ali.
The only reason for Ali would be price or WeAct (The original blackpill creator) , that still has a reputation of delivering 100% genuine STM chips
https://www.aliexpress.com/item/1005001456186625.html

Happy coding.

Ps: I hope you have a few USB-A to USB-C cables @home , the Blackpill uses USB-C
The Blackpill F401/411 can load the sw via USB DFU (load over usb cable) , so no jtag is needed for programming that one.
Allthough i'd prob recommend one anyway ... For advanced debugging.
https://www.ebay.co.uk/itm/292479630125

/Bingo
 
The following users thanked this post: Johnny B Good

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
picDIV traces
« Reply #348 on: October 22, 2021, 09:07:07 pm »
In the first attached DSO capture below, shown are the two rising edges for respectively:
- In Yellow, bottom trace, 1PPS from the GPS module. This has a typical peak +/- 10ns jitter when receiving 11~12 sats.
- In Green, top trace, 100µS pulse at 1Hz from the picDIV (10MHz from the OCXO divided by 10 million by the picDIV), aligned within 20ns manually by controlling Vctl from my smartphone via Bluetooth!  8)

Explaining: the DSO capture shows the time interval or phase difference in ns between the two positive edges from the 1PPS from the GPS module and the 1PPS from the picDIV (which is really the 10MHz from the OCXO divided by 10 million). By controlling the OCXO frequency one can bring down this time interval to approximately its "floor" value which is the jitter in the GPS 1PPS.

This is how any GPSDO based on a PLL works, essentially. In this case, for this shot I was acting as a "human PLL", by manually adjusting the Vctl of the OCXO.

So, how to automate this? This is where Lars' ingenious 1ns resolution TIC comes into play. I will be using Erik's version of Lars' 1ns resolution TIC to obtain a voltage proportional to the time interval between the two PPS edges. The voltage is then read by the STM32F411CEU6 ADC, and converted back into an approximate time interval value in nanoseconds.

So the next two steps are:
  • Wire the TIC and feed the MCU ADC with a voltage.
  • Program the PLL.

In the second DSO capture below: using the "Arm" pin on the picDIV, one can "synchronize" the 1PPS from the picDIV with the 1PPS from the GPS module. I have tested this repeatedly and this has always resulted in the same approximately 700ns delay between the two pulses, which is very convenient because it's almost midrange in the range of time intervals the TIC can measure (0 to 1000ns). To reduce this time interval to < 100ns one just "accelerates" the OCXO clock for a few seconds (by raising the Vctl value) while checking the value returned by the TIC. In an nutshell, that's (simplifying very much) how the PI algorithm in Lars' DIY GPSDO works.

Also note that the DSO measurement has itself a 2ns resolution (at 500M samples per second).

Finally: the objective of adding a picDIV and Erik's version of Lars' TIC (for a total cost of around 4€ and 100~200 lines of code) is to get a UTC aligned top-of-second PPS from the OCXO within an as small as possible time window, in this case, hopefully less than 100ns and ideally less than 50ns. This in turn will be passed on to an NTP/PTP server based on a 25€ STM32 Nucleo board to provide precise timing information to a local network.

Remember, the idea is to surpass the > $3000 to build (if you manage to purchase the "unobtainium" bits and pieces for it), > $3 million to develop, 200ns-accurate FacePlant GPSDO "Time Machine" with a solution that outperforms it by 100% and costs < 1/20th as much to build.
« Last Edit: October 23, 2021, 10:50:25 am by AndrewBCN »
 

Offline Johnny B Good

  • Frequent Contributor
  • **
  • Posts: 811
  • Country: gb
Re: Yet another DIY GPSDO - yes, another one
« Reply #349 on: October 23, 2021, 10:31:45 am »
@bingo600

 Thanks for the heads up on the USB A to C cable requirement. I only have, as far as I can see, just the one short cable which is most likely just a charging cable without the data wires. Possibly it may be a full lead just for the sake of being able to signal the higher charging current demand of the vaping stick it was supplied with but it looks like it would only be prudent of me to order a few 'spares' from ebay anyway just to be sure I can connect these modules to my desktop PC.

 Well, that's £10.11 blown on four cables (from four different UK based ebay sellers). I'd already stocked up on micro and mini B ended cables in 0.5 to 5 metre lengths including two or three 5 metre A plug to A socket extension cables so I think it would be a good idea to address this blind spot in my USB cable inventory. :)

 I don't mind this investment in C type ended USB cables since I've always regarded the micro B plug as an abomination that should never have been inflicted upon the general smartphone/tablet owning public in the first place - it's what the micro B connector should have been to begin with. The sooner all those USB micro B socketed devices end up in land fill and we can all forget that that mistake ever happened , the better afaic.  >:D
« Last Edit: October 23, 2021, 10:33:51 am by Johnny B Good »
John
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf