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

0 Members and 3 Guests are viewing this topic.

Offline bob91343

  • Super Contributor
  • ***
  • Posts: 2675
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #575 on: March 01, 2022, 06:29:55 pm »
I still am not getting any OCXO control voltage from the black pill.  Everything else seems to work.  The OCXO is putting out a 10 MHz square wave but it's a few Hz low in frequency.  The GPS receiver is putting out precisely 1 PPS.  Its yellow LED is flashing once per second.  The blue LED on the black pill is flashing once per second (not precisely).  I have everything wired up as per the diagram.

What do I do now?
 

Offline bob91343

  • Super Contributor
  • ***
  • Posts: 2675
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #576 on: March 01, 2022, 08:20:07 pm »
Here is what I have.
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #577 on: March 02, 2022, 12:21:51 am »
 Got it to work. I had used outdated circuit diagram Ver 0.2, resulting in a reversed PPS and 10MHz pins.
 :-/O

Now it works like a charm.

Instant
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #578 on: March 02, 2022, 01:07:01 am »
...
Now it works like a charm.
...

Well done.   :clap: :clap:
Please post a few pics of your working STM32 GPSDO when you have the time.
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #579 on: March 02, 2022, 01:54:14 am »
Thanks again for all the help. Hopefully I can return the favor to someone
 

Offline bob91343

  • Super Contributor
  • ***
  • Posts: 2675
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #580 on: March 02, 2022, 01:59:14 am »
Andrew, are you ignoring me?  I need a bit of help here but nobody has stepped up.  I feel there is something awry with the black pill.
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #581 on: March 02, 2022, 10:38:26 am »
Andrew, are you ignoring me?  I need a bit of help here but nobody has stepped up.  I feel there is something awry with the black pill.

(replied to Bob by PM, to avoid polluting the thread)
« Last Edit: March 02, 2022, 11:21:04 am by AndrewBCN »
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #582 on: March 02, 2022, 10:45:12 am »
Thanks again for all the help. Hopefully I can return the favor to someone

Looks good to me, but I am not seeing the two 10µF capacitors required by the PWM DAC. Did you use two 10nF ceramic capacitors by mistake?
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #583 on: March 02, 2022, 04:17:30 pm »
Wow, good eye, Andrew. This is what I get with a disordered junk box.

Turns out they're 10nF capacitors; this would yield two 314Hz LPF in series. They should be 314KHz LPF, right?

Somehow it is working splendidly. Using a Leo Bodnar GPSDO as reference (I don't assume it is gold standard BTW) for my HP frequency counter, I find the STM32 GPSDO is 100% concordant with it. 100% match down to hundredths of a Hertz over several hours.

Will have to drill down as to why the LPF error is not impacting circuit in way that I can immediately discern. WIll fix and report back.

And I guess I'll be selling my Leo Bodnar GPSDO.

Instant
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #584 on: March 02, 2022, 04:36:02 pm »
disregard my LP filter calculations...messed up the math.

What I am presently using with great results is a two pole LPF filter with cutoff frequency of 796 Hz (R=20kohm, C=0.01 uF). Somehow it's working.

WOndering how you picked the LP filter you did Andrew?

Instant
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #585 on: March 02, 2022, 06:49:12 pm »
...
What I am presently using with great results is a two pole LPF filter with cutoff frequency of 796 Hz (R=20kohm, C=0.01 uF). Somehow it's working.
...

It's somehow working because the OCXO is modulating its 10MHz output with the remaining 2kHz ripple on Vctl, and the FLL algorithm removes that modulation. However, I do recommend you stick to the values on the schematic diagram (10µF capacitors), which will provide a "clean" DC Vctl to the OCXO. You want as much as possible to remove any ripple on the PWM Vctl, so 10µF is 1000x better than the 10nF ceramic capacitors you are using.

It doesn't make much sense to leave tens of mVs 2kHz ripple on the 16-bit PWM Vctl, which in theory has a resolution of around 5µV.
« Last Edit: March 02, 2022, 09:24:07 pm by AndrewBCN »
 

Offline iannez

  • Regular Contributor
  • *
  • Posts: 64
  • Country: it
Re: Yet another DIY GPSDO - yes, another one
« Reply #586 on: March 02, 2022, 10:46:45 pm »
Good evening everyone,
I inserted some other feature in the serial screen as shown in the attached photo.

I inserted the trend on the last 10 PWM adjustments, in the square brackets the current value.
I then inserted the PPM value and the frequency drift.
Obviously you can also adapt to various LCDs.

These activities will serve to enumerate the PWM changes regarding the frequencies and then apply the variable PWM transmission over time to arrive first to maximum stability.

Otherwise you have to wait 429s (timer2 overflow) for each change of PWM, sometimes, especially initially, too long.

See you soon, A.
 
The following users thanked this post: AndrewBCN

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #587 on: March 03, 2022, 10:41:05 pm »
Is there secret magic to receiving the Bluetooth serial output? I enabled the Bluetooth #define in code, and I'm able to pair HC-06 to my android device running Bluetooth Serial Monitor. It connects, but no serial output is received or displayed. What might I be missing here?
Thanks
Instant
 

Offline nealix

  • Regular Contributor
  • *
  • Posts: 76
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #588 on: March 03, 2022, 10:53:15 pm »
@AndrewBCN:

What is the latest version of the schematic, and have you considered adding a folder in your GITHUB project for the schemtic (both PDF and KiCad format) so
that interested parties can find it more easily?      I "think" the current version of the schematic that I have is ver 0.2, in PDF only.

Cheers,

Neal
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #589 on: March 03, 2022, 11:45:43 pm »
Is there secret magic to receiving the Bluetooth serial output? I enabled the Bluetooth #define in code, and I'm able to pair HC-06 to my android device running Bluetooth Serial Monitor. It connects, but no serial output is received or displayed. What might I be missing here?
Thanks
Instant
Yes, there is a tiny bit of magic:  ;) Note that it's not really a secret, as it's clearly mentionned in the source code.  :o

