Link to the GPS Hat you purchased? And a link to any instructions you followed to connect the GPS and the RTC.
The link to the GPS hat is :
https://learn.adafruit.com/adafruit-ult ... i/overview
The instruction to connect the GPS as a RTC is:
https://frillip.com/raspberry-pi-stratum-1-ntp-server/
Are you sure that the Pi is pulling the updated time from the onboard RTC or is it using NTP to update the time and the RTC isn't being used at all. I do know from having the non-hat version of the Ultimate GPS that the onboard battery does store the ephemeral data from the GPS constellation, but I haven't used the Hat with the onboard RTC.
I am sure that the time is pulled from the onboard RTC of the GPS module because I disabled any internet communication (including WiFi) and the time is updated properly after the mentioned delay. The HAT version should work in the same fashion than the non-hat as the GPS chip is the same.
How is the Python program invoked? Is it a systemD service or tacked on to the end of rc.local?
I am new to linux and raspberry pi world, so please accept my apologies if I cannot use the proper terms. My python program is invoked at boot up by modifying the crontab as follow:
And add the following line:
Code: Select all
@reboot sh /home/pi/..../data_capture_launcher.sh >/home/pi/logs/cronlog 2>&1
The data_capture_launcher.sh is an executable file:
Code: Select all
#!/bin/sh
# data_cature_launcher.sh
cd /
cd home/pi/Github/RPi_Camera_Reader
sudo python mainDataCapture.py
cd /
If you can help us out with a little more detail and possibly some examples of the code being used we can help troubleshoot your problem. (Also, the AdaFruit forums are a great resource, have you checked out that area and look to see if there are others experiencing the same issues?)
I checked the AdaFruit and your forum and found other posts about this clock update delay problem but, to the best of my knowledge, could not find any information that explains the reason why it is occurring and possibly how to reduce it.
My application targets autonomous driving where the RPi is powered-on when the car starts. Data (from camera, GPS, etc.) must be saved locally as soon as possible in files whose names include the time of creation, hence getting it from the OS clock by using the "datetime.now()" function of the python "datetime" module. Because the clock retains a previous value, I noticed that the last created data files are either overwritten or data are appended to them which is not the behavior expected as we want new files to be created with the current time stamp (when the car starts).
This would not be a problem if we can wait for the clock to update, but for our application, waiting about 1min 20 sec to start collected data is too long. That is why I would like to know if there is a way to reduce the time update the clock.
Let me know if you need more information or a better explanation, and some code.