Merge branch 'master' into uplink

This commit is contained in:
Ismael Gomez 2016-06-10 17:57:13 +02:00
commit 3ea0ea221e
6 changed files with 60 additions and 19 deletions

21
matlab/common/bin2hex.m Normal file
View File

@ -0,0 +1,21 @@
function [ s ] = bin2hex( in )
%BIN2HEX Summary of this function goes here
% Detailed explanation goes here
a=reshape(in,8,[]);
t=size(a);
s=cell(1,t(2));
nbit=2.^(7:-1:0);
for i=1:t(2)
s{i}=dec2hex(sum(nbit'.*double(a(:,i))));
end
for i=1:t(2)
if (length(s{i})==1)
fprintf('0%s ',s{i})
else
fprintf('%s ',s{i})
end
end
fprintf('\n');
end

View File

@ -1,6 +1,6 @@
enb=struct('NCellID',1,'NDLRB',6,'NSubframe',4,'CFI',3,'CyclicPrefix','Normal','CellRefP',1,'Ng','One','PHICHDuration','Normal','DuplexMode','FDD');
enb=struct('NCellID',1,'NDLRB',25,'NSubframe',5,'CFI',2,'CyclicPrefix','Normal','CellRefP',1,'Ng','Sixth','PHICHDuration','Normal','DuplexMode','FDD');
RNTI=62;
RNTI=65535;
addpath('../../build/srslte/lib/phch/test')
@ -11,8 +11,8 @@ cec.InterpType = 'linear'; % 2D interpolation type
cec.InterpWindow = 'Causal'; % Interpolation window type
cec.InterpWinSize = 1; % Interpolation window size
subframe_rx=lteOFDMDemodulate(enb,x);
%subframe_rx=reshape(input,[],14);
%subframe_rx=lteOFDMDemodulate(enb,x);
subframe_rx=reshape(x,[],14);
[hest,nest] = lteDLChannelEstimate(enb, cec, subframe_rx);
% Search PDCCH
@ -20,7 +20,7 @@ pdcchIndices = ltePDCCHIndices(enb);
[pdcchRx, pdcchHest] = lteExtractResources(pdcchIndices, subframe_rx, hest);
[dciBits, pdcchSymbols] = ltePDCCHDecode(enb, pdcchRx, pdcchHest, nest);
pdcch = struct('RNTI', RNTI);
dci = ltePDCCHSearch(enb, pdcch, dciBits); % Search PDCCH for DCI
[dci, dcidecBits] = ltePDCCHSearch(enb, pdcch, dciBits); % Search PDCCH for DCI
if ~isempty(dci)
@ -30,9 +30,8 @@ if ~isempty(dci)
% Get the PDSCH configuration from the DCI
[pdsch, trblklen] = hPDSCHConfiguration(enb, dci, pdcch.RNTI);
pdsch.NTurboDecIts = 10;
pdsch.Modulation = {'64QAM'};
%pdsch.Modulation = {'64QAM'};
pdsch.RV=0;
trblklen=14112;
fprintf('PDSCH settings after DCI decoding:\n');
disp(pdsch);
@ -45,9 +44,9 @@ if ~isempty(dci)
[sib1, crc] = lteDLSCHDecode(enb, pdsch, trblklen, dlschBits);
%[dec2, data, pdschRx2, pdschSymbols2, e_bits] = srslte_pdsch(enb, pdsch, ...
% trblklen, ...
% subframe_rx, hest, nest);
[dec2, data, pdschRx2, pdschSymbols2, e_bits] = srslte_pdsch(enb, pdsch, ...
trblklen, ...
subframe_rx, hest, 0);
scatter(real(pdschSymbols{1}),imag(pdschSymbols{1}))

View File

@ -597,12 +597,12 @@ int main(int argc, char **argv) {
for (i=0;i<pdsch_cfg.grant.mcs.tbs/8;i++) {
data[i] = rand()%256;
}
/* Uncomment this to transmit on sf 0 and 5 only
/* Uncomment this to transmit on sf 0 and 5 only */
if (sf_idx != 0 && sf_idx != 5) {
send_data = true;
} else {
send_data = false;
}*/
}
}
if (send_data) {

View File

@ -83,6 +83,11 @@ target_link_libraries(srslte pthread m ${FFTW3F_LIBRARIES})
set_target_properties(srslte PROPERTIES
VERSION ${SRSLTE_VERSION_MAJOR}.${SRSLTE_VERSION_MINOR})
if(NOT DisableMEX)
target_link_libraries(srslte_static ${FFTW3F_LIBRARIES})
endif(NOT DisableMEX)
if(RF_FOUND)
if(UHD_FOUND)
target_link_libraries(srslte ${UHD_LIBRARIES})

View File

@ -480,6 +480,13 @@ int srslte_pdsch_decode_rnti(srslte_pdsch_t *q,
}
if (SRSLTE_VERBOSE_ISDEBUG()) {
DEBUG("SAVED FILE subframe.dat: received subframe symbols\n",0);
srslte_vec_save_file("subframe.dat", sf_symbols, SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t));
DEBUG("SAVED FILE hest0.dat and hest1.dat: channel estimates for port 0 and port 1\n",0);
srslte_vec_save_file("hest0.dat", ce[0], SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t));
if (q->cell.nof_ports > 1) {
srslte_vec_save_file("hest1.dat", ce[1], SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t));
}
DEBUG("SAVED FILE pdsch_symbols.dat: symbols after equalization\n",0);
srslte_vec_save_file("pdsch_symbols.dat", q->d, cfg->nbits.nof_re*sizeof(cf_t));
}

View File

@ -48,6 +48,8 @@ typedef struct {
size_t tx_nof_samples;
double tx_rate;
bool dynamic_rate;
bool has_rssi;
uhd_sensor_value_handle rssi_value;
} rf_uhd_handler_t;
void suppress_handler(const char *x)
@ -193,6 +195,11 @@ void rf_uhd_flush_buffer(void *h)
}
bool rf_uhd_has_rssi(void *h) {
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
return handler->has_rssi;
}
bool get_has_rssi(void *h) {
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
uhd_string_vector_handle rx_sensors;
uhd_string_vector_make(&rx_sensors);
@ -203,14 +210,11 @@ bool rf_uhd_has_rssi(void *h) {
}
float rf_uhd_get_rssi(void *h) {
if (rf_uhd_has_rssi(h)) {
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
uhd_sensor_value_handle value;
uhd_sensor_value_make_from_realnum(&value, "rssi", 0, "dBm", "%f");
uhd_usrp_get_rx_sensor(handler->usrp, "rssi", 0, &value);
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
if (handler->has_rssi) {
double val_out;
uhd_sensor_value_to_realnum(value, &val_out);
uhd_sensor_value_free(&value);
uhd_usrp_get_rx_sensor(handler->usrp, "rssi", 0, &handler->rssi_value);
uhd_sensor_value_to_realnum(handler->rssi_value, &val_out);
return val_out;
} else {
return 0.0;
@ -267,6 +271,11 @@ int rf_uhd_open(char *args, void **h)
.n_channels = 1
};
handler->has_rssi = get_has_rssi(handler);
if (handler->has_rssi) {
uhd_sensor_value_make_from_realnum(&handler->rssi_value, "rssi", 0, "dBm", "%f");
}
/* Initialize rx and tx stremers */
uhd_rx_streamer_make(&handler->rx_stream);
error = uhd_usrp_get_rx_stream(handler->usrp, &stream_args, handler->rx_stream);