Commit Graph

44 Commits

Author SHA1 Message Date
kurtis.heimerl ec842de741 Alexander's patches:
1)I did an experiment and compiled OpenBTS with clang yesterday, which
immediately highlighted two potential bugs in the Transceiver52 code.
I'm not sure they are indeed bugs and not the intended behavior, but
they look very much like that. The first one is below and the second
one is in the following mail.

GSM::Time() arguments are defined like #define USB_LATENCY_INTRVL
(10,0), which means that they are expanded into GSM::Time((10,0)).
This expression is a GSM::Time() with a single parameter where (10,0)
return value of the last argument, 0 in this case. I.e.
GSM::Time((10,0)) is equivalent to  GSM::Time(0). I think this was not
the intention.

2) Printing \n after every complex number breaks output when you want to
print it in a single line, e.g. in many debug output.

I do not claim any copyright over this change, as it's very basic.
Looking forward to see it merged into mainline.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4515 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-11-23 08:37:32 +00:00
ttsou f60dafa4ff Transceiver52M: UHD: Setup option to pass arguments from command line
UHD accepts optional 'args' that can be used for device descriptions
such as IP address, device type, etc. Allow these to be passed in on
the transceiver command line as the third argument (number of supported
carriers is the second argument). This option benefits those who may
have multiple UHD devices attached to a single system.

This option is not yet supported by GSM core and requires starting the
transceiver independently on the command line. This option has no
effect when USRP1 is used.

Signed-off-by: Thomas Tsou <tom@tsou.cc>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4315 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-10-22 00:07:14 +00:00
ttsou 60dc4c9da4 transceiver: uhd: prevent output of underrun message at ERROR level
The appearance of underruns on B100 due to the latency transmit
window scares people. These should not be logged at ERROR level
because the events are generally not real errors. So use the same
behaviour of USRP1 of not logging these events. The presence of
underrun events can be determined by changes in the latency window
that is shown with log level set at INFO.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3988 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-08-08 23:30:23 +00:00
ttsou 221f23ee44 transceiver: uhd: allow underrun flag to reset during timing alignment
Allowing the underrun flag to reset will prevent a single event from
causing large jumps in the transmit latency threshold. This should
keep unreasonable timing latencies from occurring (e.g. latencies of
20+ frames).

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3981 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-08-08 00:51:34 +00:00
ttsou 724eb36105 transceiver, uhd: output timestamps on monontonic error
The "Loss of monotonic time" error occurs when a timestamp
arrives from the device that is earlier in time than the
previous timestamp. The output is an ALERT level message
generally accompanied by a transmit side timeout from the
device.

UHD: Loss of monotonic time
UHD: Loss of monotonic time
UHD: Device send timed out

Add to the error description the timestamp values that
generated the error and output with ALERT rather than
ERR log.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3307 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-03-13 02:20:01 +00:00
ttsou 3b5c0c1e91 transceiver, uhd: fix build error due to log level
Previous commit r3181 used a 2.6 logging level.

  ALARM->ALERT

Fix for 2.8 levels.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3187 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-02-14 17:58:11 +00:00
ttsou 37720bebbc transceiver, uhd: display device information on make failure
The failure "UHD make failed" implies that a suitable device
was found, but construction failed. Output the the found
target device information along with message.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3181 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-02-14 01:52:10 +00:00
ttsou b371ed54c7 transceiver, uhd: alert user on unrecoverable errors
Unrecoverable device errors include send and receive
timeouts and mangled packets. Other device errors, such
as non-monotonic timestamps are sometimes recoverable
through a soft restart.

These fatal are generally limited to development
versions of UHD driver or device firmware, but can occur
in release versions.

Alert user on such device errors along with current UHD
version.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3012 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-01-09 18:11:34 +00:00
kurtis.heimerl 856bbbee2a Matching UHD changes in gnuradio
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2817 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-12-15 00:50:16 +00:00
kurtis.heimerl e33203208b transceiver52M: bump critial errors to ALERT level
Device errors regarding properties such as sample
rate or frequency tuning are almost always fatal and
lead to the common error "assuming TRX is dead".
Make sure that these errors are clearly presented to
the user.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2700 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-28 06:26:08 +00:00
kurtis.heimerl 4403d4ff7c transceiver, uhd: exit informatively if no devices are found
Perform a UHD device search before constructing the object,
and inform the user if no device is found.

No device found is the most common reason for the transceiver
to fail with the dreaded error "assuming TRX is dead".

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2699 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-28 06:26:04 +00:00
kurtis.heimerl 523ae5a69e transceiver, uhd: reject usrp1 if compiled with uhd support
This configuration is invalid because of FPGA based timestamp
support for the USRP1 in the UHD driver.

Kindly inform the user to recompile with libusrp support from
GNU Radio.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2698 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-28 06:26:01 +00:00
kurtis.heimerl ac0ee1289a transceiver, uhd: runtime check for setting master clock rate
Before setting the master clock rate, make sure that the
device is capable of being set. For now, assume that devices
that operate with default clock rates above 64 MHz,
specifically USRP2/N200/N210, cannot be set at 52 MHz.

Inform the user that these devices can be used with the
compile time option of host based resampling.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2697 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-28 06:25:58 +00:00
kurtis.heimerl e417c5a28e transceiver: uhd: increase log level on constructor errors
Exceptions on make are major no-start conditions. Make these
errors more apparent.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2688 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:19:25 +00:00
kurtis.heimerl c6b9b7014f transceiver: uhd: make external reference a compile time option
External reference selection was already compile-time
determined by a hard coded value. Make it selectable
as a configure option.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2686 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:19:19 +00:00
kurtis.heimerl 4e59d6630b transceiver: update to log messages to work with P2.8
Log level changes in P2.8:

    ERROR     -> ERR
    WARN      -> WARNING
    DEEPDEBUG -> DEBUG

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2683 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:19:11 +00:00
kurtis.heimerl 3998da7577 transceiver: add a newline for uhd information outputs
Minor change to clarify the logging output.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2679 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:19:00 +00:00
kurtis.heimerl b7358ce438 transceiver: reject usrp1 if detected using uhd
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2678 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:57 +00:00
kurtis.heimerl e380af3ecc transceiver: make the transmit drive loop bus dependent
With the introduction of the B100, there is USB support
using UHD devices. The characteristics of the trasmit
side burst submissions are more reflective of the bus
type than the device or driver.

Use a fixed latency interval for network devices and the
adaptive underrun approach for USB devices - regardless
of driver or device type.

The GPMC based transport on the E100 appears unaffected
by either latency scheme, which defaults to network.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2677 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:55 +00:00
kurtis.heimerl 0803ad9ad9 transceiver: reroute uhd messages to logging facility
Pipe the following uhd message types to standard warning
levels (INFO, WARN, ERROR) respectively. Ignore fastpath
logging messages and, instead, catch them from the
asynchronous device interface.

    enum type_t{
        status  = 's',
        warning = 'w',
        error   = 'e',
        fastpath= 'f'
    };

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2676 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:51 +00:00
kurtis.heimerl ce31733860 transceiver: add option for host based resampling
The resampling transceiver is unified with the 52MHz
version. The option to resample 400ksps from the device
to a GSM appropriate 270.833ksps is enabled at compile
time with the following option.

   ./configure --with-resamp

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2672 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:39 +00:00
kurtis.heimerl 513a629183 uhd: keep reading on overrun or other non-fatal errors
The readSamples call does not return less than the
number of samples requested. Doing otherwise is a
fatal error. So on overruns, which are not fatal,
continue reading until the requested number of
samples is received.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2671 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:36 +00:00
kurtis.heimerl 119ca9ca07 transceiver: uhd: update copyright header
Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2668 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:26 +00:00
kurtis.heimerl 1979c6f155 transceiver: minor cleanup of sample type sizing in uhd
A small simplification of buffer indexing and sizing.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2667 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:24 +00:00
kurtis.heimerl 26ca5bc2d2 uhd: remove external clock polarity setting
Unused and causes the follwing errors on certain UHD versions.

"ValueError: unhandled clock configuration reference source: _external_"

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2664 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:16 +00:00
kurtis.heimerl d3e2590e9b uhd: verify setting of master clock rate
If the master clock rate fails to set - this basically only happens
when the wrong transceiver is choosen for the particular device -
the error is fatal and the transceiver should exit. The clock rate
setting was previously never verified.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2663 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:13 +00:00
kurtis.heimerl 2b28c696f8 uhd: remove uhd type argument
UHD recently modified the E100 type name from 'usrp-e' to
'e100' causing the device make to fail. Remove device type
checking to keep things working with the older and newer
names.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2661 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:08 +00:00
kurtis.heimerl 495d3c8b0c uhd: flush receive buffer should return true on timeout
Receive buffer flush should continue to read until
either the desired number of packets has been read or
timeout, which means that the buffer has been emptied.
These are expected behaviours and should return true.

Ignore errors at this stage as the data and associated
metadata can be considered garbage and not worth
reporting. Actual error conditions will be caught
further downstream when useful data comes in.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2659 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:18:02 +00:00
kurtis.heimerl 6cb348b9a1 uhd: log asynchronous errors as errors
Bump abnormal asynchronous events - basically send errors -
up to ERROR level. These errors are dominated almost
entirely by underflow events, which should not be regularly
occuring.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2656 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:54 +00:00
kurtis.heimerl 7ac54b10d3 transceiver: simplify transmit power control
UHD will internally accept floats with a range of +/-1.0,
which corresponds to a 16-bit signed integer range of
apporximately +/- 32000. Set the default amplitude to .3,
which is a safe value agaist saturation elsewhere in the
transmit chain.

The non-UHD maximum amplitude is unchanged at 13500.

Remove digital gain control because it's unnecessary and
causes extra load on enbedded systems.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2654 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:49 +00:00
kurtis.heimerl d4be074ea6 uhd: reorganize error handling, exit when non-recoverable
This is primarily a minor refactor with the exception
of non-recoverable errors - notably if the receive times
out - which almost always requires a reload of the FPGA.
In these cases, quit without trying as resistance is
futile.

ERROR_TIMING:          Soft restart of streaming
ERROR_UNHANDLED:       Benign errors
ERROR_UNRECOVERABLE:   Abandon ship

Non-recoverable behaviour has not been observed in recent
builds, but may exist in older (or future) configurations.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2653 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:46 +00:00
kurtis.heimerl 13074c9d42 uhd: enable automatic alignment updates
Overnight testing shows that this shouldn't be required
in the majority of cases, but shit happens. Enabling
this forces transmit timing realignment at one minute
intervals. As a fallback method, timing slips not
caught by normal checks will be reset at the update.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2652 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:43 +00:00
kurtis.heimerl 187b03d847 uhd: cleanup startup timestamp alignment
At startup, instead of flushing initial packets blindly,
send a stop streaming command, flush, and start. The same
procedure is used in the event of a runtime timestamp
validity error.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2651 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:40 +00:00
kurtis.heimerl 68292106af uhd: rework handling of timestamp errors
On a lapses of time monotonicity (and possibly other errors),
stop and restart the receive streaming with a buffer flush
in between. This is a cleaner replacement to the previous
clock reset with that didn't attempt to stop steaming.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2647 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:28 +00:00
kurtis.heimerl c7cb817cb1 uhd: fix timestamp conversion bug on 32-bit architectures
Type size_t was used in the UHD time_spec_t to integer
conversion, which would overflow at roughly 4 and a half
hours causing the sample buffer to error on timestamp
validity. Builds where size_t takes on 64-bits were not
affected by this bug.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2646 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:26 +00:00
kurtis.heimerl a14d4beb1a uhd: reset sample clock when time goes non-monotonic
With UHD b4fc0d61bb6cbd1a5614745bab9aeb0abc22cb6f

Sample clock will reset to zero after an overrun. Earlier
versions may hang the FPGA, which is non-recoverable,
requiring a manual image reload or reboot.

If reset to zero, attempt to kick the sample clock to the
last properly received timestamp value. At this point,
there will be a timing continuity jump, which will drop
connections, but transmit and receive chains should be
aligned allowing for re-establishment.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2645 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:23 +00:00
kurtis.heimerl 24481decc2 uhd: move static functions into the uhd_device class
Simplifies things slightly, and this is supposed to be
C++ after all.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2643 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:18 +00:00
kurtis.heimerl 02d04055a3 uhd: set and shadow settings through interface
Shadow all gains and frequencies, which minimizes device access.
This allows the transceiver to variably control the device
settings.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2640 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:10 +00:00
kurtis.heimerl 993364485b uhd: set receive gain during initialization
This shouldn't matter much, but the gain settings through the
interface are short circuited right now, which makes this a
problem.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2639 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:07 +00:00
kurtis.heimerl be6abe18cc uhd: set hardware side delay offset for e100
The value is used to align transmit and receive time slots within
a sample. This oscilloscope measured value is close, but may
need minor tweaking.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2638 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:05 +00:00
kurtis.heimerl 3cc1da9d8b uhd: log useful information on monotonic errors
Track the current errant and previous timestamp values.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2637 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:02 +00:00
kurtis.heimerl c491997c1e uhd: only the E100 supports FPGA timestamps and adjustable clock rate
Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2636 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:17:00 +00:00
kurtis.heimerl 33f748f265 uhd: flush initial receive samples
Occasionally, the E100 will have errant timestamps at start
related to previous sessions. Early packets will be thrown
out anyways, so do this explicitly so the timestamps don't
royally fuck up the sample timing.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2635 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:16:57 +00:00
kurtis.heimerl 965e757c53 uhd: add 52 MHz transceiver support
These are mostly identical changes as added to the non-52MHz
implementation with the exception of sample rate.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2634 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-11-26 03:16:54 +00:00