Setting RTC to GPS with 1PPS precision working. Here is an example log:
20260217_200901_z set RTC to GPS using 1PPS pulse-per-second discipline rtc-gps drift=-28 s 20260217_201001_z set RTC to GPS using 1PPS pulse-per-second discipline rtc-gps drift=+0 s 20260217_201119_z set RTC to GPS using 1PPS pulse-per-second discipline rtc-gps drift=+0 s 20260217_201219_z set RTC to GPS using 1PPS pulse-per-second discipline rtc-gps drift=+0 s
This commit is contained in:
parent
21825c09c6
commit
5f5742f198
6 changed files with 1172 additions and 0 deletions
33
exercises/11_Set_RTC2GPS/README.md
Normal file
33
exercises/11_Set_RTC2GPS/README.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
## Exercise 11: Set RTC to GPS (1PPS Discipline)
|
||||
|
||||
This exercise extends Exercise 9 behavior (GPS + SD + OLED) and disciplines the onboard RTC from GPS UTC using the GPS `1PPS` (pulse-per-second) timing signal.
|
||||
|
||||
Implemented behavior:
|
||||
|
||||
1. Boots PMU, OLED, SD watcher, and GPS UART using the same T-Beam Supreme pin mapping from prior exercises.
|
||||
2. Parses NMEA (`RMC`, `GGA`, `GSV`) to track UTC validity and satellite counts.
|
||||
3. Every 1 minute, attempts to set RTC from GPS:
|
||||
- Uses latest valid GPS UTC.
|
||||
- Waits for next `1PPS` rising edge.
|
||||
- Sets RTC to GPS time aligned to that edge (UTC + 1 second).
|
||||
4. Appends event records to SD file:
|
||||
- Path: `/gps/discipline_rtc.log`
|
||||
- Append-only writes (`FILE_APPEND`)
|
||||
- Format:
|
||||
- `YYYYMMDD_HH24MISS_z\t set RTC to GPS using 1PPS pulse-per-second discipline\trtc-gps drift=+/-Ns`
|
||||
5. OLED success message shows RTC disciplined confirmation and timestamp.
|
||||
6. If GPS time cannot be determined (or 1PPS edge is not seen in timeout), OLED shows failure status and the loop delays 30 seconds before retry.
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
source /home/jlpoole/rnsenv/bin/activate
|
||||
pio run -e node_a
|
||||
```
|
||||
|
||||
## Upload
|
||||
|
||||
```bash
|
||||
source /home/jlpoole/rnsenv/bin/activate
|
||||
pio run -e node_a -t upload --upload-port /dev/ttyACM0
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue