AnsweredAssumed Answered

BIST Hardware Loopback - Received samples differ from transmitted samples

Question asked by LeroyKii on Nov 17, 2016
Latest reply on Nov 18, 2016 by mhennerich

Hello everyone,


In order to easily understand the way libiio works I'm using BIST hardware loopback configuration (Writing 0x01 to BIST Config2 register [0x3F5]) so received samples should be identical to the transmitted ones.

However I'm getting kind of an attenuation factor and don't understand why. In the following graph you can see the transmitted versus received signal. The transmitted samples are just a counter that increments ( I component) and decrements (Q component) by 1.


So the received signal is either being attenuated somehow or the reception process is sampling at a higher rate than the transmission rate and sampling each value several times. As the signal should not be going through the AD, its configuration (sampling freq., gain, bandwidth) should not be applying here, so I don't know what's wrong. Any hint?


Snippet for this captures:


   /* Generate samples */

for (i = 0; i < TX_BUFFER_SIZE / 2; ++i) {
        buffer_generatedSamples[2*i+0] = (int16_t)incr_counter;
        buffer_generatedSamples[2*i+1] = -(int16_t)incr_counter;

   while (1) {
        /* Transmission */
        memcpy(iio_buffer_first(txbuf, tx0_i), buffer_generatedSamples,  TX_BUFFER_SIZE*sizeof(buffer_generatedSamples[0]));

        /* Reception */
        nbytes_rx = iio_buffer_refill(rxbuf);
        if (nbytes_rx < 0)  shutdown_AD9361(0);
        memcpy(buffer_receivedSamples, iio_buffer_first(rxbuf, rx0_i,                                                                                 

        if (loop_it++ == 20) break;


/*Write TX and RX to file */ // just saving to file the last buffer received