Commit Graph

251 Commits

Author SHA1 Message Date
Alexander Chemeris ff9b59c223 Transceiver: Add an option to send RSSI to the GSM core even if the burst is not demodulated.
The feature is enabled when the GSM core sends "SENDEMPTY 1" command.
2015-06-10 23:14:11 -04:00
Alexander Chemeris 34e5a3807f Transceiver: Do not update state->SNRestimate if equalization is disabled.
This also fix a bug of using bool type for noise instead of float.
2015-06-10 23:13:33 -04:00
Alexander Chemeris b49874aa64 uhd: Fix rounding error in timestamp conversion functions.
Rounding error introduced oscilating timing advance error by regularly
overwriting one bit and then skipping one bit.

This commit also adds an error message to show up in logs if this ever
happens again.
2015-06-10 23:13:33 -04:00
Alexander Chemeris 030951695c sigProcLib: Abstract out common part of Normal/RACH burst detection.
As a side change - get rid of passing toa and amp arguments as pointers and use
references instead.

The commit doesn't change behaviour, but makes the code cleaner.
2015-06-10 23:13:33 -04:00
Alexander Chemeris b721d6104d Checking in clockdump.sh utility. 2015-06-10 23:03:00 -04:00
Alexander Chemeris c19d1f6c36 Checking in a more relevant README.
This READMY is from the OpenBTS's TRXManager and actually describes the transceiver
API and behavior.
2015-06-10 23:03:00 -04:00
Alexander Chemeris f0d8a581b4 Transceiver: Update noise level only when the timeslot is marked as IDLE.
We can't rely on an assumption that if we can't decode a burst - it's noise.
There are many rasons why we can't decode a burst even if it's well above the
noise level. Just one example is a RACH burst which can be overlapped with
another RACH burst up to a level both are completely unrecognizable. Another
example is when a burst is destroyed by bad multi-path.
2015-06-10 23:03:00 -04:00
Alexander Chemeris 37b445d4c8 transceiver: Remove noise/RSSI gating.
It does more harm than good. the current noise calculation is too error
prone, so we can't trust it. And we end up loosing perfectly good bursts
because of that.
2015-06-07 01:10:11 -04:00
Alexander Chemeris df127bc74e osmo-trx: Add an option to swap channels on UmTRX. 2015-06-07 01:07:45 -04:00
Alexander Chemeris 6512812e43 sigProcLib: Check for bogus TOA before using it. 2015-06-05 23:40:27 -04:00
Alexander Chemeris ded68da44f Transceiver: Fix clipping detection.
There are two primary changes in this commit:

1) Return values of detect functions changed form bool to int to actually pass
the return value from the inner function and notify higher levels about clipping.
Previously the information was lost due to conversion to bool.

2) Clipping level is not the final verdict now. We still try to demod a burst
and mark it as clipped only if the level is above the clipping level AND we can't
demod it. The reasoning for this is that in real life we want to do as much as
possible to demod the burst, because we want to get as much from our dynamic
range as possible. So a little bit of clipping is fine and is expected. We just
don't want too much of it to break our demod.
2015-06-05 23:32:41 -04:00
Alexander Chemeris 37bbfa2125 Transceiver: Print noise level for each burst in debug mode. 2015-06-05 23:25:22 -04:00
Alexander Chemeris fdbf914584 osmo-trx: Add a command line option for the dBFS to dBm offset. 2015-06-04 19:13:48 -04:00
Alexander Chemeris bbef7e4d70 Common: Use a scoped lock in the Logger to avoid deadlock on thread cancel. 2015-06-04 19:13:48 -04:00
Alexander Chemeris 351fd76706 sigProcLib: Fix burst start phase.
R&S CMD57 complains about the start phase of bursts, particularly it shows
-15 to -30 deg of error for the bit 0.5 position (start tail bit). This patch
makes it happy. ETSI TS 145 004 section 2.2 describes this: "Before the first
bit of the bursts as defined in 3GPP TS 45.002 enters the modulator,
the modulator has an internal state as if a modulating bit stream consisting
of consecutive ones (di = 1) had entered the differential encoder."

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-06-01 16:06:11 -07:00
Alexander Chemeris 6a2bf0d87b transceiver: Drive clock indication form the receive thread.
Receive thread receives data from the device, which is a more stable source of
clocking than the transmit side. If transmit side has a hiccup, osmo-trx doesn't
send the clock indication, and transmit side is getting completely lost in time.
With this patch we ensure that clock indication keeps coming.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-06-01 16:06:02 -07:00
Alexander Chemeris 2966048b07 transceiver: Fix out-of-bounds acces in genRandNormalBurst().
We should read gTrainingSequence starting from 0 bit index, not 61 bit index.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-06-01 16:04:10 -07:00
Alexander Chemeris f5fd578d60 osmo-trx: Fix random filler command line option.
Filler types was of "bool" type, which prevented it from taking values greter
than 1. And RAND filler type has integer value of 2, which was casted to 1 on
assigning, which led to a normal filler table being used instead of the RAND
one.
2015-05-24 20:35:13 -04:00
Alexander Chemeris 57ef87d061 Common: Log to console instead of loging to syslog by default. 2015-05-24 13:23:11 -04:00
Alexander Chemeris 5721920a08 Common: Introduce a global variable to disable syslog logging.
When we enable DEBUG logging level, syslog gets Gb's of data and can completely
exhaust the file system free space. Now we can just enable it. This is not to
say that logging to syslog it just not very useful in general.
2015-05-24 13:20:44 -04:00
Ivan Kluchnikov 194a9b1982 Transceiver52M: Change POWERON behavior to return success if the transceiver is already running, and only return fail on device
failure
2015-05-24 12:55:31 -04:00
Alexander Chemeris 1fe5282133 Transceiver: Check TSC values to be in [0..7] range.
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-20 12:05:04 -07:00
Alexander Chemeris 4438a9fd8f Transceiver: Make error response to an unknown command on UDP command interface more understandable.
Previously we just repeated the last response which could confuse a command sender.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-20 12:03:30 -07:00
Tom Tsou 64ad712daa test: Add command line random normal burst option 2015-05-19 18:26:31 -07:00
Tom Tsou 5c7c178369 uhd: Pass UHD command line arguments to constructor
Previous behaviour used UHD command line args string for device search,
but did not apply the values to the device constructor. Now use the user
passed args string for both find and device construction.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-18 16:51:44 -07:00
Alexander Chemeris 90f7a01d1d umtrx: Don't use DSP tuning, because LMS6002D PLL steps are small enough.
We end up with DSP tuning just for 2-3Hz, which is meaningless and
only distort the signal.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-18 16:49:24 -07:00
Alexander Chemeris e171425b99 uhd: Set RF frontend bandwidth for UmTRX to improve signal quality.
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-18 16:49:05 -07:00
Alexander Chemeris 4d029d8965 UmTRX: Manually set Tx gain stages for the best signal quality.
New UHD versions support split configuration of Tx gain stages.
We utilize this to set the gain configuration, optimal for
the Tx signal quality. From our measurements, VGA1 must be
18dB plus-minus one and VGA2 is the best when 23dB or lower.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-18 16:48:17 -07:00
Tom Tsou 6613331459 build: Provide option for disabling SSE autodetection
Setup '--with-sse' option to check system capabilities by default, but
allow disabling by the user. Selective SSE build options can be
controlled by the user by defining specific HAVE_SSE options.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-18 16:35:44 -07:00
Tom Tsou 577cd020c1 sigproc: Add clipping detection on RACH and TSC input
Alert user of overdriven burst input indicated by a positive
threshold detector result. This indication serves as notification
that the receive RF gain level is too high for the configured
transceiver setup.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-18 16:35:35 -07:00
Alexander Chemeris 88bbf1aafd uhd: Use full DAC scale with UmTRX to improve signal quality.
Signed-off-by: Tom Tsou <tom@tsou.cc>
2015-05-18 16:35:25 -07:00
Tom Tsou 2cc2ddda41 build: Add 'subdir-objects' to AM_INIT_AUTOMAKE
This will shutup automake and make it stop complaining about the
following subdirectory warnings.

"warning: source file 'common/fft.c' is in a
subdirectory, but option 'subdir-objects' is disabled"

Signed-off-by: Tom Tsou <tom@tsou.cc>
2015-05-18 16:35:13 -07:00
Tom Tsou d7610cf0b8 radioInterface: Reset sample buffer cursors on each start
Non-zero buffer indices may lead to uplink/downlink timing offset
during repeated start/stop cycles. Mainly affects USRP2 and other
resampled devices that rely on the buffer to absorb sample block
sizes that are not multiples of the burst size.

Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-05-07 17:47:17 -07:00
Tom Tsou 722d4f70a4 usrp1: Update device API for frequency offset tuning
Commit 8e17df7374 "Add option for baseband frequency offset",
modified the base device API to allow for RF tuning, which was never
updated for the USRP1.

Update the implementation to match the API, however, note actual offset
in the USRP1 remains unsupported.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2015-01-19 09:59:41 -08:00
Tom Tsou 93b7f37309 b210: Lock dual-channel tuning access
Frequency tuning is a multi-step process with RF and DDC/DUC protoimns
that can be corrupted if both channels attempt to tune at the same time.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-15 20:25:27 -08:00
Tom Tsou 4ad9ea69ab Transceiver52M: Add X300/X310 and E310 USRP support
Treat X300 similar to N200 and resample with 100 MHz base clocking,
which provides some amount of oversampling for reduced phase error
compared to the 1 sample per symbol receiver. Treat E310 similar to 13
MHz rate devices for the lowest computational use.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-15 18:59:45 -08:00
Tom Tsou eb54bddf47 Transceiver52M: Implement POWEROFF command
Add stop and restart capability through the POWEROFF and POWERON
commands. Calling stop causes receive streaming to cease, and I/O
threads to shutdown leaving only the control handling thread running.
Upon receiving a POWERON command, I/O threads and device streaming are
restarted.

