Commit de3ba76b authored by kaltenbe's avatar kaltenbe

first steps of SoDeRa configuration

parent 191e93cc
......@@ -438,16 +438,18 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
#set(LOWLATENCY False)
elseif (${RF_BOARD} STREQUAL "OAI_SODERA")
include_directories("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/")
include_directories("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/SoDeRaV1_distro_01v/lms7suite_source_code/src/lms7002m")
include_directories("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/SoDeRaV1_distro_01v/lms7suite_source_code/src/Si5351C")
include_directories("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB")
include_directories("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/lms7suite/src/lms7002m")
include_directories("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/lms7suite/src/Si5351C")
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/sodera_lib.cpp
)
LINK_DIRECTORIES("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/SoDeRaV1_distro_01v/lms7suite_source_code/build/lms7002m")
LINK_DIRECTORIES("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/lms7suite/src/lms7002m")
LINK_DIRECTORIES("${OPENAIR_TARGETS}/ARCH/SODERA/USERSPACE/LIB/lms7suite/src/Si5351C")
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
set(option_HW_lib "usb-1.0")
set(LMS7002_LIB "libLMS7002M.a")
set(Si5351C_LIB "libSi5351C.a")
#set(LOWLATENCY False)
elseif (${RF_BOARD} STREQUAL "ETHERNET")
......@@ -1447,7 +1449,7 @@ add_executable(lte-softmodem
target_link_libraries (lte-softmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${LMS7002_LIB}
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${LMS7002_LIB} ${Si5351C_LIB}
-Wl,--end-group )
......
......@@ -59,11 +59,16 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
return(openair0_dev_init_usrp(device, openair0_cfg));
#elif OAI_BLADERF
device->type=BLADERF_IF;
printf(" openair0_dev_init_bladerf ...\n");
printf("openair0_dev_init_bladerf ...\n");
return(openair0_dev_init_bladerf(device, openair0_cfg));
#elif OAI_SODERA
device->type=OAI_SODERA;
printf(" openair0_dev_init_sodera ...\n");
printf("openair0_dev_init_sodera ...\n");
if (openair0_cfg[0].configFilename==NULL) {
printf("Please provide a configuration file for SoDeRa\n");
exit(-1);
}
return(openair0_dev_init_sodera(device, openair0_cfg));
#endif
......
......@@ -133,7 +133,8 @@ typedef struct {
char *my_ip;
//! my port number for Ethernet interface (eNB/BBU, UE)
int my_port;
//! Configuration file for LMS7002M
char *configFilename;
} openair0_config_t;
typedef struct {
......
......@@ -31,8 +31,9 @@
*
* Author: Raymond Knopp
*/
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
......@@ -49,6 +50,7 @@
#include "common_lib.h"
#include "lmsComms.h"
#include "LMS7002M.h"
#include "Si5351C.h"
#ifdef __SSE4_1__
# include <smmintrin.h>
......@@ -58,6 +60,8 @@
# include <immintrin.h>
#endif
using namespace std;
int num_devices=0;
/*These items configure the underlying asynch stream used by the the sync interface.
*/
......@@ -84,8 +88,8 @@ typedef struct
uhd::async_metadata_t async_md;
*/
LMScomms mDataPort;
LMScomms Port;
Si5351C Si;
double sample_rate;
// time offset between transmiter timestamp and receiver timestamp;
double tdiff;
......@@ -103,6 +107,7 @@ typedef struct
} sodera_state_t;
sodera_state_t sodera_state;
static int trx_sodera_start(openair0_device *device)
{
......@@ -308,62 +313,99 @@ int trx_sodera_reset_stats(openair0_device* device) {
int openair0_dev_init_sodera(openair0_device* device, openair0_config_t *openair0_cfg)
{
sodera_state_t *s = (sodera_state_t*)malloc(sizeof(sodera_state_t));
sodera_state_t *s=&sodera_state;
size_t i;
memset(s, 0, sizeof(sodera_state_t));
// Initialize SODERA device
if (!s->mDataPort.Open(0)) {
printf("Cannot open SoDeRa\n");
exit(-1);
}
s->Port.RefreshDeviceList();
vector<string> deviceNames=s->Port.GetDeviceList();
int vers=0,subvers=0,subsubvers=0;
int bw_gain_adjust=0;
if (deviceNames.size() == 1) {
if (s->Port.Open(0) != IConnection::SUCCESS) {
printf("Cannot open SoDeRa\n");
exit(-1);
}
LMSinfo devInfo = s->Port.GetInfo();
printf("Device %s, HW: %d, FW: %d, Protocol %d\n",
GetDeviceName(devInfo.device),
(int)devInfo.hardware,
(int)devInfo.firmware,
(int)devInfo.protocol);
LMS7002M lmsControl(&s->Port);
printf("Configuring Si5351C\n");
s->Si.Initialize(&s->Port);
s->Si.SetPLL(0, 25000000, 0);
s->Si.SetPLL(1, 25000000, 0);
s->Si.SetClock(0, 27000000, true, false);
s->Si.SetClock(1, 27000000, true, false);
for (int i = 2; i < 8; ++i)
s->Si.SetClock(i, 27000000, false, false);
Si5351C::Status status = s->Si.ConfigureClocks();
if (status != Si5351C::SUCCESS)
{
printf("Failed to configure Si5351C");
exit(-1);
}
status = s->Si.UploadConfiguration();
if (status != Si5351C::SUCCESS)
printf("Failed to upload Si5351C configuration");
printf("Configuring LMS7002\n");
int bw_gain_adjust=0;
openair0_cfg[0].rx_gain_calib_table = calib_table_sodera;
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15;
openair0_cfg[0].tx_bw = 20e6;
openair0_cfg[0].rx_bw = 20e6;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
case 15360000:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 45;
openair0_cfg[0].tx_bw = 10e6;
openair0_cfg[0].rx_bw = 10e6;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 7680000:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_bw = 5e6;
openair0_cfg[0].rx_bw = 5e6;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 1920000:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_bw = 1.25e6;
openair0_cfg[0].rx_bw = 1.25e6;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
/*
for(i=0;i<s->usrp->get_rx_num_channels();i++) {
if (i<openair0_cfg[0].rx_num_channels) {
openair0_cfg[0].rx_gain_calib_table = calib_table_sodera;
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15;
openair0_cfg[0].tx_bw = 20e6;
openair0_cfg[0].rx_bw = 20e6;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
case 15360000:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 45;
openair0_cfg[0].tx_bw = 10e6;
openair0_cfg[0].rx_bw = 10e6;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 7680000:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_bw = 5e6;
openair0_cfg[0].rx_bw = 5e6;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
break;
case 1920000:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_bw = 1.25e6;
openair0_cfg[0].rx_bw = 1.25e6;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
liblms7_status opStatus;
lmsControl.ResetChip();
opStatus = lmsControl.LoadConfig(openair0_cfg[0].configFilename);
if (opStatus != LIBLMS7_SUCCESS) {
printf("Failed to load configuration file %s\n",openair0_cfg[0].configFilename);
exit(-1);
}
/*
for(i=0;i<openair0_cfg[0].rx_num_channels;i++) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
printf("Setting rx freq/gain on channel %lu/%lu : BW %f (readback %f)\n",i,s->usrp->get_rx_num_channels(),openair0_cfg[0].rx_bw/1e6,s->usrp->get_rx_bandwidth(i)/1e6);
......@@ -420,9 +462,12 @@ int openair0_dev_init_sodera(openair0_device* device, openair0_config_t *openair
std::cout << boost::format("Actual TX bandwidth: %fM...") % (s->usrp->get_tx_bandwidth(i)/1e6) << std::endl;
std::cout << boost::format("Actual TX antenna: %s...") % (s->usrp->get_tx_antenna(i)) << std::endl;
}
}
*/
}
else {
printf("Please connect SoDeRa\n");
exit(-1);
}
device->priv = s;
device->trx_start_func = trx_sodera_start;
......
This diff is collapsed.
This diff is collapsed.
......@@ -17,7 +17,7 @@ eNBs =
mobile_country_code = "208";
mobile_network_code = "92";
mobile_network_code = "93";
////////// Physical parameters:
......@@ -36,7 +36,7 @@ eNBs =
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 120;
rx_gain = 128;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
......@@ -66,7 +66,7 @@ eNBs =
pusch_p0_Nominal = -90;
pusch_alpha = "AL1";
pucch_p0_Nominal = -108;
pucch_p0_Nominal = -96;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
......@@ -131,7 +131,7 @@ eNBs =
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.13.11";
mme_ip_address = ( { ipv4 = "192.168.12.11";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......@@ -141,10 +141,10 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.215/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.215/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
......
......@@ -290,6 +290,8 @@ double bw = 10.0e6;
static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
char rf_config_file[1024];
int chain_offset=0;
#ifndef EXMIMO
......@@ -411,6 +413,7 @@ void help (void) {
printf(" sudo -E lte-softmodem [options]\n");
printf(" sudo -E ./lte-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.openEPC.conf -S -V -m 26 -t 16 -x 1 --ulsch-max-errors 100 -W\n\n");
printf("Options:\n");
printf(" --rf-config-file Configuration file for front-end (e.g. LMS7002M)\n");
printf(" --ulsch-max-errors set the max ULSCH erros\n");
printf(" --calib-ue-rx set UE RX calibration\n");
printf(" --calib-ue-rx-med \n");
......@@ -2051,6 +2054,7 @@ static void get_options (int argc, char **argv)
enum long_option_e {
LONG_OPTION_START = 0x100, /* Start after regular single char options */
LONG_OPTION_RF_CONFIG_FILE,
LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS,
LONG_OPTION_CALIB_UE_RX,
LONG_OPTION_CALIB_UE_RX_MED,
......@@ -2067,6 +2071,7 @@ static void get_options (int argc, char **argv)
};
static const struct option long_options[] = {
{"rf-config-file",required_argument, NULL, LONG_OPTION_RF_CONFIG_FILE},
{"ulsch-max-errors",required_argument, NULL, LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS},
{"calib-ue-rx", required_argument, NULL, LONG_OPTION_CALIB_UE_RX},
{"calib-ue-rx-med", required_argument, NULL, LONG_OPTION_CALIB_UE_RX_MED},
......@@ -2085,11 +2090,19 @@ static void get_options (int argc, char **argv)
while ((c = getopt_long (argc, argv, "A:a:C:dEK:g:F:G:hqO:m:SUVRM:r:P:Ws:t:Tx:",long_options,NULL)) != -1) {
switch (c) {
case LONG_OPTION_RF_CONFIG_FILE:
if (strlen(optarg)<=1024)
strcpy(rf_config_file,optarg);
else {
printf("Configuration filename is too long\n");
exit(-1);
}
break;
case LONG_OPTION_MAXPOWER:
tx_max_power[0]=atoi(optarg);
for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++)
tx_max_power[CC_id]=tx_max_power[0];
break;
case LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS:
ULSCH_max_consecutive_errors = atoi(optarg);
printf("Set ULSCH_max_consecutive_errors = %d\n",ULSCH_max_consecutive_errors);
......@@ -2552,8 +2565,12 @@ int main( int argc, char **argv )
}
logInit();
rf_config_file[0]='\0';
get_options (argc, argv); //Command-line options
if (rf_config_file[0] == '\0')
openair0_cfg[0].configFilename = NULL;
else
openair0_cfg[0].configFilename = rf_config_file;
// initialize the log (see log.h for details)
set_glog(glog_level, glog_verbosity);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment