Questions from a beginner

Discussions related to embedded firmware, driver, and user mode application software development

Moderator: robert.ghilduta

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

Re: Questions from a beginner

Post by jom » Wed Aug 03, 2016 10:55 am

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 » Mon Aug 08, 2016 1:37 pm

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 » Sat Aug 13, 2016 6:56 pm

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 » Sun Aug 14, 2016 10:02 am

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 » Sun Aug 14, 2016 6:42 pm

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 » Tue Aug 16, 2016 11:57 am

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 » Fri Aug 19, 2016 6:50 pm

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 » Mon Aug 22, 2016 12:51 pm

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 » Mon Aug 22, 2016 10:18 pm

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 » Wed Aug 24, 2016 10:13 am

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.

Post Reply