BladeRF2: fixed Tx channel enable/disable wrapping routine thus fixing issue #225

This commit is contained in:
f4exb 2018-10-09 02:08:06 +02:00
parent f6b1fd252e
commit 6269125d2c
4 changed files with 14 additions and 17 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
sdrangel (4.2.1-1) unstable; urgency=medium
* FileRecord improvement with robust header and some fixes. Fixes issue #206
* BladeRF2 MO Tx fix so that the two channels are used effectively
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 14 Oct 2018 21:14:18 +0200
sdrangel (4.2.0-1) unstable; urgency=medium
* LibbladeRF 2.0 support with BladeRF Micro

View File

@ -184,7 +184,7 @@ bool DeviceBladeRF2::openTx(int channel)
if (!m_txOpen[channel])
{
status = bladerf_enable_module(m_dev, BLADERF_CHANNEL_TX(0), true);
status = bladerf_enable_module(m_dev, BLADERF_CHANNEL_TX(channel), true);
if (status < 0)
{

View File

@ -595,18 +595,16 @@ bool BladeRF2Output::handleMessage(const Message& message)
if (dev) // The BladeRF device must have been open to do so
{
int requestedChannel = m_deviceAPI->getItemIndex();
int nbChannels = getNbChannels();
if (report.getRxElseTx()) // Rx buddy change: check for sample rate change only
{
tmp_uint = report.getDevSampleRate();
settings.m_devSampleRate = tmp_uint / (nbChannels == 0 ? 1 : nbChannels);
settings.m_devSampleRate = report.getDevSampleRate();
// status = bladerf_get_sample_rate(dev, BLADERF_CHANNEL_TX(requestedChannel), &tmp_uint);
//
// if (status < 0) {
// qCritical("BladeRF2Output::handleMessage: MsgReportBuddyChange: bladerf_get_sample_rate error: %s", bladerf_strerror(status));
// } else {
// settings.m_devSampleRate = tmp_uint / (nbChannels == 0 ? 1 : nbChannels);
// settings.m_devSampleRate = tmp_uint;
// }
}
else // Tx buddy change: check for: frequency, gain mode and value, bias tee, sample rate, bandwidth
@ -732,7 +730,7 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
unsigned int actualSamplerate;
int status = bladerf_set_sample_rate(dev, BLADERF_CHANNEL_TX(requestedChannel),
settings.m_devSampleRate * (nbChannels == 0 ? 1 : nbChannels),
settings.m_devSampleRate,
&actualSamplerate);
if (status < 0)
@ -847,7 +845,7 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
settings.m_centerFrequency,
settings.m_LOppmTenths,
2,
settings.m_devSampleRate * (nbChannels == 0 ? 1 : nbChannels), // need to forward actual rate to the Rx side
settings.m_devSampleRate, // need to forward actual rate to the Rx side
false);
(*itSource)->getSampleSourceInputMessageQueue()->push(report);
}

View File

@ -8,18 +8,10 @@ This output sample sink plugin sends its samples to a [BladeRF2 device](https://
The plugin will be built only if the [BladeRF host library](https://github.com/Nuand/bladeRF) is installed in your system. If you build it from source and install it in a custom location say: `/opt/install/libbladeRF` you will have to add `-DLIBBLADERF_INCLUDE_DIR=/opt/install/libbladeRF/include -DLIBBLADERF_LIBRARIES=/opt/install/libbladeRF/lib/libbladeRF.so` to the cmake command line.
Note that the libbladeRF v2 (specifically the git tag 2018.08) is used.
Note that the libbladeRF v2 (specifically the git tag 2018.08) is used. The FPGA image v0.7.3 should be used accordingly. The FPGA .rbf file should be copied to the folder where the `sdrangel` binary resides. You can download FPGA images from [here](https://www.nuand.com/fpga_images/)
The BladeRF Host library is also provided by many Linux distributions (check its version) and is built in the SDRangel binary releases.
<h2>Multiple Output (MO) mode</h2>
If two device sets one for each Tx channel are opened then the SO/MO mode switch is governed by which channels are effectively streaming. As soon as the Tx2 (channel 1) is running then the MO mode is engaged.
The MO mode triggers the doubling of the sample rate and since the sample rate is common to the DAC and ADC it is also doubled for Rx channels. If some device sets for Rx channels are present then the sample rate in these device sets is automatically adjusted.
For example the channel 0 is started alone at a sample rate of 3 MS/s and a sibling Rx channel is also handled in another device set. Then the sample rate of this Rx channel is also 3 MS/s. If the second Tx channel is started then the sample rate is doubled to 6 MS/s for the Tx channels and also for the Rx channel. If the second Tx channel is stopped then a transistion from MO to SO (Single Output) occurs and the sample rate is returned to 3 MS/s for all Tx and Rx channels present.
<h2>Interface</h2>
![BladeRF2 output plugin GUI](../../../doc/img/BladeRF2Output_plugin.png)