Combine RF-001A clock verification and RX capture

This commit is contained in:
LittleSam129
2026-09-21 13:43:31 +03:00
parent fa370ccfa2
commit 1e3aa25d70

View File

@@ -1,7 +1,7 @@
TASK_ID = RF001A_CAPTURE_001 TASK_ID = RF001A_VERIFY_AND_CAPTURE_001
TASK_TITLE = Start RF-001A common-clock IQ capture TASK_TITLE = Verify RF-001A common clock and start IQ capture
SOURCE_BRANCH = video-development SOURCE_BRANCH = video-development
EXPECTED_HEAD = 442451bdfb32dd9016986611559d9204ebef7192 EXPECTED_HEAD = fa370ccfa23dedc633346d688547e9c1c77ff8eb
REQUIRES_APPROVAL = YES REQUIRES_APPROVAL = YES
HARDWARE_ACCESS = YES HARDWARE_ACCESS = YES
RF_RX = YES RF_RX = YES
@@ -17,9 +17,16 @@ If chat history conflicts with these files and current Git HEAD, stop and report
# Current RX task # Current RX task
TASK = TASK =
START RF-001A COMMON-CLOCK IQ CAPTURE VERIFY RF-001A COMMON CLOCK AND START IQ CAPTURE
This is a new task. Do not reuse approval or completion state from `RF001A_CLKIN_001`. This task requires its own explicit `[A] Approve` decision before any hardware access or capture starts. This is one combined YELLOW task. One explicit `[A] Approve` authorizes the bounded CLKIN verification, the bounded short RX-start and, only after that gate passes, the finite 20-second RX capture. Do not request a second approval between those steps.
Do not reuse the approval, state or completion record from either old task ID:
```text
RF001A_CLKIN_001
RF001A_CAPTURE_001
```
## 1. Preconditions ## 1. Preconditions
@@ -30,25 +37,70 @@ After approval, run `git pull --ff-only origin video-development`, then verify:
- local HEAD equals `origin/video-development` and `EXPECTED_HEAD` is its ancestor; - local HEAD equals `origin/video-development` and `EXPECTED_HEAD` is its ancestor;
- `hackrf_info` = PASS; - `hackrf_info` = PASS;
- RX serial = `000000000000000097c063dc2e5327d3`; - RX serial = `000000000000000097c063dc2e5327d3`;
- COMMON CLOCK = `VERIFIED` from completed task `RF001A_CLKIN_001`; - the physical cable is connected from MASTER CLKOUT to SLAVE CLKIN;
- the cable remains connected from MASTER CLKOUT to SLAVE CLKIN; - the existing hardware-independent shared RF-001A spec test passes:
- the command below contains the exact line `CLKIN status: clock signal detected`:
```powershell
python -B -m pytest tests/test_rf001a_prepare.py -q -p no:cacheprovider --basetemp .local/pytest-rf001a-verify-capture
```
If any precondition fails, do not start the short RX or the 20-second capture. Report the failed condition, keep `RF TX = 0`, and STOP.
## 2. Verify SLAVE CLKIN before RX
Run the official read-only partner-side check with the explicit RX serial and preserve its complete stdout:
```powershell ```powershell
& '<verified hackrf_clock.exe path>' -d 000000000000000097c063dc2e5327d3 -i & '<verified hackrf_clock.exe path>' -d 000000000000000097c063dc2e5327d3 -i
``` ```
Run the existing hardware-independent shared RF-001A spec test: Accept only the exact line:
```powershell ```text
python -B -m pytest tests/test_rf001a_prepare.py -q -p no:cacheprovider --basetemp .local/pytest-rf001a-capture CLKIN status: clock signal detected
``` ```
Require it to pass and confirm the shared spec matches the capture parameters below. If any condition fails, do not start `hackrf_transfer`. Report the failed condition, set `RX CAPTURE STARTED = NO` and `RX READY FOR TX = NO`, keep `RF TX = 0`, and STOP. Set `SLAVE CLKIN BEFORE RX = DETECTED` only when that line is present. Otherwise set `COMMON CLOCK VERIFIED = NO`, do not start the short RX or capture, keep `RF TX = 0`, and STOP.
## 2. Authorized finite RX capture ## 3. Bounded short RX-start
Only this finite capture is authorized: If SLAVE CLKIN was detected, perform one short, finite RX-start on the same device:
```powershell
& '<verified hackrf_transfer.exe path>' -d 000000000000000097c063dc2e5327d3 -r NUL -f 1400000000 -s 8000000 -n 65536 -l 0 -g 0 -a 0 -p 0 -B
```
This is RX only. It must not transmit. Require:
- exit code = `0`;
- exactly `65536` complex samples transferred;
- RX overruns = `0`;
- USB errors = `0`;
- file write errors = `0`.
If any condition fails, set `SHORT RX START = FAIL` and `COMMON CLOCK VERIFIED = NO`. Do not start the 20-second capture. Keep `RF TX = 0` and STOP.
## 4. Verify SLAVE CLKIN after RX
Immediately repeat the same read-only check and preserve its complete stdout:
```powershell
& '<verified hackrf_clock.exe path>' -d 000000000000000097c063dc2e5327d3 -i
```
Accept only the exact line `CLKIN status: clock signal detected`.
Set `COMMON CLOCK VERIFIED = YES` only when all three conditions pass:
- `SLAVE CLKIN BEFORE RX = DETECTED`;
- `SHORT RX START = PASS`;
- `SLAVE CLKIN AFTER RX = DETECTED`.
If CLKIN is not detected after the short RX-start, set `COMMON CLOCK VERIFIED = NO`, do not start the capture, keep `RF TX = 0`, and STOP. Do not alter clock configuration automatically.
## 5. Authorized finite RX capture
When and only when `COMMON CLOCK VERIFIED = YES`, continue immediately under this same task ID and the same YELLOW approval. Start this finite RX capture:
```text ```text
RX serial = 000000000000000097c063dc2e5327d3 RX serial = 000000000000000097c063dc2e5327d3
@@ -66,7 +118,7 @@ expected file size = 320000000 bytes
Create a new directory outside the Git checkout for every attempt. Use a timestamp plus a random suffix, refuse an existing path, and never overwrite an earlier capture. Keep the IQ file, stdout, stderr and metadata there. Do not add them to Git. Create a new directory outside the Git checkout for every attempt. Use a timestamp plus a random suffix, refuse an existing path, and never overwrite an earlier capture. Keep the IQ file, stdout, stderr and metadata there. Do not add them to Git.
The required command arguments are: The required capture arguments are:
```text ```text
hackrf_transfer.exe hackrf_transfer.exe
@@ -82,14 +134,14 @@ hackrf_transfer.exe
-B -B
``` ```
## 3. Controlled background start ## 6. Controlled background start
Keep one PowerShell session open for the start and completion sequence. Resolve the verified local path to `hackrf_transfer.exe`, then prepare and start the process: Keep one PowerShell session open for the start and completion sequence. Resolve the verified local path to `hackrf_transfer.exe`, then start the controlled background process:
```powershell ```powershell
$runId = '{0}_{1}' -f (Get-Date -Format 'yyyyMMdd_HHmmss'), ([guid]::NewGuid().ToString('N').Substring(0, 8)) $runId = '{0}_{1}' -f (Get-Date -Format 'yyyyMMdd_HHmmss'), ([guid]::NewGuid().ToString('N').Substring(0, 8))
$captureRoot = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'SDR_Rover_Captures' $captureRoot = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'SDR_Rover_Captures'
$captureDirectory = Join-Path $captureRoot "RF001A_CAPTURE_001_$runId" $captureDirectory = Join-Path $captureRoot "RF001A_VERIFY_AND_CAPTURE_001_$runId"
if (Test-Path -LiteralPath $captureDirectory) { throw "Capture directory already exists: $captureDirectory" } if (Test-Path -LiteralPath $captureDirectory) { throw "Capture directory already exists: $captureDirectory" }
New-Item -ItemType Directory -Path $captureDirectory -ErrorAction Stop | Out-Null New-Item -ItemType Directory -Path $captureDirectory -ErrorAction Stop | Out-Null
@@ -128,11 +180,14 @@ do {
The start passes only if the process remains active and the capture file exists and has grown above zero bytes. If either check fails, report `RX CAPTURE STARTED = NO`, `RX READY FOR TX = NO`, preserve the logs, keep `RF TX = 0`, and STOP. The start passes only if the process remains active and the capture file exists and has grown above zero bytes. If either check fails, report `RX CAPTURE STARTED = NO`, `RX READY FOR TX = NO`, preserve the logs, keep `RF TX = 0`, and STOP.
If both checks pass, immediately print this status. Do not wait for completion, calculate SHA256, or perform another slow action before printing it: When both checks pass, immediately output:
```text ```text
TASK_ID = TASK_ID =
RF001A_CAPTURE_001 RF001A_VERIFY_AND_CAPTURE_001
COMMON CLOCK VERIFIED =
YES
RX CAPTURE STARTED = RX CAPTURE STARTED =
YES YES
@@ -141,23 +196,18 @@ RX READY FOR TX =
YES YES
CAPTURE PID = CAPTURE PID =
<PID>
CAPTURE PATH = CAPTURE PATH =
<absolute path>
CAPTURE DEADLINE / EXPECTED DURATION =
20 s
RF TX = RF TX =
0 0
``` ```
`RX READY FOR TX = YES` means only that this RX capture is active. RF TX on the RX laptop remains forbidden. The user coordinates any separately authorized TX action on the main PC. Do not wait for capture completion, calculate SHA256, or perform another slow action before sending this status. `RX READY FOR TX = YES` only reports that the RX capture is active. It does not authorize RF TX on either computer. RF TX on the RX laptop remains forbidden.
## 4. Capture completion ## 7. Capture completion
Only after printing the start status, wait for the same process in the same PowerShell session: Only after sending the immediate start status, wait for the same process in the same PowerShell session:
```powershell ```powershell
$captureProcess.WaitForExit() $captureProcess.WaitForExit()
@@ -169,15 +219,35 @@ $captureDurationSeconds = ($finishedAt - $startedAt).TotalSeconds
$captureHash = (Get-FileHash -LiteralPath $capturePath -Algorithm SHA256).Hash.ToLowerInvariant() $captureHash = (Get-FileHash -LiteralPath $capturePath -Algorithm SHA256).Hash.ToLowerInvariant()
``` ```
Check and report the exit code, actual file size, actual duration, RX overruns, USB errors, file write errors and raw IQ SHA256. Inspect the saved stdout and stderr. The capture is complete only if the exit code is zero, the file size is exactly `320000000` bytes, and the saved output contains no RX overrun, USB error or file write error. A smaller file is incomplete. Preserve the evidence and do not retry automatically. Inspect the saved stdout and stderr. Record the exit code, actual file size, actual duration, RX overruns, USB errors, file write errors and raw IQ SHA256.
Write machine-readable metadata to a new file in `$captureDirectory`. Include the task ID, RX serial, requested settings, PID, start and finish timestamps, exit code, file size, duration, error counts and SHA256. The metadata and logs remain outside Git. The capture is complete only if:
First report the immediate start status shown above. After completion, provide: - exit code = `0`;
- file size = exactly `320000000` bytes;
- RX overruns = `0`;
- USB errors = `0`;
- file write errors = `0`.
A smaller file is incomplete. Preserve the evidence and do not retry automatically. Write machine-readable metadata to a new file in `$captureDirectory`, including the task ID, RX serial, requested settings, clock results, PID, timestamps, exit code, size, duration, error counts and SHA256. The metadata and logs remain outside Git.
Finish with:
```text ```text
TASK_ID = TASK_ID =
RF001A_CAPTURE_001 RF001A_VERIFY_AND_CAPTURE_001
SLAVE CLKIN BEFORE RX =
DETECTED / NOT_DETECTED
SHORT RX START =
PASS / FAIL / NOT_RUN
SLAVE CLKIN AFTER RX =
DETECTED / NOT_DETECTED / NOT_RUN
COMMON CLOCK VERIFIED =
YES / NO
RX CAPTURE STARTED = RX CAPTURE STARTED =
YES / NO YES / NO
@@ -189,11 +259,8 @@ CAPTURE PID =
CAPTURE PATH = CAPTURE PATH =
RF TX =
0
RX CAPTURE COMPLETE = RX CAPTURE COMPLETE =
YES / NO YES / NO / NOT_RUN
CAPTURE SIZE = CAPTURE SIZE =
@@ -207,10 +274,13 @@ FILE WRITE ERRORS =
RAW IQ SHA256 = RAW IQ SHA256 =
RF TX =
0
STOP. STOP.
``` ```
## 5. Prohibited actions ## 8. Prohibited actions
On the RX laptop, do not perform RF TX, firmware or CPLD updates, Zadig operations, USB driver changes, clock reconfiguration, continuous RX, automatic retries, commits to `video-development`, or pushes to `video-development`. On the RX laptop, do not perform RF TX, firmware or CPLD updates, Zadig operations, USB driver changes, clock reconfiguration, continuous RX, automatic retries, commits to `video-development`, or pushes to `video-development`.