mirror of
				https://github.com/fairwaves/UHD-Fairwaves.git
				synced 2025-11-04 14:03:19 +00:00 
			
		
		
		
	Compare commits
	
		
			16 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					e4dff6e07c | ||
| 
						 | 
					fab18d97a2 | ||
| 
						 | 
					c9304575bf | ||
| 
						 | 
					61ac2ee278 | ||
| 
						 | 
					7199b8667f | ||
| 
						 | 
					91185de06a | ||
| 
						 | 
					99d1b8adf3 | ||
| 
						 | 
					b81240db26 | ||
| 
						 | 
					0d0f0c710c | ||
| 
						 | 
					f528fa442f | ||
| 
						 | 
					132f8995ec | ||
| 
						 | 
					93d4343d85 | ||
| 
						 | 
					1421327cfe | ||
| 
						 | 
					1e0c879f53 | ||
| 
						 | 
					479d6e9cf6 | ||
| 
						 | 
					4bba18b1cf | 
							
								
								
									
										29
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										29
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,32 @@
 | 
			
		||||
umtrx (1.0.17) bionic; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * umtrx_auto_calibration: save result files to /var/lib/umtrx by default
 | 
			
		||||
 | 
			
		||||
 -- Kirill Zakharenko <earwin@gmail.com>  Wed, 20 Jun 2019 13:39:48 +0300
 | 
			
		||||
 | 
			
		||||
umtrx (1.0.16) bionic; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * first bionic build
 | 
			
		||||
  * python libraries are now in PYTHONPATH and reusable
 | 
			
		||||
  * minimized Boost build deps for faster builds
 | 
			
		||||
  * dropped collectd integration
 | 
			
		||||
  * fixed abrupt termination of umtrx_cal_*
 | 
			
		||||
 | 
			
		||||
 -- Kirill Zakharenko <earwin@gmail.com>  Wed, 19 Jun 2019 13:39:48 +0300
 | 
			
		||||
 | 
			
		||||
umtrx (1.0.15) trusty; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * host: Python 2 compatibility for umtrx_property_tree.py
 | 
			
		||||
  * utils: s/USRP/UmTRX/g in console output of umtrx_net_burner.py
 | 
			
		||||
 | 
			
		||||
 -- Rauf Gyulaliev <rauf.gyulaliev@fairwaves.co>  Tue, 15 Aug 2017 03:03:23 +0300
 | 
			
		||||
 | 
			
		||||
umtrx (1.0.14) trusty; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * Quick build fix.
 | 
			
		||||
 | 
			
		||||
 -- Rauf Gyulaliev <rauf.gyulaliev@fairwaves.co>  Mon, 07 Aug 2017 09:15:31 +0300
 | 
			
		||||
 | 
			
		||||
umtrx (1.0.13) trusty; urgency=low
 | 
			
		||||
 | 
			
		||||
  * [ZPU/host] Read TCXO DAC calibration from EEPROM once on UmTRX boot instead
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							@@ -1 +1 @@
 | 
			
		||||
9
 | 
			
		||||
11
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@@ -3,9 +3,13 @@ Section: libs
 | 
			
		||||
Priority: optional
 | 
			
		||||
Maintainer: Josh Blum <josh@pothosware.com>
 | 
			
		||||
Build-Depends:
 | 
			
		||||
    debhelper (>= 9.0.0),
 | 
			
		||||
    debhelper (>= 11.0.0),
 | 
			
		||||
    cmake (>= 2.8),
 | 
			
		||||
    libboost-all-dev,
 | 
			
		||||
    libboost-date-time-dev,
 | 
			
		||||
    libboost-filesystem-dev,
 | 
			
		||||
    libboost-system-dev,
 | 
			
		||||
    libboost-thread-dev,
 | 
			
		||||
    libboost-program-options-dev,
 | 
			
		||||
    libuhd-dev (>= 3.7)
 | 
			
		||||
Standards-Version: 3.9.5
 | 
			
		||||
Homepage: http://umtrx.org/
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								debian/umtrx.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								debian/umtrx.install
									
									
									
									
										vendored
									
									
								
							@@ -1,8 +1,3 @@
 | 
			
		||||
usr/bin
 | 
			
		||||
images/u2plus_umtrx_v2.bin images/umtrx_txrx_uhd.bin usr/share/umtrx/firmware
 | 
			
		||||
host/utils/umtrx_property_tree.py host/utils/umtrx_vswr.py usr/share/umtrx
 | 
			
		||||
host/utils/umtrx_query_sensors.py host/utils/umtrx_query_versions.py host/utils/umtrx_net_burner.py usr/share/umtrx
 | 
			
		||||
 | 
			
		||||
host/utils/collectd/umtrx.types.db usr/share/collectd
 | 
			
		||||
host/utils/collectd/umtrx2collectd.py usr/share/umtrx
 | 
			
		||||
host/utils/collectd/umtrx.conf etc/collectd/collectd.conf.d
 | 
			
		||||
host/utils/umtrx_property_tree.py host/utils/umtrx_vswr.py usr/lib/python2.7/dist-packages
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								debian/umtrx.links
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								debian/umtrx.links
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +0,0 @@
 | 
			
		||||
/usr/share/umtrx/umtrx_net_burner.py /usr/bin/umtrx_net_burner
 | 
			
		||||
/usr/share/umtrx/umtrx_query_sensors.py /usr/bin/umtrx_query_sensors
 | 
			
		||||
/usr/share/umtrx/umtrx_query_versions.py /usr/bin/umtrx_query_versions
 | 
			
		||||
@@ -741,7 +741,7 @@ umtrx_impl::umtrx_impl(const device_addr_t &device_addr)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //TCXO DAC calibration control
 | 
			
		||||
    if (not tcxo_dac.empty()) _tree->create<uint16_t>(mb_path / "tcxo_dac" / "value")
 | 
			
		||||
    _tree->create<uint16_t>(mb_path / "tcxo_dac" / "value")
 | 
			
		||||
        .subscribe(boost::bind(&umtrx_impl::set_tcxo_dac, this, _iface, _1));
 | 
			
		||||
 | 
			
		||||
    ////////////////////////////////////////////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,7 @@ void umtrx_impl::status_monitor_handler(void)
 | 
			
		||||
void umtrx_impl::server_query_handler(void)
 | 
			
		||||
{
 | 
			
		||||
    //accept the client socket (timeout is 100 ms, task is called again)
 | 
			
		||||
    if (not wait_read_sockfd(_server_query_tcp_acceptor->native(), 100)) return;
 | 
			
		||||
    if (not wait_read_sockfd(_server_query_tcp_acceptor->native_handle(), 100)) return;
 | 
			
		||||
    boost::shared_ptr<asio::ip::tcp::socket> socket(new asio::ip::tcp::socket(_server_query_io_service));
 | 
			
		||||
    _server_query_tcp_acceptor->accept(*socket);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,9 @@ INSTALL(PROGRAMS
 | 
			
		||||
    umtrx_gps_coord
 | 
			
		||||
    umtrx_auto_calibration
 | 
			
		||||
    umtrx_firmware
 | 
			
		||||
    umtrx_net_burner
 | 
			
		||||
    umtrx_query_sensors
 | 
			
		||||
    umtrx_query_versions
 | 
			
		||||
    DESTINATION bin
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
TypesDB "/usr/share/collectd/umtrx.types.db"
 | 
			
		||||
 | 
			
		||||
LoadPlugin exec
 | 
			
		||||
<Plugin exec>
 | 
			
		||||
  Exec "fairwaves-monitoring" "/usr/share/umtrx/umtrx2collectd.py"
 | 
			
		||||
</Plugin>
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
sensor        value:GAUGE:U:U
 | 
			
		||||
@@ -1,54 +0,0 @@
 | 
			
		||||
#!/usr/bin/python -u
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import sched, time
 | 
			
		||||
 | 
			
		||||
from umtrx_property_tree import umtrx_property_tree
 | 
			
		||||
from umtrx_vswr import umtrx_vswr
 | 
			
		||||
 | 
			
		||||
BOARD_ID = "0"
 | 
			
		||||
SENSORS_PATH = "/mboards/{id}/sensors".format(id=BOARD_ID)
 | 
			
		||||
VSWR_CALIBRATION = 0  # = TM10_VSWR_cal
 | 
			
		||||
 | 
			
		||||
HOSTNAME = os.environ['COLLECTD_HOSTNAME'] if 'COLLECTD_HOSTNAME' in os.environ  else 'localhost'
 | 
			
		||||
INTERVAL = os.environ['COLLECTD_INTERVAL'] if 'COLLECTD_INTERVAL' in os.environ  else '60'
 | 
			
		||||
 | 
			
		||||
umtrx = umtrx_property_tree()
 | 
			
		||||
umtrx.connect()
 | 
			
		||||
 | 
			
		||||
# typically this yields: ['tempA', 'tempB', 'voltagePR1', 'voltagePF1', 'voltagePR2', 'voltagePF2', 'voltagezero', 'voltageVin', 'voltageVinPA', 'voltageDCOUT']
 | 
			
		||||
sensors_list = umtrx.list_path_raw(SENSORS_PATH).get("result", [])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def publish():
 | 
			
		||||
    now = time.time()
 | 
			
		||||
 | 
			
		||||
    current_sensors = {sensor: umtrx.query_sensor_value(SENSORS_PATH + "/" + sensor) for sensor in sensors_list}
 | 
			
		||||
 | 
			
		||||
    for channel in ["1", "2"]:
 | 
			
		||||
        vpf_name = "voltagePF" + channel
 | 
			
		||||
        vpr_name = "voltagePR" + channel
 | 
			
		||||
 | 
			
		||||
        if vpf_name in current_sensors and vpr_name in current_sensors:
 | 
			
		||||
            vswr = umtrx_vswr(float(current_sensors[vpf_name]), float(current_sensors[vpr_name]), VSWR_CALIBRATION)
 | 
			
		||||
            current_sensors["VSWR" + channel] = vswr.vswr()
 | 
			
		||||
            current_sensors["ReturnLoss" + channel] = vswr.return_loss()
 | 
			
		||||
 | 
			
		||||
    for name, value in current_sensors.items():
 | 
			
		||||
        print "PUTVAL {host}/umtrx-{id}/sensor-{name} interval={interval} {now}:{value}".format(
 | 
			
		||||
            host=HOSTNAME, id=BOARD_ID, name=name.lower(), interval=INTERVAL, now=now, value=value)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
s = sched.scheduler(time.time, time.sleep)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def timer_loop():
 | 
			
		||||
    s.enter(float(INTERVAL), 1, timer_loop, ())
 | 
			
		||||
    publish()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
timer_loop()
 | 
			
		||||
s.run()
 | 
			
		||||
 | 
			
		||||
umtrx.close()
 | 
			
		||||
@@ -12,16 +12,22 @@ if [ "$#" -lt "1" ] ; then
 | 
			
		||||
  echo "  - Tx DC offset calibration"
 | 
			
		||||
  echo "  - Tx IQ balance calibration"
 | 
			
		||||
  echo
 | 
			
		||||
  echo "The result of the calibration is stored in the DIR/.uhd/cal/ directory. DIR is one of the \$APPDATA, \$HOME and /tmp,"
 | 
			
		||||
  echo "whichever is defined. Make sure you run calibration from the same user as the one who runs applications or define"
 | 
			
		||||
  echo "\$APPDATA or \$HOME appropriately. Calibration files will be loaded by the application automatically on startup."
 | 
			
		||||
  echo "Old calibration files are renamed when you run a calibration to avoid overwriting."
 | 
			
		||||
  echo "The result of the calibration is stored in the \$UHD_CONFIG_DIR/.uhd/cal/ directory."
 | 
			
		||||
  echo "If \$UHD_CONFIG_DIR is undefined, /var/lib/umtrx is used instead."
 | 
			
		||||
  echo "When running UHD applications, make sure you set one of \$UHD_CONFIG_DIR, \$APPDATA or \$HOME to the same directory,"
 | 
			
		||||
  echo "so the calibration files could be found and autoloaded by the application on startup."
 | 
			
		||||
  echo "Existing calibration files are renamed when you run a calibration to avoid overwriting."
 | 
			
		||||
  echo
 | 
			
		||||
  echo "Calibration is permanent and only depends on temperature. If the temperature of the system is stable, you need to"
 | 
			
		||||
  echo "run the calibration only once."
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -z "$UHD_CONFIG_DIR" ]; then
 | 
			
		||||
  export UHD_CONFIG_DIR=/var/lib/umtrx
 | 
			
		||||
fi
 | 
			
		||||
mkdir -p $UHD_CONFIG_DIR
 | 
			
		||||
 | 
			
		||||
presets=$*
 | 
			
		||||
 | 
			
		||||
sides="A B"
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@
 | 
			
		||||
 | 
			
		||||
#include "usrp_cal_utils.hpp"
 | 
			
		||||
#include <uhd/utils/safe_main.hpp>
 | 
			
		||||
#include <boost/ref.hpp>
 | 
			
		||||
#include <boost/program_options.hpp>
 | 
			
		||||
#include <boost/format.hpp>
 | 
			
		||||
#include <boost/math/special_functions/round.hpp>
 | 
			
		||||
@@ -342,8 +343,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
 | 
			
		||||
    uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
 | 
			
		||||
 | 
			
		||||
    //create a transmitter thread
 | 
			
		||||
    std::atomic<bool> interrupted(false);
 | 
			
		||||
    boost::thread_group threads;
 | 
			
		||||
    threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl));
 | 
			
		||||
    threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl, boost::ref(interrupted)));
 | 
			
		||||
 | 
			
		||||
    //store the results here
 | 
			
		||||
    std::vector<result_t> results;
 | 
			
		||||
