feat(gps): expose ESKF build profiles and 460800 UART

This commit is contained in:
2026-07-25 19:39:36 +03:00
parent ecbb8d0b68
commit 49b8609bb4
16 changed files with 393 additions and 39 deletions
+6
View File
@@ -46,3 +46,9 @@ external/gps/rtl/
pass this path as the default GPS_SYSTEM_DIR, so the Vivado flow does not
depend on a user-specific /home/... checkout.
```
GPS tracking olcum yolunun 20 ms Doppler/C/N0 snapshot, PCLK synchronizer,
APB register/interrupt ve software velocity WLS sozlesmesi
`external/gps/rtl/trck_src/README.md` icinde belgelenir. PPS PI periferigi,
runtime coefficient/lock register map'i ve fiziksel pin sinirlari
`external/gps/rtl/pps/README.md` icindedir.
+10
View File
@@ -47,6 +47,16 @@ The hardware does not add `POSTPONE_TOW`. Baremetal must commit an already
epoch-aligned GPS reference, so the verified 160 ms subframe readout correction
is owned exactly once by the navigation software.
Tracking C/N0 and Doppler are not inputs to the PPS RTL. The tracking wrapper
publishes those measurements through its separate 20 ms APB mailbox. Firmware
uses C/N0, geometry, WLS clock sigma, integrity and Doppler velocity residual
to select `acquire`, `precision`, `robust` or `holdover`, then writes the
corresponding PI coefficients, slew limit and lock thresholds through this
PPS mailbox. Doppler also predicts the WLS clock-bias datum between commits.
This keeps quality policy and the small navigation pre-filter in software
while the deterministic PI loop, fixed-point rate state and physical edge
generation remain in hardware.
The APB register offsets live in `pps_pkg.sv`. Multiword input fields are
shadow registers and must be followed by one `COMMIT` write. A new mailbox
must not be written while `STATUS.COMMIT_BUSY` is set.
+107
View File
@@ -0,0 +1,107 @@
# GPS tracking measurement yolu
Bu dizindeki tracking loop yalniz code/carrier takibi yapmaz; her 20 ms GPS
L1 C/A navigation-bit epoch'unda software'in C/N0 ve Doppler kullanabilmesi
icin atomik bir measurement snapshot'i da uretir.
## 20 ms snapshot
`tracking_measurement.sv`, ilk NAV-bit kenarinda accumulator'lari arm eder ve
sonraki her bit epoch'unda su alanlari birlikte latch eder:
```text
nav bit
ABS_SAMPLE
remaining code phase
signed carrier frequency, Q7
20 x prompt I toplami
20 x prompt Q toplami
20 x (I_prompt^2 + Q_prompt^2) wideband power toplami
sample count
16-bit sequence
```
Prompt energy `lock_detector.sv` icinde pipeline'li oldugu icin bit kenarindan
sonra dort tracking clock beklenir; bu, son 1 ms enerji terimini eski epoch'a
dahil eder ve yeni epoch ile karistirmaz. Snapshot ve `measurement_valid`
sonraki bit epoch'una kadar, yaklasik 20 ms sabit kalir.
## APB aktarimi ve interrupt
`apb_wrappers/tracking_wrapper.sv`, valid ve payload'un her bitini
`double_ff_syn` yardimcisi ile PCLK domainine alir. Bu yardimcinin mevcut
implementasyonu `stage_1`, `stage_2` ve registered `Dout` olmak uzere uc
register kademesidir. Kaynak payload 20 ms sabit kaldigi icin FIFO veya toggle
handshake kullanilmaz. Wrapper synchronized valid kenarindan sonra iki ek PCLK
settle cycle bekler, tum alanlari APB-domain register bankina ayni anda kopyalar
ve measurement interrupt/flag uretir.
Software sequence'i okumadan once ve payload'dan sonra tekrar okuyarak atomik
snapshot dogrulamasi yapar. Sequence degisirse okuma tekrar edilir; sequence
atlarsa kayip measurement diagnostics sayaci artar.
Measurement register offsetleri:
| Offset | Alan |
|---:|---|
| `0x50` | version, valid, NAV bit, lock ve sample count metadata |
| `0x54` | 16-bit sequence |
| `0x58` | signed carrier frequency Q7 |
| `0x5c` | ABS_SAMPLE |
| `0x60` | remaining code phase |
| `0x64` | signed prompt sum I |
| `0x68` | signed prompt sum Q |
| `0x6c` | wideband power low |
| `0x70` | wideband power high |
## Software'e verilen anlam
Carrier register'i toplam NCO frekansidir. Software IF merkezini cikarir:
```text
doppler_hz = carrier_q7 / 128 - 4092000
range_rate_mps = -doppler_hz * c / 1575420000
```
Pozitif received-frequency Doppler azalan geometrik range anlamina geldigi
icin range-rate denkleminde eksi isareti vardir.
C/N0, 20 prompt icin narrowband/wideband power estimator'i ile hesaplanir:
```text
R = (sum_i^2 + sum_q^2) / WBP
C/N0_linear = 1000 * (R - 1) / (20 - R)
C/N0_dbhz = 10 * log10(C/N0_linear)
```
RTL IIR uygulamaz. Ham snapshot debug ve yeniden tune icin korunur. ISR state'i
ayni PRN'de C/N0 icin `alpha=0.2`, Doppler icin `alpha=0.05` software IIR
uygular; reacquisition veya PRN degisiminde eski kanal state'i kullanilmaz.
Filtrelenmis range-rate, satellite ECEF velocity ve satellite clock drift ile
C/N0-weighted 4-state velocity WLS'ye girer:
```text
state = [receiver_vx, receiver_vy, receiver_vz, receiver_clock_drift_mps]
observation = measured_range_rate
- satellite_LOS_rate
+ c * satellite_clock_drift
H = [-u_x, -u_y, -u_z, 1]
```
WLS en az dort gecerli uydu ister; ECEF velocity, 3x3 covariance, receiver
clock drift ve residual RMS uretir. Fusion adapter velocity/covariance'i ENU'ya
dondurur ve ayri velocity NIS kapisi ile 15-state ESKF'ye verir.
## Dogrulama
```sh
make -C hardware/external/gps/rtl/trck_src/tb test
make -C soc/software/gps_system/tests run
make -C soc/software/gps_system/tests sanitize
```
Questa testleri 20 prompt akumulasyonu, snapshot hold, synchronizer settle,
atomik APB copy ve interrupt'i; Linux C testleri Q7 Doppler/range-rate, C/N0
estimator, coherent read, satellite velocity/clock drift ve weighted velocity
WLS/covariance yolunu kontrol eder.