You need to flash the Bluetooth HC-06 module for a name and higher baud rate. Check the "extra" folder on GitHub, you can find the Arduino sketch for this bit of "magic" there.
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #590 on: March 03, 2022, 11:48:39 pm »
@AndrewBCN:

What is the latest version of the schematic, and have you considered adding a folder in your GITHUB project for the schemtic (both PDF and KiCad format) so
that interested parties can find it more easily?      I "think" the current version of the schematic that I have is ver 0.2, in PDF only.

Cheers,

Neal

Hi Neal, the latest schematic is version 0.6.2 and it's linked in the first post in this thread. And yes, I need to update the GitHub archive, it's on my TODO list.  :o
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #591 on: March 05, 2022, 02:43:34 am »
I'm a neophyte...

I flashed the HC-06 config.ino file from the extras folder. I assume that means loading it via the STM32 dfu bootloader via arduino IDE. then reloading the GPSDO.ino.

Still think I'm missing something. I reviewed all the files and code for clues, but still can't receive the serial flow. though i am able to connect and pair with HC-06.

tnx

Instant
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #592 on: March 05, 2022, 04:03:13 am »
...
I flashed the HC-06 config.ino file from the extras folder. I assume that means loading it via the STM32 dfu bootloader via arduino IDE. then reloading the GPSDO.ino.
That is 100% correct. Well done.  :-+

Still think I'm missing something. I reviewed all the files and code for clues, but still can't receive the serial flow. though i am able to connect and pair with HC-06.
...
Right now the Black Pill and the HC06 module are talking with different baudrates, that's why it's not working. You'll always be able to pair, but nothing will show on your smartphone.
When you run the HC06 flashing program, it gives you some messages on the serial monitor, to confirm (or not) the correct configuration of the Bluetooth module. What messages did you get?

 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Using Bluetooth with the STM32 GPSDO
« Reply #593 on: March 05, 2022, 12:02:12 pm »
Here is a summary of how to add the HC-06 Bluetooth interface module to the STM32 GPSDO.

Introduction
The HC-06 Bluetooth interface module is a serial-to-Bluetooth converter, costing around $5. It connects to one the various UART interfaces available on the STM32F411CEU6 MCU.

Connecting
There are four steps to connecting the STM32 GPSDO to the Bluetooth interface of your smartphone or PC:

  • Wire the HC-06 module: TX, RX, Vcc and Gnd. See the STM32 GPSDO schematic diagram.
  • Configure the HC-06 module baudrate and interface name and save the configuration on the HC-06 flash. This only needs to be done once. There are various ways to do that, but the simplest way is to use the Arduino sketch available in the extra folder on GitHub, which uses the BlackPill itself to configure and flash the HC-06 module. Note that you have to download this sketch to the Black Pill, which erases any previous sketch on it. When running the sketch, take note of the messages it sends on the Arduino serial monitor, which confirm (or not) if the HC-06 was correctly flashed.
  • Enable the Bluetooth interface in the STM32 GPSDO source code in the configuration section, recompile and flash again the Black Pill with the GPSDO code.
  • On your PC or smartphone, pair with the HC-06 Bluetooth module and launch a Bluetooth serial terminal program.

Usage
You will get exactly the same messages as on the Arduino USB serial monitor, with the advantage that you no longer need a cable or a bulky PC to connect to the STM32 GPSDO.  8)

