STM32 GPSDO firmware Version v0.04e sees some code refactoring, improved comments, and a couple of new features:
- All voltage readings are now filtered using a moving average of 10 samples (10 seconds at 1 sample per second). I am using a neat Arduino library for this, movingAvg.
- GPS baud rate increased to 38400 from the default 9600. This is done in Setup using a $PUBX command sent to the u-Blox Neo-M8 GPS receiver. The increase in baud rate increases the "quiet time" when the MCU is not busy waiting for and processing messages from the GPS receiver.
- VTG messages (track made good and ground speed information) from the u-Blox Neo-M8 GPS receiver are disabled, again using a specific $PUBX command. These messages are not needed for a stationary application such as a GPSDO.
- Many, many small details fixed/improved in the source.
STM32 GPSDO
STM32 GPSDO YouTube video
I just uploaded a short (<5 minutes) video about the STM32 GPSDO on YouTube:
https://www.youtube.com/watch?v=mgoK4KuVDhw
Any suggestions on what subjects a follow-up video should cover?
https://www.youtube.com/watch?v=mgoK4KuVDhw
Any suggestions on what subjects a follow-up video should cover?
Version 0.04g with auto-calibration implemented
I have just uploaded to GitHub version v0.04g of the STM32 GPSDO firmware, and the big news is that this version implements a simple linear interpolation auto-calibration algorithm for the OCXO.
In previous versions of the firmware, any new OCXO had to be tested/characterized first before the firmware was compiled with an initial Vctl so that the frequency locked loop wouldn't take ages (hours or days depending on the OCXO) to reach 10MHz +/- 1ppb.
This auto-calibration takes just 30 seconds to run and calculates an approximate initial Vctl for 10MHz +/- 10ppb. The frequency locked loop then takes over and reaches +/-0.1 ppb in at most a few hours.
I have considered a PID algorithm but I am not sure the added complexity and time to reach a solution would be worth it.
In previous versions of the firmware, any new OCXO had to be tested/characterized first before the firmware was compiled with an initial Vctl so that the frequency locked loop wouldn't take ages (hours or days depending on the OCXO) to reach 10MHz +/- 1ppb.
This auto-calibration takes just 30 seconds to run and calculates an approximate initial Vctl for 10MHz +/- 10ppb. The frequency locked loop then takes over and reaches +/-0.1 ppb in at most a few hours.
I have considered a PID algorithm but I am not sure the added complexity and time to reach a solution would be worth it.
Re: STM32 GPSDO
Hello,
You can see here our GPSDO from SYRLINKS.
They use STM32
https://time-frequency.syrlinks.com/gns ... g-modules/
Cyril BOISSY
Syrlinks
You can see here our GPSDO from SYRLINKS.
They use STM32
https://time-frequency.syrlinks.com/gns ... g-modules/
Cyril BOISSY
Syrlinks
Re: STM32 GPSDO
Hello Cyril,CBoissy wrote: Mon Feb 28, 2022 9:00 am Hello,
You can see here our GPSDO from SYRLINKS.
They use STM32
https://time-frequency.syrlinks.com/gns ... g-modules/
Cyril BOISSY
Syrlinks
Very nice GPSDOs and the low power consumption is quite unique. Thank you for mentioning your products, and that they use STM32 MCUs. I really think the STM32 is - by far - the best MCU for such applications.
Re: STM32 GPSDO
I used the Arduino IDE 2.0.3,but some error issue to build STM32-GPSDO, the error information is:
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:53:1: warning: "/*" within comment [-Wcomment]
/* Commands to be implemented:
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:62:1: warning: "/*" within comment [-Wcomment]
/**********************************************************************************************************
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void Timer_ISR_2Hz()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:862:20: error: base operand of '->' is not a pointer
lsfcount = TIM2->CCR3; // read TIM2->CCR3
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void docalibration()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
18: warning: unused variable 'e1' [-Wunused-variable]
double f1, f2, e1, e2;
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
22: warning: unused variable 'e2' [-Wunused-variable]
double f1, f2, e1, e2;
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void displayscreen_OLED()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
9: warning: unused variable 'tempfloat' [-Wunused-variable]
float tempfloat;
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void setup()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
26: error: 'HERTZ_FORMAT' was not declared in this scope
tim2Hz->setOverflow(2, HERTZ_FORMAT); // 2 Hz
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
40: error: no matching function for call to 'HardwareTimer::attachInterrupt(void (&)())'
tim2Hz->attachInterrupt(Timer_ISR_2Hz);
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
40: note: candidate is:
In file included from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/wirish.h:49:0,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/WProgram.h:30,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\system/libmaple/Arduino.h:31,
from C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:113:
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: void HardwareTimer::attachInterrupt(uint8, voidFuncPtr)
void attachInterrupt(uint8 channel, voidFuncPtr handler) {
^
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: candidate expects 2 arguments, 1 provided
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
26: error: 'analogReadResolution' was not declared in this scope
analogReadResolution(12); // make sure we read 12 bit values when we read from any ADC analog channel
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
28: error: 'analogWriteFrequency' was not declared in this scope
analogWriteFrequency(2000); // default PWM frequency is 1kHz, change it to 2kHz
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
27: error: 'analogWriteResolution' was not declared in this scope
analogWriteResolution(16); // set PWM resolution to 16 bits (the maximum for the STM32F411CEU6)
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
19: error: 'GPIO_AF1_TIM2' was not declared in this scope
pinModeAF(PA15, GPIO_AF1_TIM2); // setup PA15 as TIM2 channel 1 / ETR
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
27: error: 'TIMER_INPUT_CAPTURE_RISING' was not declared in this scope
FreqMeasTim->setMode(3, TIMER_INPUT_CAPTURE_RISING, PB10);
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
7: error: base operand of '->' is not a pointer
TIM2->ARR = 0xffffffff; // count to 2^32, then wraparound (approximately every 429 seconds)
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
51: error: no matching function for call to 'HardwareTimer::attachInterrupt(void (&)())'
FreqMeasTim->attachInterrupt(Timer2_Overflow_ISR);
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
51: note: candidate is:
In file included from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/wirish.h:49:0,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/WProgram.h:30,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\system/libmaple/Arduino.h:31,
from C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:113:
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: void HardwareTimer::attachInterrupt(uint8, voidFuncPtr)
void attachInterrupt(uint8 channel, voidFuncPtr handler) {
^
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: candidate expects 2 arguments, 1 provided
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
7: error: base operand of '->' is not a pointer
TIM2->SMCR |= TIM_SMCR_ECE; // 0x4000
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
17: error: 'TIM_SMCR_ECE' was not declared in this scope
TIM2->SMCR |= TIM_SMCR_ECE; // 0x4000
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
25: error: 'AVREF' was not declared in this scope
adcVdd = analogRead(AVREF);
^
exit status 1
Compilation error: base operand of '->' is not a pointer
How to solve this issue. Thanks!
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:53:1: warning: "/*" within comment [-Wcomment]
/* Commands to be implemented:
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:62:1: warning: "/*" within comment [-Wcomment]
/**********************************************************************************************************
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void Timer_ISR_2Hz()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:862:20: error: base operand of '->' is not a pointer
lsfcount = TIM2->CCR3; // read TIM2->CCR3
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void docalibration()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
double f1, f2, e1, e2;
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
double f1, f2, e1, e2;
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void displayscreen_OLED()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
float tempfloat;
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino: In function 'void setup()':
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
tim2Hz->setOverflow(2, HERTZ_FORMAT); // 2 Hz
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
tim2Hz->attachInterrupt(Timer_ISR_2Hz);
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
In file included from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/wirish.h:49:0,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/WProgram.h:30,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\system/libmaple/Arduino.h:31,
from C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:113:
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: void HardwareTimer::attachInterrupt(uint8, voidFuncPtr)
void attachInterrupt(uint8 channel, voidFuncPtr handler) {
^
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: candidate expects 2 arguments, 1 provided
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
analogReadResolution(12); // make sure we read 12 bit values when we read from any ADC analog channel
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
analogWriteFrequency(2000); // default PWM frequency is 1kHz, change it to 2kHz
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
analogWriteResolution(16); // set PWM resolution to 16 bits (the maximum for the STM32F411CEU6)
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
pinModeAF(PA15, GPIO_AF1_TIM2); // setup PA15 as TIM2 channel 1 / ETR
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
FreqMeasTim->setMode(3, TIMER_INPUT_CAPTURE_RISING, PB10);
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
TIM2->ARR = 0xffffffff; // count to 2^32, then wraparound (approximately every 429 seconds)
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
FreqMeasTim->attachInterrupt(Timer2_Overflow_ISR);
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
In file included from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/wirish.h:49:0,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/WProgram.h:30,
from C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\system/libmaple/Arduino.h:31,
from C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino:113:
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: void HardwareTimer::attachInterrupt(uint8, voidFuncPtr)
void attachInterrupt(uint8 channel, voidFuncPtr handler) {
^
C:\Users\Administrator\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/HardwareTimer.h:200:10: note: candidate expects 2 arguments, 1 provided
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
TIM2->SMCR |= TIM_SMCR_ECE; // 0x4000
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
TIM2->SMCR |= TIM_SMCR_ECE; // 0x4000
^
C:\Users\Administrator\Downloads\ArduinoIDE\GPSDO_V006c\GPSDO_V006c.ino
adcVdd = analogRead(AVREF);
^
exit status 1
Compilation error: base operand of '->' is not a pointer
How to solve this issue. Thanks!
Re: STM32 GPSDO
Which core are you using ??skylin008 wrote: Sun Feb 05, 2023 12:42 pm I used the Arduino IDE 2.0.3,but some error issue to build STM32-GPSDO, the error information is:
...
Re: STM32 GPSDO
Thanks support. I had fix the issue. Now update the core to 2.04