gps-sdr-sim
gps-sdr-sim copied to clipboard
libresdr with plutoplayer dont work correctly
trafficstars
Everything works fine on HackRF, satellites appear and do not disappear, and after 3 minutes 3d fixation takes place. But for some reason, everything is bad with libreSDR. Satellites appear and disappear all the time.
I redid the buffer filling. The DAC 9361 is 12-bit, it takes a 16-bit value and ignores 4 bits. Therefore, it is better to shift every 16 bits by 4 bits. After such manipulation, my GPS receiver began to find satellites and fix the position, it had not worked before.
Here's what needs to be changed:
tx_buffer = iio_device_create_buffer(tx, NUM_SAMPLES, false); //создаём буфер в сэмплах
if (!tx_buffer) {
fprintf(stderr, "Could not create TX buffer.\n");
goto error_exit;
}
iio_channel_attr_write_bool(
iio_device_find_channel(iio_context_find_device(ctx, "ad9361-phy"), "altvoltage1", true)
, "powerdown", false); // Turn ON TX LO
int32_t ntx = 0;
short *ptx_buffer = (short *)iio_buffer_start(tx_buffer); //указатель или адрес на начало буфера
short *p_end = (short *)iio_buffer_end(tx_buffer); //указатель на конец буфера
short *p_dat;
printf("* Transmit starts...\n");
// Keep writing samples while there is more data to send and no failures have occurred.
while (!feof(fp) && !stop) {
for (p_dat = ptx_buffer; p_dat < p_end; p_dat += 1) {
fread(p_dat, sizeof(short), 1,fp); // загружаем 2 байта(16бит)
*p_dat = *p_dat << 4; // сдвигаем содержимое на 4 бита
}
ntx = iio_buffer_push(tx_buffer); // выталкиваем буфер
if (ntx < 0) {
printf("Error pushing buf %d\n", (int) ntx);
break;
}
}
printf("Done.\n");