Debugging
If you are able to pair with the HC-06 module but you are not getting any messages on the Bluetooth serial terminal on your smartphone   :wtf: , the most likely cause is that the HC-06 was incorrectly configured (is not using the correct baudrate to talk to the Black Pill) during step 2 above. Just repeat step 2 until you have your HC-06 correctly configured (hint: read the source code).
« Last Edit: March 05, 2022, 12:21:25 pm by AndrewBCN »
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #594 on: March 05, 2022, 12:29:29 pm »
Code: [Select]
07:26:42.600 -> Done setting HC06, turn off development board now
so it flashed to hc-06.

I'll keep trying to solve. Though I'm able to pair and connect with HC-06, I can't read any serial stream on either PC (Win 11) or Android smartphone.

thanks

Instant

 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #595 on: March 05, 2022, 01:37:43 pm »
Code: [Select]
07:26:42.600 -> Done setting HC06, turn off development board now
so it flashed to hc-06.
...

You can check whether or not it flashed the HC-06 if the Bluetooth device name has changed, and I assume in your case it didn't.  :--

Every time you run the program, you must check for a proper response from the HC-06 module (a string beginning with "Response=...").

As I wrote above, read the code. If you run the sketch as-is, it will fail because it assumes the HC-06 is already set at 115200, you have to change the line
Code: [Select]
Serial2.begin(115200);  // serial to Bluetooth moduleto
Code: [Select]
Serial2.begin(9600);  // serial to Bluetooth module
and then set the Bluetooth interface name.

In a second step, you have to comment out the name setting part and uncomment the baud rate part.

Also note that once you have changed the baudrate to 115200, the program itself must be modified again since the HC-06 baudrate will be 115200.

Yes, it's a bit of a chicken and egg problem,  :P

Code: [Select]
// Very short program just used to configure HC-06 Bluetooth modules
// for name and baud rate, using AT commands
HardwareSerial Serial2(PA3, PA2);   // Serial to Bluetooth module


void setup() {
  // put your setup code here, to run once:
  Serial1.begin(9600);  // serial to GPS module
  Serial2.begin(115200);  // serial to Bluetooth module
 
  Serial.begin(115200); // USB serial

  Serial.print(F("Check HC-06 module version, set baud rate to 115200 and rename to GPSDO1"));
  Serial.println();
  // check module version
  Serial2.println("AT+VERSION"); // module should answer with HC06 version
  delay(1500);
  if (Serial2.available()) Serial.println("Response="+Serial2.readString());
  // change BT module name
  Serial2.println("AT+NAMEGPSDO1"); // change 1 to 2 or 3 or etc
  delay(1500);
  if (Serial2.available()) Serial.println("Response="+Serial2.readString());
  // Change BT module baud rate (default is 9600)
//  Serial2.println("AT+BAUD8"); // 8=115200 
//  delay(1500);
//  if (Serial2.available()) Serial.println("Response="+Serial2.readString()); 
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Done setting HC06, turn off development board now");
  delay(5000);
}
« Last Edit: March 05, 2022, 01:44:51 pm by AndrewBCN »
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #596 on: March 05, 2022, 05:23:15 pm »
Well, maybe I'm at my limits of understanding arduino/c++ code.

I implemented your suggestions, and I'm just getting the same message in serial monitor:
Code: [Select]
07:26:42.600 -> Done setting HC06, turn off development board now
I get no other messages.

I wonder if I'm not running serial monitor properly and am missing messages. I open the serial monitor as soon as I compile and flash in arduino IDE. The name simply won't change.

The library books on C++ seem too advanced for arduino ide. I need to learn more code...



Instant
 

Offline AndrewBCNTopic starter

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: fr
Re: Yet another DIY GPSDO - yes, another one
« Reply #597 on: March 05, 2022, 05:49:26 pm »
Well, maybe I'm at my limits of understanding arduino/c++ code.

I implemented your suggestions, and I'm just getting the same message in serial monitor:
Code: [Select]
07:26:42.600 -> Done setting HC06, turn off development board now
I get no other messages.

I wonder if I'm not running serial monitor properly and am missing messages. I open the serial monitor as soon as I compile and flash in arduino IDE. The name simply won't change.
...

You can have the serial monitor open before you download the program to the Black Pill, or you could add a
Code: [Select]
delay(10000); line of code just after the Serial.begin lines.

There are many ways to achieve the same result, just think about it calmly and I am sure you'll figure it out.
 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #598 on: March 05, 2022, 06:46:02 pm »
Regardless of serial2 baud rate (9600 vs. 115200), I get this serial message:

Code: [Select]
13:43:32.867 -> Check HC-06 module version, set baud rate to 115200 and rename to GPSDO1
13:43:49.333 -> Done setting HC06, turn off development board now

So it seems serial2 is not responding to AT commands...

I'll keep plugging away


 

Offline instantcrow

  • Contributor
  • Posts: 31
  • Country: us
Re: Yet another DIY GPSDO - yes, another one
« Reply #599 on: March 05, 2022, 07:56:03 pm »
it's working...but the character set must be wrong. there are hundreds from which to choose...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf