In the previous part I described the hardware. So now it is time to write about the software.
First let's summarize what the software needs to do. The TruePosition board implements practically all function of the GPSDO, so we don't have to deal with processing GPS messages or implementing frequency counting or anything else like that. Except for one thing, the TruePosition board would only need power to operate. The one thing is that it won't boot without getting the $PROCEED command via its serial interface. So the bare minimum software is something that send this command and stops. But, of course that is not enough. I want a cool instrument with blinkenlights!
I have to admit that the firmware for this instrument was developed/evolved during some time, while simultaneously learning TruePosition, STM32-Arduino and the u8g2 graphics library. As a result, the code quality is far from best.
Design goals and features
I came up with some design goals and required features for the software:
- Implement basic functions to drive the TruePosition board. Sent the startup command and any additional configuration command. Monitor status of the board.
- Provide a usable, concise and aesthetic user interface. Provide means to get detailed data but also have a 'quick glance' way to see the current state.
- Provide configurable option for timezone, display backlight and position.
- Be robust. The instrument should tolerate and if possible recover from any issue and notify the user on them.
Basic structure
The development environment was the Arduino implementation for STM32. I initially though that the simple Arduino structure of setup() and loop() was not going to be enough, and I would need to step up to some more complex solution such FreeRTOS, but eventually it turned out to be sufficient.
The basic structure of the firmware actually very much follows this pattern. After setting up the display, serial lines, etc. it goes into a loop, where it reads character from the GPSDO, detects key presses, handles timing and updates the display and LEDs if required. If enough character is read so that a complete message is received then it is processed. Same for the key presses.
The main loop checks if messages are received from the TruePosition. If they do not appear for a length of time, then the GPS lost message is displayed and the Fail LED is lit. This should not happen in normal operation unless the board stops working or the serial connection is disconnected.
If the boot message is received, the firmware send the $PROCEED command to initiate the booting and waits for the first $STATUS message at which time the GPSDO is considered initialized.
The User Interface
For main user interface there is a 128x64 pixel bitmap LCD. Obviously a much simpler display would also work, but it looks cool. Incidentally the bulk of the code is about creating the pages for this LCD.
There are two buttons, the Mode and the Select. The Mode button cycles between the pages. On some of these pages the short press of the Select will chose between options and the long press will activate that option. Finally, there are four LEDs. One is for power, on the left side of the front panel, which is always green as long as the device is switched on. The other leds are on the right to the display. The green LED indicates the Locked state. So if there are two green then he GPSDO is locked and operating properly. The next LED is yellow, which is on if the GPSDO is in Holdover. Finally the red LED indicates fault condition, like disconnected antenna. Additionally there are other states and transitions, like startup or acquisition indicated by blinking and/or combinations of the LEDs.
These are the display pages.
1 - General status page. This is the default page. The status bar shown the current status (such as locked, holdover, etc.). There is an icon to indicate whether the TruePosition is in normal or survey mode. An antenna symbol shown that an antenna is detected and finally there are two indicators for the operation of the 10Mhz and 1PPS output. Although I have never seen the GPSDO board indicate that these are not operational.The current time is displayed, as well as how long the device has been locked or in holdover.
Finally at the bottom the number of satellites tracked, the DOP value, the control voltage for the oscillator and the temperature is shown.
2 - The next page is the clock page. Current time and date and the quality of the timing is shown as well as an analog clock.3 - Then comes the satellites page. The left shows the constellation and on the right the list of satellites. SNR is a small bargraph in front of each satellite data row in the list.
4 - The position page comes next. Latitude, longitude, elevation and number of satellites are displayed. Pressing the Select button increases the survey time while long press of the same button initiates a survey.
5 - The final page is the configuration page. Short press of select cycles trough the lines and long press changes that line. Yes, it is not the most ergonomic solution.
The first line sets the time-offset from -12 to +12 hours. The next sets the backlight to always on, always off and automatic. These settings are not persistent, unless saved using the Save config line. The last line is 'Load last position'. When the configuration is saved, the current position is saved. However, as opposed to backlight and timezone offset it is not automatically reloaded at startup. Instead this menu can be used to load the position, to speed up acquisition.
The source code and the KiCAD files are available under GPL V3 on Github: https://github.com/szigix/YATPGPSDO
Hey. Nice project :) Is there a specific reason why you used a big and heavy transformer instead of a switching power supply?
ReplyDeleteHi, Thanks.
DeleteYes, there is a reason. I had one it in my stash of components, waiting for some useful purpose :-)
Also, neither space nor weight was really an issue, as long as it fit the case, which I also already had. So kill two birds with a stone, get rid of a transformer and a case and have a useful instrument instead.
Nice work, thanks for posting. For a variable frequency disciplined oscillator see my article in QEX Sept 2018 or my website at https://clearskyinstitute.com/ham/gps.
ReplyDeleteThanks!
DeleteYour project is very nice. If I understand correctly, you are not using any short term reference (crystal) but directly steering the DDS with the GPS. Cool.
Great project.
ReplyDeleteI have not understood which data packets the GPS decodes.
TSIP or NMEA?
Great project.
ReplyDeleteI have not understood which data packets the GPS decodes.
TSIP or NMEA?
The trueposition board handles the GPS itself. It should be possible to get the NMEA sentences out from the board, from the Furuno rceiver I don't use it. The TruePosition board emits some NMEA like sentences, those are decoded in the firmware. But I'm not aware that they are any standard, they are sepcific to the TruePosition. They are describen in an EEVBlog post: https://www.eevblog.com/forum/projects/gpsdo-loss-of-satellitesfix-troubleshooting/msg1281700/#msg1281700
DeleteThanks,
DeleteI have a Trimble NTPX26AB GPS receiver, with 10 Mhz controlled output.
This unit provides Trimble Standard Interface Protocol (TSIP) data.
Dear Happy Engineer,
ReplyDeleteI'm trying to compile your code but get the error:
D:\Dropbox\YATP GPSDO\YATPGPSDO\YATPGPSDO.ino: In function 'void setup()':
YATPGPSDO:68:10: error: 'struct EEPROMClass' has no member named 'init'
EEPROM.init();
^~~~
Can you help? Thanks!
(board selected: Generic STM32F1 Series)
I need to check that, if you need to install any library for that. I'll get back to you on this.
DeleteHi, I'm using Generic STM32F103C Series as the controller. And nothing special. #include is there in the source. I'm not sure why you get the error message.
DeleteHow can I order a pcb from JLCPCB? Are the gerbers available? They are not on github, just your design files. I don't have kicad.
ReplyDeleteThanks
Mitch
Hi Mitch. Gerbers are now on Github.
DeleteHi, sorry, i just saw your comment. I will generate the gerbers and will put it on github, just give me a couple of days. Jlcpcb is very easy, it's pretty much fully automated. Upload the gerbers, pay, and wait for the postman. BTW I suggest you try KiCad, it is becoming a very decent tool, especially with the new version 6.
ReplyDelete