Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different frequency in MIMO channel #3

Open
mayzff opened this issue Jun 5, 2022 · 21 comments
Open

Different frequency in MIMO channel #3

mayzff opened this issue Jun 5, 2022 · 21 comments

Comments

@mayzff
Copy link

mayzff commented Jun 5, 2022

Hi, the layout only support same frequency at two channel. I want to set different frequency at two TX/RX channel, do you have any idea about it?

@JoseAmador95
Copy link
Owner

Hi! Unfortunately, I think having different frequencies at all four channels is not possible. Each set of channels (Tx and Rx) use a oscillator to set the frequency. There are only two of these in the bladerf, you would need one per channel.

The only think that comes to my mind is to have a second BladeRF (in slave mode). This way, when the master bladeRf starts txing or rxing at frequency X, the slave board can do the same at frequency Y.

Please let me know if you have any other questions. I'll try to help as much as I can.

@mayzff
Copy link
Author

mayzff commented Jun 6, 2022

Thanks for your reply. I have two bladeRF, one is TX (master) and the other is RX(slave). I want to use them to build a 2x2 MIMO and each stream has a different frequency. Thus, I should set two frequencies at TX, is that possible to set it and do you know how to do it?

@JoseAmador95
Copy link
Owner

Would you please describe your goal in more detail? What I understood from your comment is that you aim to create a 2x2 end-to-end system with two boards, and you want to set each board to a particular frequency for each RF path to use. Something like this:

BladeRF1->TX1 & TX2 -> freq1 -------> BladeRF2 -> RX1 & RX2 -> freq1
BladeRF2->TX1 & TX2 -> freq2 -------> BladeRF1 -> RX1 & RX2 -> freq2

Although this is possible and might be a good setup for testing Channel Coding (e.g., Alamouti Codes), it is not necessary to achieve a MIMO system. A single board can be a 2x2 MIMO system, as MIMO encloses many techniques that consider a single carrier frequency in all the RF chains (e.g., Beamforming, as in the project that inspired the contents of this repository).

If you already have two boards, you can try to synchronise them to achieve a 4x4 MIMO system. I have tried to adapt my custom MATLAB objects to support this feature, but with little success (although I may have some ideas).

Hopefully, I got it right, and I did not tell you all of these in vain hehe. Still, I'm open to helping with any layout you propose.

@mayzff
Copy link
Author

mayzff commented Jun 7, 2022

Sure, My goal is to deploy one bladerf on the transmitter side and another bladef on the receiver side, which could be composed as a 2x2 MIMO.The two channels on the transmitter side have different frequencies,like

BladeRF1- TX1-freq1 -------> BladeRF2 -> RX1 -> freq1
Meanwhile
BladeRF1- TX2-freq2-------> BladeRF2 -> RX2 -> freq2

I know it looks weird (TX1 and TX2 are generally the same), but It would be very interesting and challenge to implement it,right?

@JoseAmador95
Copy link
Owner

If you are convinced about this layout, we can try the following.

We cannot set BladeRF1.TX1 and BladeRF1.TX2 to different frequencies, as they share an oscillator. But, we may try to offset the signals of each TX channel with modulation in base-band (with wide bandwidth). For example:

$$ S_{tx} = (S_{1} \cos{(\pm f_{bb}t)}) \cos{(f_{osc}t)} $$

where $S_{1} \cos{(\pm f_{bb}t)}$ is computed within MATLAB, the TX frequency in the board is $f_{osc}$, and $f_{bb}$ is lower than half the max bandwidth of the SDR and the bandwidth of the transmitted signal.

$$ f_{bb} < \frac{BW_{max}}{2} + \frac{BW_{S}}{2} $$

This way, we can create two signals with an offset from the carrier frequency. Then, we can use the RX channels with a very narrow bandwidth to receive each signal.

The layout would be like this:

  • BladeRF1.TX1.$f_1$ sends a signal with an offset of $+f_{bb}$.
  • BladeRF1.TX2.$f_1$ sends a signal with an offset of $-f_{bb}$.
  • BladeRF1.RX.$f_1 + f_{bb}$ receives signal from TX1.
  • BladeRF2.RX.$f_1 - f_{bb}$ receives signal from TX2.

I hope this makes any sense.

@mayzff
Copy link
Author

mayzff commented Jun 8, 2022

Thanks, it seems to be feasible. If I don't misunderstand, I don't need to change your BladeRF MIMO layout.

In the transmitter, I just apply offset to two channels after baseband modulation, then send to BladeRF 1(master mode).

In the receiver, when BladeRF 2(slave mode) receives two signals from BladeRF1, using narrow-band demodulation to recover the original signals with two different frequencies.

I'll try it out and let you know if there's possible or not.

@JoseAmador95
Copy link
Owner