@@ -403,7 +405,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
 | 
			
		||||
    std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
    //stop the transmitter
 | 
			
		||||
    threads.interrupt_all();
 | 
			
		||||
    interrupted = true;
 | 
			
		||||
    threads.join_all();
 | 
			
		||||
 | 
			
		||||
    if (not vm.count("single_test"))
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@
 | 
			
		||||
 | 
			
		||||
#include "usrp_cal_utils.hpp"
 | 
			
		||||
#include <uhd/utils/safe_main.hpp>
 | 
			
		||||
#include <boost/ref.hpp>
 | 
			
		||||
#include <boost/program_options.hpp>
 | 
			
		||||
#include <boost/math/special_functions/round.hpp>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
@@ -83,8 +84,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
 | 
			
		||||
    uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
 | 
			
		||||
 | 
			
		||||
    //create a transmitter thread
 | 
			
		||||
    std::atomic<bool> interrupted(false);
 | 
			
		||||
    boost::thread_group threads;
 | 
			
		||||
    threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl));
 | 
			
		||||
    threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl, boost::ref(interrupted)));
 | 
			
		||||
 | 
			
		||||
    //re-usable buffer for samples
 | 
			
		||||
    std::vector<samp_type> buff;
 | 
			
		||||
@@ -177,7 +179,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
 | 
			
		||||
    std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
    //stop the transmitter
 | 
			
		||||
    threads.interrupt_all();
 | 
			
		||||
    interrupted = true;
 | 
			
		||||
    threads.join_all();
 | 
			
		||||
 | 
			
		||||
    store_results(usrp, results, "tx", "iq", vm.count("append"));
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
#!/usr/bin/env python
 | 
			
		||||
#
 | 
			
		||||
# Copyright 2010-2011 Ettus Research LLC
 | 
			
		||||
# Copyright 2013-2017 Fairwaves, Inc.
 | 
			
		||||
#
 | 
			
		||||
# This program is free software: you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -16,10 +17,7 @@
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# TODO: make it autodetect UHD devices
 | 
			
		||||
 | 
			
		||||
import optparse
 | 
			
		||||
import math
 | 
			
		||||
import os
 | 
			
		||||
import re
 | 
			
		||||
import struct
 | 
			
		||||
@@ -495,7 +493,7 @@ class burner_socket(object):
 | 
			
		||||
########################################################################
 | 
			
		||||
def get_options():
 | 
			
		||||
    parser = optparse.OptionParser()
 | 
			
		||||
    parser.add_option("--addr", type="string",                 help="USRP-N2XX device address",       default='')
 | 
			
		||||
    parser.add_option("--addr", type="string",                 help="UmTRX device address",       default='')
 | 
			
		||||
    parser.add_option("--fw",   type="string",                 help="firmware image path (optional)", default='')
 | 
			
		||||
    parser.add_option("--fpga", type="string",                 help="fpga image path (optional)",     default='')
 | 
			
		||||
    parser.add_option("--reset", action="store_true",          help="reset the device after writing", default=False)
 | 
			
		||||
@@ -527,7 +525,7 @@ if __name__=='__main__':
 | 
			
		||||
 | 
			
		||||
    if options.overwrite_safe and not options.read:
 | 
			
		||||
        print("Are you REALLY, REALLY sure you want to overwrite the safe image? This is ALMOST ALWAYS a terrible idea.")
 | 
			
		||||
        print("If your image is faulty, your USRP2+ will become a brick until reprogrammed via JTAG.")
 | 
			
		||||
        print("If your image is faulty, your UmTRX will become a brick until reprogrammed via JTAG.")
 | 
			
		||||
        response = raw_input("""Type "yes" to continue, or anything else to quit: """)
 | 
			
		||||
        if response != "yes": sys.exit(0)
 | 
			
		||||
 | 
			
		||||
@@ -26,7 +26,7 @@ class umtrx_property_tree:
 | 
			
		||||
    d = dict(action=action, path=path)
 | 
			
		||||
    if value_type is not None: d['type'] = value_type
 | 
			
		||||
    if value is not None: d['value'] = value
 | 
			
		||||
    return self.s.send(bytes(json.dumps(d)+'\n', 'UTF-8'))
 | 
			
		||||
    return self.s.send((json.dumps(d)+'\n').encode('UTF-8'))
 | 
			
		||||
 | 
			
		||||
  def _recv_response(self):
 | 
			
		||||
    resp = self.f.readline().strip()
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@
 | 
			
		||||
#include <complex>
 | 
			
		||||
#include <cmath>
 | 
			
		||||
#include <fstream>
 | 
			
		||||
#include <atomic>
 | 
			
		||||
 | 
			
		||||
namespace fs = boost::filesystem;
 | 
			
		||||
 | 
			
		||||
@@ -227,7 +228,7 @@ static void capture_samples(
 | 
			
		||||
/***********************************************************************
 | 
			
		||||
 * Transmit thread
 | 
			
		||||
 **********************************************************************/
 | 
			
		||||
static void tx_thread(uhd::usrp::multi_usrp::sptr usrp, const double tx_wave_freq, const double tx_wave_ampl){
 | 
			
		||||
static void tx_thread(uhd::usrp::multi_usrp::sptr usrp, const double tx_wave_freq, const double tx_wave_ampl, std::atomic<bool> &interrupted){
 | 
			
		||||
    uhd::set_thread_priority_safe();
 | 
			
		||||
 | 
			
		||||
    //create a transmit streamer
 | 
			
		||||
@@ -246,7 +247,7 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp, const double tx_wave_fre
 | 
			
		||||
    wave_table table(tx_wave_ampl);
 | 
			
		||||
 | 
			
		||||
    //fill buff and send until interrupted
 | 
			
		||||
    while (not boost::this_thread::interruption_requested()){
 | 
			
		||||
    while (not interrupted){
 | 
			
		||||
        for (size_t i = 0; i < buff.size(); i++){
 | 
			
		||||
            buff[i] = table(index += step);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user