Would you be able to provide some suggestions?  We need to keep precision 
timing for transmission.  Neither of the two proof of concepts (POC) below are 
meeting our needs.  Of course we are sending 2 packets due to lack of jumbo 
frames.

We have 2048 samples (4 bytes per sample) we would have liked to send per 
packet, or 2048/200E+6 = 10.24 us per packet or 97656 packets per second.  It’s 
a continuous stream.  This doesn’t include packet overhead.

The reason the Jumbo frame thing came up was because we were getting “L”s 
(missed timing) when using the time spec, and “U” when not using timing spec, 
most likely due to 2 packets per transmission instead of 1 jumbo frame.

I have provided POC of our test Tx program for 2 cases.  The first uses timing 
spec, which doesn’t keep up.  The second was just to see how it would perform 
if there wasn’t a time spec.

This thread runs as the highest priority in Linux, and we have tuned according 
to your documentation.

***First Test Program 1), PPS is \~95500,  but we get “L”s constantly .***

```
[INFO] [UHD] linux; GNU C++ version 9.4.0; Boost_107100; UHD_
```

```
[INFO] [X300] X300 initialization sequence...
```

```
[INFO] [X300] Maximum frame size: 8000 bytes.
```

```
[INFO] [GPS] Found an internal GPSDO: LC_XO, Firmware Rev 0.929a
```

```
[INFO] [X300] Radio 1x clock: 200 MHz
```

```
Actual TX Rate: 200.000000 Msps
```

```
Actual TX Freq: 2400.000000 MHz
```

```
Actual TX Gain: 30.000000 dB
```

```
Actual TX Bandwidth: 16.000000 MHz
```

```
[WARNING] [0/Radio#0] Attempting to set tick rate to 0. Skipping.
```

```
Using transmit_packets_timespec()
```

```
Start transmit_packets_timespec()
```

```
Packet size: 8192 bytes
```

```
--------------------------------------------
```

```
Transmitted packets: 30632386
```

```
Dropped packets: 9
```

```
PAUSE frames received: 0
```

```
PAUSE frames transmitted: 0
```

```
GPS lock lost events: 0
```

```
Network RX packets: 19733243
```

```
Network TX packets: 206298940
```

```
Network RX errors: 0
```

```
Network TX errors: 0
```

```
Network RX dropped: 0
```

```
Network TX dropped: 0
```

```
USRP TX overruns: 0
```

```
USRP TX underruns: 0
```

```
USRP sequence errors: 0
```

```
GPS time sync: 1136281795
```

```
GPS time sync errors: 0
```

```
Packets Per Second (PPS): 95428  
```

**Second Test Program 2), PPS is \~98000, Buffer Size is 8192 (without USRP 
overhead), occasional “U”**

```
[INFO] [UHD] linux; GNU C++ version 9.4.0; Boost_107100; UHD_
```

```
[INFO] [X300] X300 initialization sequence...
```

```
[INFO] [X300] Maximum frame size: 8000 bytes.
```

```
[INFO] [GPS] Found an internal GPSDO: LC_XO, Firmware Rev 0.929a
```

```
[INFO] [X300] Radio 1x clock: 200 MHz
```

```
Actual TX Rate: 200.000000 Msps
```

```
Actual TX Freq: 2400.000000 MHz
```

```
Actual TX Gain: 30.000000 dB
```

```
Actual TX Bandwidth: 16.000000 MHz
```

```
[WARNING] [0/Radio#0] Attempting to set tick rate to 0. Skipping.
```

```
Using transmit_packets_no_timespec()
```

```
Start transmit_packets_no_timespec()
```

```
Packet size: 8192 bytes
```

```
--------------------------------------------
```

```
Transmitted packets: 12844561
```

```
Dropped packets: 0
```

```
PAUSE frames received: 0
```

```
PAUSE frames transmitted: 0
```

```
GPS lock lost events: 0
```

```
Network RX packets: 5528620
```

```
Network TX packets: 77280212
```

```
Network RX errors: 0
```

```
Network TX errors: 0
```

```
Network RX dropped: 0
```

```
Network TX dropped: 0
```

```
USRP TX overruns: 0
```

```
USRP TX underruns: 0
```

```
USRP sequence errors: 0
```

```
GPS time sync: 1136280963
```

```
GPS time sync errors: 0
```

```
Packets Per Second (PPS): 98050
```

```

// 2 function to simulate our packet transmission
// First Test Program 1)
void transmit_packets_timespec(uhd::usrp::multi_usrp::sptr usrp, 
uhd::tx_streamer::sptr tx_stream, std::atomic<bool> &gps_locked, double rate) {
    uhd::tx_metadata_t md;
    md.start_of_burst = true;
    md.end_of_burst = false;
    md.has_time_spec = true;

    std::vector<std::complex<int16_t>> buffer(2048); // CRJ TEMP buffer(2048);

    std::cout << "Start transmit_packets_timespec()" << std::endl;
    std::cout << "Packet size: " << buffer.size() * 
sizeof(std::complex<int16_t>) << " bytes" << std::endl;

    // Get and print the maximum number of samples per packet
    size_t max_num_samps = tx_stream->get_max_num_samps();
    std::cout << "Max number of samples per packet: " << max_num_samps << 
std::endl;

    // Initialize timestamp
    md.time_spec = uhd::time_spec_t(usrp->get_time_now().get_full_secs() + 
1.0); // Start 1 second in the future

    while (1 /*!stop_logging.load()*/) {
        //if (gps_locked.load()) {
            //  md.time_spec = 
uhd::time_spec_t(usrp->get_time_now().get_full_secs() + 1.0);
        //}

        size_t num_tx_samps = tx_stream->send(&buffer.front(), buffer.size(), 
md);

        if (num_tx_samps < buffer.size()) {
            dropped_packets++;
        } else {
            transmitted_packets++;
        }

        md.time_spec = md.time_spec + uhd::time_spec_t(buffer.size() / rate);

        md.start_of_burst = false;
        //std::this_thread::sleep_for(std::chrono::milliseconds(5));
    }

    // Mark end of burst
    md.end_of_burst = true;
    tx_stream->send("", 0, md);
}

// Second Test Program 2)
void transmit_packets_no_timespec(uhd::usrp::multi_usrp::sptr usrp, 
uhd::tx_streamer::sptr tx_stream, std::atomic<bool> &gps_locked, double rate) {
    uhd::tx_metadata_t md;
    md.start_of_burst = true;
    md.end_of_burst = false;
    md.has_time_spec = false; // No time specification

    std::vector<std::complex<int16_t>> buffer(2048);

    std::cout << "Start transmit_packets_no_timespec()" << std::endl;
    std::cout << "Packet size: " << buffer.size() * 
sizeof(std::complex<int16_t>) << " bytes" << std::endl;

    while (!stop_logging.load()) {
        size_t num_tx_samps = tx_stream->send(&buffer.front(), buffer.size(), 
md);

        if (num_tx_samps < buffer.size()) {
            dropped_packets++;
        } else {
            transmitted_packets++;
        }

        md.start_of_burst = false;
        // Adjust the sleep time to control the packet rate
        // std::this_thread::sleep_for(std::chrono::milliseconds(1));
    }

    // Mark end of burst
    md.end_of_burst = true;
    tx_stream->send("", 0, md);
}
```
_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com

Reply via email to