Hello every friend,
Could I spare you a few minutes? :) My Teammates and I have learned to develop an application using B200mini on Android.
Here are some questions to consult. I would be greatly appreciated if you can reply them.
We modified the fg.cpp in Mr. Tom Trondeau’s GrRxFM project like this.
We added the header file
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/fft/fft_vfc.h>
#include <gnuradio/fft/window.h>
And add these variables
gr::blocks::ctrlport_probe2_f::sptr vsnk;
gr::blocks::file_sink::sptr fsink;
gr::fft::fft_vfc::sptr fftblock;
and add some lines in Java_org_gnuradio_grrxfm_RunGraph_FgInit function with bold font
JNIEXPORT void JNICALL
Java_org_gnuradio_grrxfm_RunGraph_FgInit(JNIEnv* env, jobject thiz,
int fd, jstring devname)
{
GR_INFO("fg", "FgInit Called");
float samp_rate = 320e3;
const char *usbfs_path = env->GetStringUTFChars(devname, NULL);
std::stringstream args;
args << "uhd,fd=" << fd << ",usbfs_path=" << usbfs_path;
GR_INFO("fg", boost::str(boost::format("Using UHD args=%1%") % args.str()));
uhd::stream_args_t stream_args;
stream_args.cpu_format = "fc32";
stream_args.otw_format = "sc16";
std::vector<float> chan_taps = gr::filter::firdes::low_pass_2(1, samp_rate, 150e3, 50e3, 60, gr::filter::firdes::WIN_HANN);
int resamp = 10;
std::vector<float> audio_taps = gr::filter::firdes::low_pass_2(1, samp_rate, 10e3, 2e3, 60, gr::filter::firdes::WIN_HANN);
float max_dev = 75e3;
float fm_demod_gain = samp_rate / (2.0f * M_PI * max_dev);
float audio_rate = samp_rate / resamp;
tb = gr::make_top_block("fg");
src = gr::uhd::usrp_source::make(args.str(), stream_args);
chan_filt = gr::filter::fir_filter_ccf::make(1, chan_taps);
demod = gr::analog::quadrature_demod_cf::make(fm_demod_gain);
audio_filt = gr::filter::fir_filter_fff::make(resamp, audio_taps);
vsnk = gr::blocks::ctrlport_probe2_f::make("rxdata", "Received FM Signal", 2048, 8);
snk = gr::grand::opensl_sink::make(int(audio_rate));
fsink = gr::blocks::file_sink::make(16,"/mnt/sdcard/testfile.txt");
std::vector<float> fftwindow = gr::fft::window::blackman(1024);
fftblock=gr::fft::fft_vfc::make(1024,true,fftwindow);
src->set_samp_rate(samp_rate);
tb->connect(src, 0, chan_filt, 0);
tb->connect(chan_filt, 0, demod, 0);
tb->connect(demod, 0, audio_filt, 0);
tb->connect(audio_filt, 0, snk, 0);
tb->connect(chan_filt,0,fftblock,0);
error occurred when the line of code executed and error msg are
7611-7611/org.gnuradio.grrxfm E/logger: itemsize mismatch: fir_filter_ccf0:0 using 8, fft_vfc_fftw0:0 using 4096
7159-7159/org.gnuradio.grrxfm A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 7159 (gnuradio.grrxfm)
tb->connect(fftblock,0,fsink,0); // saved successfully
tb->connect(chan_filt,0,vsnk,0);
error occurred when the line of code executed and error msg are
7159-7159/org.gnuradio.grrxfm E/logger: itemsize mismatch: fir_filter_ccf0:0 using 8, probe2_f0:0 using 4
7159-7159/org.gnuradio.grrxfm A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 7159 (gnuradio.grrxfm)
sig = gr::analog::sig_source_f::make(audio_rate, gr::analog::GR_SIN_WAVE, 400, 0.5);
tb->connect(sig, 0, vsnk, 0);
}
Question 1: How do we correct these errors? How do we know and determine the itemsize of block like fir_filter_ccf0:0 probe2_f0:0 etc.?
Question 2: How do we retrieve data from control port probe vsnk and used by Java layer? Use GetKnobs()? Or other method?
Thank you very much!!
No comments:
Post a Comment