Questions from a beginner

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

Moderator: robert.ghilduta

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

Re: Questions from a beginner

Post by jom » Wed Aug 24, 2016 11:27 pm

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: 22
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom » Wed Aug 24, 2016 11:34 pm

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 » Thu Aug 25, 2016 10:37 am

-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: 22
Joined: Tue Jul 19, 2016 10:08 pm

Re: Questions from a beginner

Post by jom » Thu Aug 25, 2016 6:41 pm

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 » Fri Aug 26, 2016 6:08 am

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!

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

Re: Questions from a beginner

Post by jom » Fri Aug 26, 2016 10:36 am

bpadalino wrote:Are you trying to use the device as a spectrum analyzer expecting spectrum analyzer like results?
Yeah, actually (and possibly mistakenly) I did. However, the question "what is good enough?" wasn't really relevant to me. I just wanted to get some of the available software (in this case MATLAB) to work and see what I could do with it. The original intention of this thread was to find out about the software surround this device. I have a difficult time figuring that all out (I guess that's what they call it "abstraction"..heh) hence the thread.
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.
Can I then assume these settings are already in play as a default (ie the long term average)? If so, then I can then adjust them accordingly....I hope. That would make sense.
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.
I did use the offset adjustments in the gui but that did not work. Then again, I'm sure there are many more interface code functions I do NOT know about (such as the aforementioned long-term average) I can still use...I think. :)

The real test for me after this is do more with that Pothos software...which I've had trouble deciphering...although I need to spend more time with.

Thanks again!

jom

PS: I should probably point out my true goal here is to use this radio as part of my master's degree thesis which is in EE (communications).

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

Re: Questions from a beginner

Post by bpadalino » Sat Aug 27, 2016 6:20 am

There aren't any of the IQ corrections or long term DC averaging done in MATLAB. Feel free to modify the code. It should be super simple to follow - it isn't that difficult that all.

The corrections worked but they aren't perfect. Getting 60dB worth of image rejection for a direct downconversion receiver is usually plenty good enough. DSP can take out more if you really need it, but we don't implement anything like that.

While I know you said you aren't interested in what's good enough - you should be, especially as an MS student. Trying to attain perfection will get you nowhere. The IQ correction did exactly what it was supposed to with the precision it was allowed.

I guess my last piece of advice is to stop fretting over what you see in the PSD of the signal and worry about getting your information across your channel.

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

Re: Questions from a beginner

Post by jom » Sat Aug 27, 2016 1:52 pm

I guess I don't understand exactly what is going on. It seems to me if you put in an external tone at 1.01 GHz the FFT should show me a tone at 1.01 GHz not a bunch of side band distortion. I do have the habit of looking at radio receivers like I do spectrum analyzers however. It didn't behave like I thought and I don't know why this should be the case. I just felt that having so many tones at such a high level relative to my input was odd...at least in my experience.
While I know you said you aren't interested in what's good enough - you should be, especially as an MS student. Trying to attain perfection will get you nowhere.
Of course I'm interested in "good enough". I deal with it every day. I'm struggling (just like I thought I would) with the software interfaces which is not my strength (hence the thread). So for this simple set up I just wanted to see if I could get the radio to work (using MATLAB in this case) and have it respond like I think it should (which could be admittedly incorrect) with a simple tone going in. Of course, what I think it "should" based on my experience may not be correct.
There aren't any of the IQ corrections or long term DC averaging done in MATLAB.
If that is the case I'm not sure how I was able to make adjustments in the MATLAB gui. Maybe you are speaking of something else. :?:

There is a lot to learn for me and I apologize for the questions as it seems I might have ruffled some feathers here. I guess I'm frustrated as well but that's OK. Even MATLAB is giving me trouble with the "Thunk" files as it doesn't seem to be generating correctly...at least that is my perception (which, again, could be incorrect). I need to find more examples of what people are doing with this radio using the tools available. So far it's been rather sparse...

Thanks again! :)

jom

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

Re: Questions from a beginner

Post by bpadalino » Sun Aug 28, 2016 9:14 am

The software is just in the bladerf_fft M file. Specifically, for plotting the FFT, the relevant lines are here. It's pretty simple. If you can't figure out how to remove DC here, then I am not sure I can help you much at all without doing all the work for you.

Read up on direct conversion RF receivers and the effects of IQ imbalance, specifically magnitude and phase imbalances as well as the DC offset problem for direct conversion receivers.

These radios are not spectrum analyzers. Sometimes it may take intuition or extra troubleshooting to figure out what signal is there and what may be a spur, image or some other type of anomaly.

Good luck!

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

Re: Questions from a beginner

Post by jom » Mon Aug 29, 2016 11:38 am

bpadalino wrote:The software is just in the bladerf_fft M file. Specifically, for plotting the FFT, the relevant lines are here. It's pretty simple. If you can't figure out how to remove DC here, then I am not sure I can help you much at all without doing all the work for you.
Just to clarify I never once said I wanted anyone to "do all the work for me". :D

The task is a good one but it is not "pretty simple". Not for me. I've looked over the code you referred to and I can estimate that I can follow about 30% of it. I've had to look up many of the code snippets at the MATLAB help site. You just have to slog through it. Also, since it looked similar to "C" code and I found some vids on OOP and brushed up on "methods, properties" etc as best I could.
Read up on direct conversion RF receivers and the effects of IQ imbalance, specifically magnitude and phase imbalances as well as the DC offset problem for direct conversion receivers.
I'm in the process of doing just that. I appreciate the links and info on Github.
These radios are not spectrum analyzers
Actually I should have said that SA's are radios nothing but radios in a sense. SDRs can be used for such a thing but it is possible that given SA's are used as test equipment and have tough specifications a superhet type receiver might be a better choice than direct conversion in that case...but I digress.
Good luck!
Thanks...I'm gonna need it. :o

jom

Post Reply