23 Commits

Author SHA1 Message Date
awe
4eb2da17ab data path upd 2025-12-04 18:48:10 +03:00
awe
c8dd8553ba add firmware file 2025-12-04 16:21:24 +03:00
awe
21038c1f8e gitignore upd 2025-12-04 16:21:06 +03:00
awe
11cf03910b remobe build from git 2025-12-04 16:20:33 +03:00
awe
613fdb998f gitignore upd 2025-12-04 16:19:59 +03:00
awe
d0578a0c0d remove build files 2025-12-04 16:19:41 +03:00
d979f45179 implemented cleanup of streams every 10 run. Now it works stable and fast. Next step -- adjust runs_since_streams_clean max value 2025-11-14 02:03:37 +03:00
a726babc1c implemented BF mode switching 2025-11-14 00:18:15 +03:00
4e2d8d4b22 examples of cmd files. If it is provided via CLI arg -- it sets run mode 2025-11-13 22:49:51 +03:00
bec5e29e2c implemented atomary writing to the output files (by creating tmp file and renaming it). 2025-11-13 22:47:40 +03:00
a1c727c71f now chart is saved before showing. Because showing may be long 2025-11-13 22:45:41 +03:00
9ad09ee77b uncommented chart.show() at the end 2025-11-13 22:30:41 +03:00
87954d40d9 now path to data storage is configurable by .cmd file 2025-11-13 22:30:17 +03:00
e2eac4dd48 implemented configuring at startup via cfg file. Implemented RUN_FINITE, RUN_INFINITE, RUN_TEST modes. 2025-11-13 21:36:49 +03:00
850a66e620 compiles 2025-11-13 21:00:42 +03:00
d1bd233399 removed old unacessible code from the end. Implemented main_state struct, filling it from the CLI arg file. Also implemented FINITE_RUNS mode. 2025-11-13 20:55:53 +03:00
b7eae9d469 cleaned more unused code (by codex) 2025-11-13 19:31:56 +03:00
b80ad585da moved libs to the lib directory 2025-11-13 18:40:06 +03:00
4d1f7fdbe9 added run_cyclic script. It mounts tmpfs in ./tmp, runs BF_companion for some cycles, cleans ./tmp 2025-11-13 18:22:38 +03:00
a44043593c deleted unused funcs and commented outdated code 2025-11-13 18:20:19 +03:00
b7ba42765b manually merged with ARM version 2025-11-13 17:43:55 +03:00
77005d7863 included SDK folder and included it to the git three 2025-10-30 21:53:19 +03:00
bf25bed9aa just save 2025-10-30 19:57:30 +03:00
28 changed files with 256 additions and 176 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.csv
*.tmp
build
BF_companion

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
../BFfirmware_0/build/release/bin/l502-BFfirmware0.ldr

BIN
l502-BFfirmware0.ldr Normal file

Binary file not shown.

10
long_trace_AVG_RPI.cmd Normal file
View File

@ -0,0 +1,10 @@
// Default configuration for BF_companion main_state
// Format: field value // optional comment
run_mode INF_RUN // TEST | FINITE_RUN | INF_RUN
BF_mode FFT // TRANSPARENT | AVG | FFT
run_length 50 // milliseconds
runs_N 1000 // total runs (used in FINITE_RUN)
run_I 0 // starting run index
//data_path /home/feda/MIPT/RadioPhotonic_Subserface_radar/Receiver_GUI/data // base directory for output files
data_path tmp

3
main.c
View File

@ -705,7 +705,7 @@ void receive_to_file(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, uint
// fprintf(logfile_ptr, "0xFF00000 \n");
// uint32_t timeout = 100;
uint32_t recv_Err_code = X502_Recv(hnd, inp_buff, max_total_words, timeout);
int32_t recv_Err_code = X502_Recv(hnd, inp_buff, max_total_words, timeout);
printf("receive code: %d\n", recv_Err_code);
if (recv_Err_code > 0){
@ -726,6 +726,7 @@ void receive_to_file(t_x502_hnd hnd, char* logfilename, uint32_t* inp_buff, uint
}else if (recv_Err_code == 0){
printf("no data received. timeout\n");
}else{
sleep(1);
printf("receive error: %d\n======================\n", recv_Err_code);
}
}

66
pipe_reader_test.py Executable file
View File

@ -0,0 +1,66 @@
#!/usr/bin/env python3
"""
Test script to read radar data from named pipe (FIFO)
This script demonstrates how to read binary data from the named pipe
created by the radar acquisition program.
"""
import struct
import sys
import os
def read_from_pipe(pipe_path="/tmp/radar_data_pipe"):
"""
Read uint32_t data from named pipe
Args:
pipe_path: Path to the named pipe (FIFO)
"""
print(f"Opening pipe: {pipe_path}")
print("Waiting for radar data...")
try:
# Open pipe for reading (this will block until writer connects)
with open(pipe_path, 'rb') as pipe:
print("Connected to pipe! Reading data...")
word_count = 0
while True:
# Read 4 bytes (one uint32_t)
data = pipe.read(4)
if not data:
print("\nEnd of stream or pipe closed")
break
if len(data) < 4:
print(f"\nWarning: incomplete data read ({len(data)} bytes)")
break
# Unpack as uint32_t (little-endian)
value = struct.unpack('<I', data)[0]
# Print first 10 values and then every 1000th value
if word_count < 10 or word_count % 1000 == 0:
print(f"Word {word_count}: 0x{value:08X} ({value})")
word_count += 1
# Optional: process the data here
# For example, convert to voltage, apply filters, etc.
print(f"\nTotal words received: {word_count}")
except KeyboardInterrupt:
print("\n\nInterrupted by user")
print(f"Total words received: {word_count}")
except FileNotFoundError:
print(f"Error: Pipe {pipe_path} does not exist")
print("Make sure the radar acquisition program is running first")
except Exception as e:
print(f"Error reading from pipe: {e}")
if __name__ == "__main__":
pipe_path = sys.argv[1] if len(sys.argv) > 1 else "/tmp/radar_data_pipe"
read_from_pipe(pipe_path)

View File

@ -1,4 +1,3 @@
#!/usr/bin/bash
sudo mount -t tmpfs -o size=1G tmpfs tmp
./BF_companion 100 #should generate approx 500 MB of data by running 10 secs
rm tmp/*
# sudo mount -t tmpfs -o size=1G tmpfs tmp
./BF_companion long_trace_AVG_RPI.cmd