[[trx_backends]]
== OsmoTRX backend support

[[backend_uhd]]
=== `osmo-trx-uhd` for UHD based Transceivers

This OsmoTRX model uses _libuhd_ (UHD, USRP Hardware Driver) to drive the
device, that is configuring it and reading/writing samples from/to it.

So far, this backend has been mostly used to drive devices such as the Ettus
B200 family and Fairwaves UmTRX family, and used to be the default backend used
for legacy @osmo-trx@ binary when per-backend binaries didn't exist yet.

Any device providing generic support for UHD should theoretically be able to be
run through this backend without much effort, but practical experience showed
that some devices don't play well with it, such as the LimeSDR family of
devices, which showed far better results when using its native interface.

Related code can be found in the _Transceiver52M/device/uhd/_ directory in
_osmo-trx.git_.

[[backend_lms]]
=== `osmo-trx-lms` for LimeSuite based Transceivers

This OsmoTRX model uses LimeSuite API and library to drive the device, that is
configuring it and reading/writing samples from/to it.

This backend was developed in order to be used together with LimeSDR-USB and
LimeSDR-mini devices, due to to the poor results obtained with the UHD backend,
and to simplify the stack.

Related code can be found in the _Transceiver52M/device/lms/_ directory in
_osmo-trx.git_.

[[backend_usrp1]]
=== `osmo-trx-usrp1` for libusrp based Transceivers

This OsmoTRX model uses the legacy libusrp driver provided in GNU Radio 3.4.2.

As this code was dropped from GNU Radio at some point and was found very
difficult to build, some work was done to create a standalone libusrp which can
be nowadays found as a separate git repository together with other osmocom git
repositories, in https://git.osmocom.org/libusrp/

Related code can be found in the _Transceiver52M/device/usrp1/_ directory in
_osmo-trx.git_.

The USRPDevice module is basically a driver that reads/writes packets to a USRP
with two RFX900 daughterboards, board A is the Tx chain and board B is the Rx
chain.

The `radioInterface` module is basically an interface between the transceiver
and the USRP. It operates the basestation clock based upon the sample count of
received USRP samples.  Packets from the USRP are queued and segmented into GSM
bursts that are passed up to the transceiver; bursts from the transceiver are
passed down to the USRP.

The transceiver basically operates "layer 0" of the GSM stack, performing the
modulation, detection, and demodulation of GSM bursts.  It communicates with the
GSM stack via three UDP sockets, one socket for data, one for control messages,
and one socket to pass clocking information. The transceiver contains a priority
queue to sort to-be-transmitted bursts, and a filler table to fill in timeslots
that do not have bursts in the priority queue.  The transceiver tries to stay
ahead of the basestation clock, adapting its latency when underruns are reported
by the radioInterface/USRP. Received bursts (from the radioInterface) pass
through a simple energy detector, a RACH or midamble correlator, and a DFE-based
demodulator.

NOTE: There's a `SWLOOPBACK` #define statement, where the USRP is replaced
with a memory buffer. In this mode, data written to the USRP is actually stored
in a buffer, and read commands to the USRP simply pull data from this buffer.
This was very useful in early testing, and still may be useful in testing basic
Transceiver and radioInterface functionality.