The bladerf_mimo block in my repository cannot synchronise the stream from multiple boards. For applications that require coherent channels, you will need to modify the startup routine of the boards so that it follows the same procedure (here)[https://github.com/Nuand/bladeRF/tree/master/host/examples/bladeRF-cli/sync_trx]. I've found that Matlab is not very friendly with the implementation, as it requires two C executables and the pooling toolbox adds a 5 second overhead which is unacceptable for the stream.

I considered using Python's threads to improve this, but I do not have access to the hardware a the moment.

@mayzff
Copy link
Author

mayzff commented Jun 9, 2022

Thanks for your advices. In this case, Matlab is not suitable as Bladerf implementation and I need to use other SDR softwares to build it such as GNURadio.

However, I’m new in SDR and GNURadio is not very friendly to novices, is that possible to execute the Python’s threads in Matlab?

@JoseAmador95
Copy link
Owner

I'm confident enough to recommend starting with a quick script in python for you to familiarise yourself, and then tackle the binding of the Python symbols to MATLAB. As far as I remember, the python implementation for the bladeRF is a wrapper that binds the C API. Ideally, you should be able to pass the bladeRF device handler from MATLAB to Python fairly simple. Let me know if there is anything else I can help you with.

@mayzff
Copy link
Author

mayzff commented Jun 10, 2022

Thanks for your suggestion, I will first familiarize myself with the python implementation of sdr. As far as I know, matlab can be used as a tool for reading and writing binary data. I can test the algorithms on Matlab firstly and then implement it on GNUradio.

@JoseAmador95
Copy link
Owner

Hi @mayzff. Do you need assistance? Did you manage some progress? Just asking to know whether I can close this issue. If you ever achieve something worth sharing (i.e., a working example, docs, an scalable way to use 2+ devices) please do not hesitate to raise a Pull Request.

@mayzff
Copy link
Author

mayzff commented Jun 29, 2022

Hi, I think MALTAB can implement concurrent dual-band MIMO, the layout is like 2x2x2MIMO, which means all channels of the board should be enabled. It can be
BladeRF1- >channel1->TX1-freq1 -------> BladeRF2 -> RX1 ->channel 3 -> freq1
BladeRF1- >channel2->TX1-freq1 -------> BladeRF2 -> RX1 ->channel 4 -> freq1
BladeRF2- >channel1->TX2-freq2------->BladeRF1->->channel 3->RX2->freq2
BladeRF2- >channel2->TX2-freq2------->BladeRF1->->channel 4->RX2->freq2
I'm still working on it, do you have any advice? if not, the issue can be closed.

@JoseAmador95
Copy link
Owner

Can you provide more detail about how MATLAB can help? I am also a bit confused about the 2x2x2 layout.

@mayzff
Copy link
Author

mayzff commented Jun 30, 2022

Because BladeRF cannot set different frequencies for two TXs, I can set two TX channels with frequency 1 on board 1 and two TX channels with frequency 2 on board 2. Two RX channels can receive frequency 1 on board 1 and receive frequency 2 on board 2. It makes up two 2x2 MIMO, namely 2x2x2 MIMO.
As for MATLAB, I think your BladeRF MIMO layout is feasible for four-channel enabled. Then, writing a receiving and transmitting program for the physical layer. As for the synchronization, setting the timestamp can solve it. See https://nuand.com/libbladeRF-doc/v2.2.1/sync_rx_meta.html

@mayzff
Copy link
Author

mayzff commented Aug 24, 2022

Hi, @JoseAmador95 ,every time I use your BladeRF MIMO layout, the program crashes at 0% or 6% and the program cannot be terminated.
I tried changing tx_gain, rx_gain, SDR.stream.n_buffers, SDR.stream.n_transfers, SDR.stream.buffer_size, and SDR.stream.timeout but nothing improved.
When I execute BladeRF SISO layout(from MATLAB package) with the same configuration, it works fine.
I wonder whether you faced similar question or do you know the reason? My device is BladeRF 2.0 xA9.

@JoseAmador95
Copy link
Owner

Which version of the BladeRF package are you using? I've found that anything older than 2019 may cause issues.

@mayzff
Copy link
Author

mayzff commented Aug 26, 2022

My version is 2021 and I also change my version to 2019, it still doesn't work. But it can work in another PC.

@JoseAmador95
Copy link
Owner

Just to be clear, I'm not referring to the MATLAB version. BladeRf release 2021 is incompatible, you may download version 2019.07 from their website. The important part is to download the 2019.07 firmware to the board.

@mayzff
Copy link
Author

mayzff commented Aug 26, 2022

Thanks, it works now. And it's also better to run in MATLAB2019, the new version(like 2021) might time out.

@JoseAmador95
Copy link
Owner

Excellent! Just out of curiosity, how does the timeout manifest in MATLAB 2021?

Btw, I'll leave this issue opened if you need further assistance. 😁

@mayzff
Copy link
Author

mayzff commented Aug 26, 2022

It always occurs libbladerf error (-6) in bladerf_sync_rx(): operation timed out, but if you try several times or reboot MATLAB, it might solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants