When setting rx gain from the console, the returned set
value would never change due to a braces error around
logging macros.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Certain phones with GPRS capabilities will fail to
initiate calls with the following error. No call output
will be present in the Asterisk log.
1265648543.0255 INFO 3073350512 GSML3Message.cpp:162:parseL3: L3 recv RR GPRS Suspension Request
1265648543.0257 NOTICE 3073350512 DCCHDispatch.cpp:144:DCCHDispatcher: UnexpectedMessage
The issue and patch were discussed on the openbts-discuss
mailing list.
"David is right that openBTS does not emit any GPRS beacon,
so the behaviour is triggered from mobile station which
believe that there has been some GPRS before (i.e. in it's
old location area).
Unfortunately openBTS does not simply ignore this L3 RR
GPRS Suspension Request, instead a expected message flow
sequence (i.e. during call setup) is terminated with an
exception.
However we created a small patch against openbts-2.5.3
Lacassine to really ignore the L3 message. Feel free to
distribute it upstream to the community."
The author of the patch is >> Florian.Wolff@Siemens.com <<
According to his statement, O2 XDA Orbit and Motorola
Milestone are working fine with those changes. They had
the same problems before as with the iPhone.
Reported-by: Michael Folz <michael.folz@fh-kl.de>
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
If no bursts were received over a long enough duration
then the threshold would roll into negative territory.
The energy detection is based on a comparison with the
squared threshold, so all handsets would become
effectively barred after a certain period of
inactivity.
In theory, this bug also exists in the mainline tree,
but there the daughterboard receive gain is fixed at
max, which always allows the ADC to generate sufficient
noise to trigger the energy dectector and keep the
system in a valid steady state.
To fix, simply add a negative value check like those
already in place for other locations.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
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>
Lower the default setting to ERROR for main and TRX
logs. This makes the log friendlier for embedded
installations.
With default setting of midpoint and WBX board on
N200, the overall receive gain comes out to 19 dB.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
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>
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>
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>
The output of the modulator or resampler is scaled and
converted from floating point to fixed point. The scaling
factor is the leftover dB in RF attention (relative to max
transmit power), which is handled prior to the integer
conversion. This should work across all daughterboards and
non-UHD installations.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
* dboard:
Transceiver52M: add WBX, DBSRX, and single board support
Transceiver: add WBX, DBSRX, and single board support
Conflicts:
public-trunk/Transceiver/radioInterface.cpp
Add gain and attenuation settings that were present
only in the 52MHz transceiver. This patch also
fixes SETRXGAIN failed warnings at startup.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Previously this was referenced off the the ad9862
PGA with a range from 0 to -20 dB. Instead base
the attenuation factor on the maximum total RF
gain returned by the device.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
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>
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>
M_SILENT_RULES improves readability of the messages emitted by make,
compiler warnings are easier to spot.
Available since automake-1.11, ignored on earlier versions.
Traditional verbose output can be forced by
"./configure --disable-silent-rules" or "make V=1"
Written-by: Alexander Huemer <alexander.huemer@xx.vu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
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>
Push the ability to set thread priority out to the 52M
Transceiver interface, because that's where the thread
control exists.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Use the same header files for the device and start moving
toward a commmon transceiver without so much redundant code.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
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>
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>
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>
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>
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>
Because I can't take it anymore...
Actually, I've been manually converting names to camel
case before checking in, which was an error prone process
in and of itself.
The interface is unchanged, so nobody should complain.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Utilize start and stop burst flags more effectively to
manage interaction with the FPGA. This makes communication
slightly more explicit, though it is not expected to
have a major effect. Also, lower the alignment messages
to DEBUG, and raise the asynchronous messages to INFO.
In other words, report the underrun, but not the handling
of it.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
On the E100, and possibly other systems, OpenBTS seg faults
at startup. The cause is a null reference to the global
logging file descriptor occuring due to an initializer order
dependency, which is not guaranteed across compilation
units.
When this occurs, check for for null and set the output to
stdout.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Though the receive loop ultimately drives the GSM clock,
it does not have any priority because it runs as a
separate thread from the trasmit loop. The transmit
has priority because it starts the UHD device, where
priority scheduling is enabled. The result is frequent
underruns, which occur regardless of buffer size tuning.
To address this, break out and expose the priority
setting so that it can be called from the radioInterface
at the start of a new thread.
Tested on a modest Intel Core 2 Duo tablet running
Linux 2.6.33.7.2-rt30, this reduced underruns down to
near zero.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Currently, upon receiving an unexpected timestamp, the sample
buffer will error and log its internal state. The errant
timestamp is not logged though. This patch fixes that.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Remove all RFX specific parts and control daughterboard
functionality using the base API. The tuning is now set
to a non-inverted image so remove the I/Q swap as well.
Daughterboard configuration is set through an enum
variable. Currently, there is no auto-configuration and
the default is Tx/RX on sides A/B respectively. For
transceiver boards the receive antenna is set to RX2.
enum dboardConfigType {
TXA_RXB,
TXB_RXA,
TXA_RXA,
TXB_RXB
};
const dboardConfigType dboardConfig = TXA_RXB;
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Remove all RFX specific parts and control daughterboard
functionality using the base API. The tuning is now set
to a non-inverted image so remove the I/Q swap as well.
Daughterboard configuration is set through an enum
variable. Currently, there is no auto-configuration and
the default is Tx/Rx on sides A/B respectively. For
transceiver boards the receive antenna is set to RX2.
enum dboardConfigType {
TXA_RXB,
TXB_RXA,
TXA_RXA,
TXB_RXB
};
const dboardConfigType dboardConfig = TXA_RXB;
The gains are currently not configurable through the
device API and default to midpoint for the installed
daughterboard(s).
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Certain chipsets (e.g. RTL8168) have issues with the
initial packet of samples at that start of a UHD
receive stream resulting in timestamp errors shortly
after start. This temporary patch forces a receive
during init to clear any lingering errant packets.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Recent UHD firmware for the USRP2/N210 replaces the MicroBlaze
with a slower ZPU in addition to changes to the control
transactions. The effect is less predictable reading of the
current time and Tx/Rx sample mis-alignment following
underruns.
After an underrun, this patch drops potentially stale packets
with a fixed interval instead of relying on reading the
current time from the device.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
The non-UHD implementation tunes the DDC to output an inverted
spectrum that requires swapping on the host. Push I/Q and byte
swapping into the device implementation and strip the related
bits out of the remaining transceiver code.
This also moves the Transceiver closer to the Transcever52M
version.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
* 'master' of git://openbts.git.sourceforge.net/gitroot/openbts/openbts: (21 commits)
Transceiver52M: Do not delete 'trx' on exit.
common libs: Implemented ISLOGGING() macro to test whether given loglevel is going to be logged.
common libs: Implemented BitVector::unhex() which reads a hex string into a BitVector.
common libs: Lower log level for "setting log path to " message.
common libs: Use gethostbyname2_r() instead of gethostbyname() if available.
control: Save IMEI in TMSI table for informational purposes.
sip: Set display name for To field in a SIP MESSAGE.
control: Use std::string in TransactionEntry to ctore messaging payload.
smqueue: Documentation fixes for sm_state enumeration in smqueue.
gsm: Add 8-bit alphabet to enumeration of GSM alphabets.
sip: More comments and minor code ordering in SIP::sip_message().
smqueue: Fix compiler warning about char* and constant strings.
Transceiver: correctly exit if USRP is not found.
Transceiver52M: Fix wrong memcpy().
Better safety checks in TMSIRecord::load().
Zero file descriptors set before use.
Remove unused variable in BitVector::hex().
Move more code out of asserts.
Don't put real code into assert().
Fix a bug with Timeval difference calculation on 64-bit Linux.
...
This should make it slightly less frequent to segfault on exit.
Actually we should shutdown all our threads correctly, but that's a lot of work.
(cherry picked from commit 7cd65d3e5a717e0c224477cacfe932cfd7a45b8f)
I don't see real value of this message, while it's been printed to the screen like something very important.
(cherry picked from commit 3f3c9b2d2599a672f08624b3081c2c687cbba4d4)
gethostbyname() is not thread-safe. It's recommended to use gethostbyname_r() or gethostbyname2_r() instead.
(cherry picked from commit f27e9581cdb6837f83d0aab467f0e5f83e814e7b)
Originally there was a fixed-size char array, which didn't allow to work with long hex strings.
(cherry picked from commit fdc6fc85f9f431438ef7279975c2f7c230cb4aa5)
1) It should be memmove(), because source and destination regions may overlap.
2) Amount of moved memory was calculated incorrectly and was about 2x times more then really needed. We thus touched memory outside of the allocated array and may crash the program.
(cherry picked from commit fbed302055ebe77ca19b899c8bc307ca05b4a604)
This time I checked all occurrences of assert() and all others are ok, if I didn't miss anything
(cherry picked from commit 2afd3fd962eb89e08a73420542267191f459815f)
If you compile with optimization and NDEBUG is defined, then the whole assert() is replaced with ((void) 0) and your code is not executed at all.
Don't assert() on pthread_join() return value. If thread was not started yet, then pthread_join() will fail, but it's ok for us.
(cherry picked from commit d0b797e62c, 21a84dcec9cdf25657bba5c221aac9d4bb81d8b3, 8ed37a1f36e1b1266728647e715f95a28df3f900)
Subtracting uint32_t from uin32_t gives you uint32_t. And assigning result to a long doesn't make it a signed value, because on 64-bit Linux long is 64 bits.
(cherry picked from commit 82dd78d698)
* 'master' of git://openbts.git.sourceforge.net/gitroot/openbts/openbts:
gsm: Remove obsolete PCAP stuff from gsmtap.h
gsm: Update and enhance the GSM Tap functionality
gsm: Add same ARFCN()/typeAndOffset() accessors to L1Decoder than L1Encoder
gsm: Save time of received frame for later use in XCCHL1Decoder
gsm: Create more precise TypeAndOffset cste for BCCH/CCCH
transceiver: Fix misusage of ~ in bitfields
misc: Add a proper .gitignore file
build: Fix Transceiver/Makefile.am to use AM_CXXFLAGS instead of CXX_FLAGS
build: Remove all files autogenerated by autoreconf
Fix trivial conflict:
public-trunk/Transceiver/Makefile.am
* switch to the new format
* add uplink frame dump as well
* fill more fields than before (not fully complete yet tough)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Somehow it seems the author tought using ~ would set that bit to 0. But
it invert all bits and as such set all others to '1'.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Best practice is to not include those in repositories but only
in tar.gz dist tarball.
autoreconf -i will regenerate them
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Fixes the following build error.
UHDDevice.cpp:462: error: ‘EVENT_CODE_SUCCESS’ is not a member of ‘uhd::async_metadata_t’
UHDDevice.cpp:507: error: ‘EVENT_CODE_SUCCESS’ is not a member of ‘uhd::async_metadata_t’
Reported-by: Dirk Kirsten <Dirk.Kirsten@uni-konstanz.de>
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Fixes the following that occurs with recent uhd changes.
UHDDevice.cpp:260: error: ‘struct uhd::gain_range_t’ has no member named ‘max’
UHDDevice.cpp:260: error: ‘struct uhd::gain_range_t’ has no member named ‘min’
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
The underrun behaviour of the USRP2 is different from the USRP1, and
the adaptive latency mechanism is not directly transferable. Instead,
fix the latency with a higher starting value, which effectively
buffers more samples on the host in front of the Ethernet interface.
An alternative may be to use the adaptive approach with USRP2
specific upper and lower bounds. For now, just use preprocessor
directives until a better solution comes around.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
There should be a better way to do this. Only the USRP1 option
in non-loopback mode needs the swap.
UHD & !SWLOOPBACK: FLIP_IQ = 0
UHD & SWLOOPBACK: FLIP_IQ = 0
USRP1 & !SWLOOPBACK: FLIP_IQ = 1
USRP1 & SWLOOPBACK: FLIP_IQ = 0
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Transceiver can be built with UHD by specifiying the --with-uhd
option. Fractional sample rates are not supported by the USRP2
so Transceiver52M is not built.
Otherwise, the default GNU Radio USRP1 implementation is used.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
This patch adds USRP2 device support and future support for
other UHD based devices. On receive, a sample buffer class,
which is indexable by timestamps, is used to temporarily
hold data until the requested samples are available.
On transmit, samples are sent immediately unless sample
alignment is known to be off - during startup or after the
occurrence of underruns or other errors. To regain
synchronization at these moments, timestamps are compared
against the current device time and dropped unless there
exists significant delay margin to physically arrive at the
device before deadline.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Move essential interface components into an abstract Device class
and create a factory method for instantiating compile-time
specified derived types (USRP1 or UHD).
The radioInterface has a device specific type conversion call to
the USRP1 driver, so push that behind the Device interface too.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Subtracting uint32_t from uin32_t gives you uint32_t. And assigning result to a long doesn't make it a signed value, because on 64-bit Linux long is 64 bits.
This hack accidentally leaked in the release code ... but it prevents
tuning for certain ARFCN and reduces TX power.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>