Proper shutdown of the transceiver is now initiated by the destructor,
which calls the stop command internally to wind down and deallocate
threads.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-15 16:20:15 -07:00
Tom Tsou a4d1a41244 Transceiver52M: Allow setting gain before POWERON
There is no reason gain settings should not be modifiable when the radio
is running or not.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-15 16:20:15 -07:00
Tom Tsou b999759175 CommonLibs: Add thread cancellation capability
For clean shutdown in the transceiver we need to cancel and join
running threads for orderly unwinding. Thread cancellation points
already exist, so we just need to be able to call on the threads to
exit out when stopping or shutting down.

Don't error when joining a NULL thread, which would be the case if a
thread was stopped before ever being started to begin with.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-15 16:20:15 -07:00
Tom Tsou 1ae25561fa uhd: Display current timestamp with buffer status errors
Existing implementation outputs sample buffer parameters, but it is
helpful to know the submitted timestamp that led to the errant
condition.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-15 16:19:38 -07:00
Thomas Tsou 187225cf33 Transceiver52M: Fix SSE convolution shuffle register
An errant shuffle register value used in complex-complex convolution
causes distorted correlation peak-to-average values for certain TSC
values. The error effect varies for different TSC sequences with the
most noticeable effect of degraded detection on TSC 1 and no effect on
TSC 7.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-05-08 13:57:36 -04:00
Thomas Tsou ccb73e15f3 Transceiver52M: Fix retransmissions when filler table is enabled
Commit 15d743efaf "Disable filler table
retransmissions by default" made OpenBTS style filler table behavior
optional. When enabled, dummy bursts were automatically loaded into the
filler table, but the table was not updated and only filler busts were
retransmitted.

Enable the restransmit state flag when the filler table option is
specified. Only preload filler table and enable retransmissions on
channel zero.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-04-15 17:47:48 -04:00
Thomas Tsou a5c83aeb56 Transceiver52M: Add E1XX USRP device id and timings
Device specific timing settings for the E100 and E110 were missing from
the Tx/Rx offset table. Add E1XX identifier and offsets to the device
list and offset table respectively.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-04-09 23:14:31 -04:00
Thomas Tsou c283916e41 Transceiver52M: Allow startup delay for stream alignment
UHD requires a small amount of time to align multiple streams at
startup. Delay the startup by 100 ms relative to the queried device time
(actual delay inclusive of control latencies will be less).

The following error is only relevant to dual-channel UHD devices (e.g.
Fairwaves UmTRX and Ettus B210).

UHD Error:
    The receive packet handler failed to time-align packets.
    1002 received packets were processed by the handler.
    However, a timestamp match could not be determined.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-03-27 13:57:18 -04:00
Thomas Tsou cecfb2e8f9 Transceiver52M: Set UHD rates before creating streamers
Recent versions of UHD require setting the sample rate before creating
streamers otherwise the following exception occurs.

Boost_105300; UHD_003.007.000-0-g7fef199d

terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::math::rounding_error> >'
  what():  Error in function boost::math::round<d>(d): Value -nan can not be represented in the target integer type.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-03-27 13:49:51 -04:00
Thomas Tsou 8e17df7374 Transceivert52M: Add option for baseband frequency offset
Allow command line setting of the DSP frequency in UHD. All channels
will be tuned with the same offset. Dual-channel tuning with the B210,
which uses a single LO, will override the command line offset value
and set the DSP frequency automatically.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-03-06 15:52:49 -05:00
Thomas Tsou 3ebc772dc2 Transceiver52M: Enable B210 dual channel support
The main difference between existing UmTRX dual channel is the
single LO on B210 transmit and receive front-ends vs. independent
tuning paths. In order to support dual-ARFCN frequencies, baseband
offset conversion must be applied by tuning the FPGA CORDIC for
each channel. For B210, the following tuning order is applied.

1. If the new frequency of channel A is within the baseband range
   of channel B, then retune both channels with the RF centered
   and equal valued positive and negative baseband shifts.

2. If the new frequency of channel A is not with the baseband range
   of channel B, then retune channel A directly (without manual
   applied offset). Channel B will no longer be tuned to the
   previous frequency.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-03-03 23:17:57 -05:00
Thomas Tsou 18d3b833bc Transceiver52M: Disable initial device time reset
With dual-channels on B210, we lose the ability to reset both
channels to a synchronized state. Instead, let the timestamp
clock start with an arbitary value, which is the first
timestamp received from the device, instead of a near-zero
value. This approach also makes integration for device, in
general, with free-running timestamp clocks.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-03-03 23:16:59 -05:00
Thomas Tsou e788239fba Transceiver52M: Split B200 and B210 identifiers
Differentiate between the two in order to provide enumeration
for dual-channel support.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-03-03 18:47:36 -05:00
Thomas Tsou 635f1bf2af Transceiver52M: Set B2XX clock frequency to 26 MHz
Change from the original USRP1 rate of 52 MHz. On B2XX we can use
26 MHz, which is closer to the default 32 MHz of the device.

Signed-off-by: Thomas Tsou <tom@tsou.cc>
2014-02-13 14:35:45 -05:00