Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

libresdr with plutoplayer dont work correctly #423

Open
danusha2345 opened this issue Nov 16, 2024 · 1 comment
Open

libresdr with plutoplayer dont work correctly #423

danusha2345 opened this issue Nov 16, 2024 · 1 comment

Comments

@danusha2345
Copy link

danusha2345 commented Nov 16, 2024

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.

https://youtu.be/OiZHZc91f5o

@danusha2345
Copy link
Author

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");

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant