Questions from a beginner

Discussions related to embedded firmware, driver, and user mode application software development
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

Thanks for that.

Recycling the board: I think I did but it wasn't done with purpose so I can't say. I had the board in and out over a period of time yesterday so I don't know if that was why it came back showing "2.0.0". If I had to guess I'd say no since after installing Porthos and using the newer version of Zadig the board shows up in the Device Manager in a different place in the list. After that the version showed it as "2.0.0". So something changed....

I tried CMake again and it seemed to have gotten worse...or at least more "RED" from the output:
The C compiler identification is MSVC 18.0.21005.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Build type not specified: defaulting to a release build.
Check if the system is big endian
Searching 16 bit integer
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of unsigned short
Check size of unsigned short - done
Using unsigned short
Check if the system is big endian - little endian
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Checking libusb version...
Failed to load D:/Program Files/PothosSDR/lib/libusb-1.0.dll

CMake Warning at cmake/modules/FindLibUSB.cmake:174 (message):


Failed to compile (compiled=TRUE) or run (retval=-1) libusb version check.

This may occur if libusb is earlier than v1.0.10.

Setting LIBUSB_VERSION to 0.0.0.

Call Stack (most recent call first):
CMakeLists.txt:68 (include)


Cypress backend not available. The following location does not exist: FX3_SDK_PATH=
CMake Warning (dev) at CMakeLists.txt:82 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.

Quoted variables like "MSVC" will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
This warning is for project developers. Use -Wno-dev to suppress it.

--

C:/Program Files/bladeRF/lib does not exist. Defaulting libbladeRF install location to C:/Program Files/bladeRF/lib.
CMake Warning (dev) at libraries/libbladeRF/CMakeLists.txt:130 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.

Quoted variables like "MSVC" will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at cmake/modules/FindLibPThreadsWin32.cmake:83 (message):
Unable to find pthread-win32 COPYING.LIB file
Call Stack (most recent call first):
libraries/libbladeRF/CMakeLists.txt:173 (find_package)


Configuring incomplete, errors occurred!
I moved the "libusb-1.0.20", "pthreads-w32" and "bladeRF" to the default locations. The "bladeRF" does not have a "lib" folder after I installed it in the default location but I don't know why CMake is looking for it.

As noted in the output CMake could not load "D:/Program Files/PothosSDR/lib/libusb-1.0.dll". The file is there so I don't know why it couldn't load. Does this relate to the "libusb-1.0.20" it is using in the other path? In fact, I don't even know how CMake knows Pothos was placed on my "D" drive. :?:

FX3_SDK_PATH is blank and I don't know what to put there anyway.

Before I ran this above I deleted the cache and deleted what was in the "build" directory.

Thanks

EDIT TO ADD: I noticed that in the instructions on the Wiki it says to use Zadig and have it install a "libusbK" driver. Yet "libusb-1.0.20" was downloaded. Are these two different drivers? These doesn't seem to be but four choices on Zadig and none of these have anything to do with 1.0.20. I don't understand. Which driver is supposed to be used?

jom
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

Drivers: I'm not sure at this point what the driver is supposed to be. I did get SDR Console to work only after I changed the driver to Cypress from the libsub driver. This morning however SDR Console won't work. :(

I still haven't got CMake to work for me (as in the last post) so I kind of put that aside.

Pothos is somewhat incomprehensible to me. I go around and around with the instructions on Github only to get confused more. Soapy this and GNU that are driving me nuts. :lol: I need to step back and start over...I've put way too many installs on my system the last week and it's hard to keep track of.

I really have no specific questions (other than the last post above). I'm rather frustrated at the moment. :|

EDIT to add: I got to try the SoapySDR bladeRF plug-in build process tonight. Everything went fine (CMake actually worked!) until I actually tried to build the solution in VS2013. I got 137 errors. I later used another method (command line suggestion on one of the wikis) which then worked. Once it was installed it only put the bladeRF.dll in the Soapy folder. Is that all it was supposed to do? It didn't create any bin directory as suggested in the user guide. :?:

jom
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

OK, I finally got this to work for me. A lot of screwing around and putting things in the right place (I think)....several hours of frustration mostly. :o

Anyway, at this point I have the "solution" files in VS 2013 ready to do....something. I'm not sure what at this point. So if I may ask: are there any examples of what people have done at this point and can there be a way to build a Windows interface to the radio at this point? Or...am I barking up the wrong tree?

Also, on another issue, is there a place that has some good examples of Pothos working with the bladeRF? I found that this program is quite confusing at times. I think it's capabilities is WAY more than what I had originally thought. Again, much of the nomenclature that is used in with the program I find a bit out of my league. Also, even though there are a few videos from the creator on YouTube none direct you to any example files you can use to run radio...well...at least no bladeRF examples. Many of the videos just end abruptly..it kind of leaves you hanging... :?:

Thanks for any info you can give.

jom
jynik
Posts: 455
Joined: Thu Jun 06, 2013 8:15 pm

Re: Questions from a beginner

Post by jynik »

Hi jom,

Great job on the progress you've made so far. I'm really sorry to have left you hanging -- life's been really busy for me and it's getting increasingly difficult to spend as much time as I'd like providing detailed responses. Your questions here are open ended, but hopefully my arbitrary rantings here will be at least mildly useful...

The fact that you've endured through the frustration and stuck with it is fantastic -- things will start making more sense as they become more familiar. Not to be a masochist, but a little pain always seems to be involved with learning new toolchains, languages, etc. :?

At this point you know how to build yourself a brand new bladeRF.dll, bladeRF.lib, etc. This will allow you to play with the codebase, and more importantly, create debug builds that you can use to debug into libbladeRF (or add debug print statements) when writing your custom programs. One reason I love open source software is this reason precisely. Sure, the documentation generally notes the conditions under which errors are thrown, but it's great to be able to see what exact conditions are causing the underlying code to either say, "Hey, you're doing something wrong here!" or go off the rails.

I'm really not too sure about other folks' work in Windows that you could leverage to learn more. (I'm a Linux guy, and am not so familiar with what open-source projects are available on the Windows side, aside from what I've already mentioned.)

If I were in your shoes, I would break your project into smaller goals, work towards those, and then integrate them together as a larger project you're envisioning. For example:
  • Figure out how to create a new "Solution" in Visual Studio and program a simple console-based "Hello World". You could either do this the Visual Studio way, or with CMake. The former might be the best option for now, if you're itching to just start on some code.
  • Do the same, but with a program that uses the bladeRF API to open a device and print some information, such as its serial number, firmware, and FPGA version
  • Further extend that simple command-line program to RX some samples into a large heap-allocated buffer, and then save them to a file in the format that works best for you. If you're a MATLAB or Octave guy, exporting samples as a CSV might work well.
  • In parallel, start looking into the GUI programming tasks you'd like to do. Mock them up and experiment with the different types of views you'd like
  • Make another set of little projects to do some of the signal processing you'd like to do (e.g., FM demodulation -> audio playback). Try recording samples in the bladeRF-cli and feeding sample files through these.


In short, break things down into lots of very concise projects - get these working well first under "ideal" conditions, and then deal with integrating components as an additional step. When things don't work, you can go back to those smaller individual projects and seek to understand where the differences in behavior come from.

With respect to Pothos -- Josh Blum is pretty great about offering advice and is reachable in the #pothos IRC channel on Freenode, as well as some mailing lists. There's some links to the mailing lists here: https://github.com/pothosware/pothos/issues/2

Josh has a few bladeRFs and has done some cool work with them. I bet he or someone else in the Pothos community would be willing to show you how to configure the source/sink blocks for a bladeRF. Bandwidth and sample rate permitting, you should generally be able modify examples to target the bladeRF.
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

Thanks a bunch!

What I think you are saying is maybe where I kind of thought this was going: At this point you can build whatever one likes such as a command line or even a "windows based" SDR control (like GNURadio) using this code...I think. Maybe I'll work up a quick Windows app with a few buttons to push to get the radio to do something. I'd like to see if I can get the TX to work...I have my own spectrum analyzer I can use to direct the signal too. :)

A side question here: I don't think jynik can answer this as it seems he is using Linux but in case others are reading this: In Visual Studio when I hit the "Local Windows Debugger" button I get a "project out of date" window with a file " win_runtime - Debug Win32" listed to re-build. When I do I get an error "Unable to start program C:/...etc.../host/build/Debug/ALL_BUILD The system cannot find the file specified". If anyone has this error can they explain why it happens?

Another question: Given my lack of experience with "C/C++" is it possible to use any of these "build" folder files in C# or Visual Basic instead? I can use the latter languages FAR better than C/C++...at least that way I can get something going a lot sooner. The problem really is that I don't do programming on a regular basis. This always makes it hard since I often have to re-learn stuff I've already done before. You don't forget everything but often things come back to you slower since you haven't used it in awhile.

CMake Issues:

I did find something odd that jynik might be interested in. When using CMake one of several errors that kept coming up was CMake looking and not finding the libusb in my Pothos directory. I found that weird as I have no clue why it was looking for that in my Pothos directory. So I tried to go through many of the "CMakeLists" text files to find where it was that CMake was using my Pothos directory. Not knowing CMake script syntax made this task quite difficult. So I eventually just changed the name of my Pothos directory to something else (putting "xxxx" at the end or something) temporarily. Only THEN did CMake find the libusb info where I had directed it to.

I had a similar issue with where CMake was looking for some "lib" directory in my bladeRF folder. I took my witless brain a day to figure out just to create this directory where CMake was looking for it. That seemed to solve the problem. Funny thing is NOTHING ended up in that directory so I have no clue what it wanted this for (see my posts from a few days ago above for the output from CMake).

I will direct my Pothos issues to the author Josh (poor guy...lol).

Thanks again for everything!

jom
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

A more direct question:

I was looking at: https://libraries.io/github/Nuand/Simul ... AB-bladeRF and noted the GitHub project page was gone. The Simulink-MATLAB-bladeRF code that allows you to create a "blockset" using the make.m command isn't there. I tried this in MATLAB and there is no such command. Another words the Toolbox can't be created in the Simulink Library Browser as stated in the linked page.

The only thing I found was what I already had and that's this page: https://github.com/Nuand/bladeRF/tree/m ... ngs/matlab which I've already built (mentioned above).

jom
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

I still can't find any information on creating the MATLAB Toolbox blockset in the Simulink Library Browser as stated in the link I gave in my last post. If no one knows where else could I find info?

Nonethless I've got the rx_gui working in MATLAB which is great.

I'm wondering, however, why there is always a tone dead center of the band I'm looking at. I saw this when I got SDR-Radio working last week and now I see it in the MATLAB gui. No matter where I put the RX input I get this -50 dB (dBm or dBFS?) spur right in the center of the FFT output. Why is that? Is the TX on and outputting a tone that is leaking into the RX or what?

Right now I also have a controlled synthesizer output going into the RX and it is clearly "beating" against this tone as I'm getting mixer spurs centered around it. Shown below. The Synth input is 1099.5MHz, 1100MHz is this odd tone and just above that is what I call a "mixer tone".

Image

If I turn off the Synth all that is left is the center tone...and like I said it stays there no matter what I make the RX center frequency.

Anyway, at least I got this working. Cool! It's also nice to be able to ask about something I'm at least familiar with...for once. :lol:

Thanks

jom
jynik
Posts: 455
Joined: Thu Jun 06, 2013 8:15 pm

Re: Questions from a beginner

Post by jynik »

That's not a tone or spur -- that's the result of integration gain over a DC offset. This is common with direct conversion receivers.

You can read more here:
https://github.com/Nuand/bladeRF/wiki/D ... n#overview

Note that playing with the DC offset I and Q values will allow you to manipulate this. Look at the "scope" XY view and you'll see the I and Q DC offset changing.
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

OK, thanks...I should have known that but I'm so used to Superhets I didn't catch that. I'll see if I can figure out how to play with the offsets to adjust.

Also, any thoughts on the MATLAB Toolbox blockset issue I asked about. I know you are busy but I don't know how to proceed with that.

Thanks again! :D

jom
jynik
Posts: 455
Joined: Thu Jun 06, 2013 8:15 pm

Re: Questions from a beginner

Post by jynik »

Hi jom,

I'm a little confused by what you're asking about the Simulink block set. Maybe things will become clearer to both of us with the following notes:

1. Simulink-MATLAB-bladeRF is deprecated, so you can ignore this project entirely. MATLAB and Simulink support was entirely re-written using the loadLibary() interface, and this supersedes this. Thus, there is no more make.m or anything pertaining to generating blocks.
2. Simulink support is now provided as MATLAB System Object, implemented in this file: https://github.com/Nuand/bladeRF/blob/m ... Simulink.m
2a. A System Object essentially exposes a Simulink block interface atop of some MATLAB code. The aforementioned file is just glue logic "hooking up" simulink to the bladeRF MATLAB interface.
3. The only thing to "build" now is the Thunk files -- this is a dynamic library wrapper around libbladeRF that exposes API functions to the MATLAB code.

Hopefully that makes a little more sense.
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

Thanks for the reply!
jynik wrote:Hi jom,
1. Simulink-MATLAB-bladeRF is deprecated, so you can ignore this project entirely. MATLAB and Simulink support was entirely re-written using the loadLibary() interface, and this supersedes this. Thus, there is no more make.m or anything pertaining to generating blocks.
I was trying to follow the guide here: https://libraries.io/github/Nuand/Simul ... AB-bladeRF I had assumed that it was "up to date". There were some broken links in the section "Build/Install instructions for Microsoft Windows". That's where my confusion came from.
2. Simulink support is now provided as MATLAB System Object, implemented in this file: https://github.com/Nuand/bladeRF/blob/m ... Simulink.m
2a. A System Object essentially exposes a Simulink block interface atop of some MATLAB code. The aforementioned file is just glue logic "hooking up" simulink to the bladeRF MATLAB interface.
I'll take a look at the file in MATLAB and see what I can figure out what you mean here.
3. The only thing to "build" now is the Thunk files -- this is a dynamic library wrapper around libbladeRF that exposes API functions to the MATLAB code.
I'm not sure what a Thunk file is but I'll see what I can find.

Thanks!

jom
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

I'm still having issues with my bladeRF device and that IQ issue. I must not understand what is going on here as well as I should.

First of all, I tried adjusting the IQ offset using the MATLAB gui interface and only got the tone down to -60dB or so. I don't know if I can do better nor do I know if that is enough to prevent the distortion I'm seeing. It's not my signal generator as I checked it out on my spectrum analyzer. I either don't know how to adjust this IQ issue properly, I've got another setting that is creating some other distortion internally (such as too much VGA gain), the bladeRF MATLAB gui can't do what I need to do to fix this or there is something wrong with the board I'm using.

This part of the forum may not be the proper place for this issue so I apologize in advance...

Again, thanks for all of the help. :D

jom
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: Questions from a beginner

Post by bpadalino »

-60dB worth of image rejection is pretty good. It's not great if you're doing SSB, but do you need more than 60dB of SNR to get your signal across?

I am not sure if you have an issue with DC offset or IQ imbalance, but try also looking at the time domain samples.

What exactly is the issue you are trying to solve and do you know how good is good enough?

Brian
jom
Posts: 23
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom »

To keep you from having to read the whole thread I'll explain: What I'm trying to do is simply input a tone (using my own synthesizer) and observe it using the MATLAB gui. I've noticed when I observe the spectrum results there is always a tone dead center of whatever band I'm looking at (in and around 1 GHz mostly). jynik explained it could be the IQ or DC offsets. Not knowing the radio completely I just used the IQ adjustments allowed in the gui to lower the tone. However, I still get these odd...what I'd call and what looks like, inter-modulation or an AM-like signal. See the spectrum picture I posted on the last page of this thread.

Thanks for the input! :)

jom
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: Questions from a beginner

Post by bpadalino »

Are you trying to use the device as a spectrum analyzer expecting spectrum analyzer like results?

I guess I go back to the original question - what are you trying to solve and how good is good enough? You answered the first part - you want the tones to go away. If you want the DC spike in the middle to go away, then remove the long term average mean from the input samples before you take the FFT. If you want the conjugate image to go away, then you will need to find the error in magnitude and phase between the in-phase and quadrature signals, compensate, and then send it into the FFT.

I hope this makes sense for you. Since it's all in MATLAB, and the MATLAB code is freely available, doing these two things before displaying the FFT is just an exercise in implementing that algorithm.

Good luck!
Post Reply