galileoz / gal-osnma-sim

a Galileo OSNMA simulator
MIT License
22 stars 7 forks source link

-k command not working with hackrf #4

Open hsm-0510 opened 1 month ago

hsm-0510 commented 1 month ago

When I write the following command: ./gal-osnma-sim -l 31.1598,131.1589,100 -v ./tv/configuration_A/13_DEC_2020_GST_09_00_01_fixed.csv -b 8 -d 60 -k The following output appears and freezes on the last line: image Why is freezing after set_sample_rate?

galileoz commented 1 month ago

Hi,

You must have a problem with your hackrf. On our reference setup: xxx@yyyyy:~/github/gal-osnma-sim$ ./gal-osnma-sim -l 31.1598,131.1589,100 -v ./tv/configuration_A/13_DEC_2020_GST_09_00_01_fixed.csv -b 8 -d 60 -k Test vector file: ./tv/configuration_A/13_DEC_2020_GST_09_00_01_fixed.csv Replay position: lat:31.159800 lon:131.158900 alt:100.00 Galileo start Time: wn:1112, tow:32400 Replay duration: 60 s Output data not recorded sample rate = 2600000.000000 call hackrf_set_sample_rate(2600000 Hz/2.600 MHz) call hackrf_set_freq(1575420000 Hz/1575.420 MHz) call hackrf_set_amp_enable(1) call hackrf_set_antenna_enable(0)

Initialized satellites in view: sat: 03 az: 315.2 el: 20.0 wn:1112 tow:32400.100000 sat: 05 az: 262.5 el: 55.4 wn:1112 tow:32400.100000 sat: 09 az: 185.1 el: 37.0 wn:1112 tow:32400.100000 sat: 11 az: 163.1 el: 8.3 wn:1112 tow:32400.100000 sat: 12 az: 112.9 el: 23.9 wn:1112 tow:32400.100000 sat: 24 az: 351.4 el: 61.3 wn:1112 tow:32400.100000 sat: 25 az: 275.9 el: 31.5 wn:1112 tow:32400.100000 sat: 31 az: 53.4 el: 28.5 wn:1112 tow:32400.100000 sat: 33 az: 60.7 el: 15.5 wn:1112 tow:32400.100000 Nb Sat in view 9 Time = 2.3^CCaught signal 2, 0 Time = 2.4 Done! hackrf_stop_tx() done hackrf_close() done hackrf_exit() done Process time = 0.730[sec]

hsm-0510 commented 1 month ago

I tried debuging the code, and it seems to get stuck on the line highlighted below: image Do you have some idea why it might be getting stuck on hackrf_start_tx() function. I've used the same hackrf to run the gps-sdr-sim project, and it works fine with that.

galileoz commented 1 month ago

Its exactly what we suspect. The issue is not related to our code but from the hackrf library or the hackrf firmware. Please checks that here: https://github.com/greatscottgadgets/hackrf We don't give support for the hackrf.

hsm-0510 commented 1 month ago

Hi thanks for replying. I was testing around with the gal-osnma-sim hackrf_tr.c file and altered the tx_callback() function as such:

int tx_callback(hackrf_transfer* transfer, int nsamp, fifoData_t inBuffer[]) { //bufferPull(transfer->valid_length, transfer->buffer); hackfrPush(nsamp, inBuffer); return 0; }

When I commented out the bufferPull command and added the bufferPush command, the ./gal-osnma-sim -l 31.1598,131.1589,100 -v ./tv/configuration_A/13_DEC_2020_GST_09_00_01_fixed.csv -b 8 -d 60 -k seems to works as you showed earlier, it runs for 60 seconds and exits. image

Although the code runs, I do not receive any Galileo signals on my receiver end. However, when I run gal-osnma-sim through .bin file I can see Galileo Signals being emitted on the receiver. Do you think there is issue with hackrf still? or should i try to change/add something in the code..

hsm-0510 commented 1 month ago

The issue seems to be resolved. I've uncommented bufferPull() and removed the bufferPush() from the tx_callback(). And have altered the bufferPull function as following in the fifoBuffer.c file: image The code runs fine and the receiver is observing the Galileo satellite signals.