Issue Runnung CellSearch bladeRF
AbilityDev opened this issue · 5 comments
Hi all,
I've managed to build the LTE-Cell-Scanner with BladeRF but every time i scan for cells i have the following error:
@ubuntu:~/LTE-Cell-Scanner/build$ CellSearch -g 30 --freq-start 1.7e6 --freq-end 1.9e6
LTE CellSearch (release) beginning. 1.0 to 1.1.0: OpenCL/TDD/HACKRF/bladeRF/ext-LNB added
PPM: 0
correction: 1
init_board: 1 bladeRF devices found! The 1st one will be used:
Backend: libusb
Serial: 94030c65f2474294ac4cf239f135f063
USB Bus: 3
USB Address: 8
config_bladerf bladerf_get_lna_gain: Failed to get lna gain: Operation not supported
BLADERF device not FOUND!
i disabled the AGC when running the command with "-g 30" and still get an lna_gain error.
Please Help.
Thanks.
I had the same issue, it is because the BladeRF2.0 micro does not have support for get_lna_gain, or because they changed it in libbladerf 2.0 library to other functions. By patching the program it runs:
diff --git a/src/CellSearch.cpp b/src/CellSearch.cpp
index 8df062b..0f33fc0 100644
--- a/src/CellSearch.cpp
+++ b/src/CellSearch.cpp
@@ -817,7 +817,7 @@ int config_bladerf(
if (dev!=NULL) {bladerf_close(dev); dev = NULL; return(-1);}
}
- bladerf_lna_gain actual_lna_gain;
+ /*bladerf_lna_gain actual_lna_gain;
status = bladerf_get_lna_gain(dev, &actual_lna_gain);
if (status != 0) {
printf("config_bladerf bladerf_get_lna_gain: Failed to get lna gain: %s\n",
@@ -835,9 +835,19 @@ int config_bladerf(
lna_gain_str = (char *)"BLADERF_LNA_GAIN_UNKNOWN";
} else {
lna_gain_str = (char *)"INVALID_BLADERF_LNA_GAIN";
+ }*/
+
+ bladerf_gain_mode mode;
+ mode = BLADERF_GAIN_AUTOMATIC;
+ bladerf_channel channel = BLADERF_CHANNEL_RX(0);
+ status = bladerf_set_gain_mode(dev, channel, mode);
+ if (status < 0) {
+ printf("config_bladerf bladerf_set_gain: Failed to set bladerf gain automatic: %s\n",
+ bladerf_strerror(status));
}
- int actual_vga1_gain;
+
+ /*int actual_vga1_gain;
status = bladerf_get_rxvga1(dev, &actual_vga1_gain);
if (status != 0) {
printf("config_bladerf bladerf_get_rxvga1: Failed to get rxvga1 gain: %s\n",
@@ -851,9 +861,9 @@ int config_bladerf(
printf("config_bladerf bladerf_get_rxvga2: Failed to get rxvga2 gain: %s\n",
bladerf_strerror(status));
if (dev!=NULL) {bladerf_close(dev); dev = NULL; return(-1);}
- }
+ }*/
- int actual_total_vga_gain = actual_vga1_gain + actual_vga2_gain;
+ //int actual_total_vga_gain = actual_vga1_gain + actual_vga2_gain;
status = bladerf_set_frequency(dev, BLADERF_MODULE_RX, (unsigned int)fc);
if (status != 0) {
@@ -862,7 +872,7 @@ int config_bladerf(
if (dev!=NULL) {bladerf_close(dev); dev = NULL; return(-1);}
}
- unsigned int actual_frequency;
+ long unsigned int actual_frequency;
status = bladerf_get_frequency(dev, BLADERF_MODULE_RX, &actual_frequency);
if (status != 0) {
printf("config_bladerf bladerf_get_frequency: Failed to read back frequency: %s\n",
@@ -888,7 +898,7 @@ int config_bladerf(
hackrf_device *fake_hackrf_dev = NULL;
capture_data(fc, 1, false, " ", false, " ", " ",fake_rtlsdr_dev,fake_hackrf_dev,dev,dev_type_t::BLADERF, capbuf, fc_programmed, fs_programmed,0);
- printf("config_bladerf: set bladeRF to %fMHz %fMsps BW %fMHz %s VGA_GAIN %ddB (%d+%d).\n", (float)actual_frequency/1000000.0f, (float)actual_sample_rate/1000000.0f, (float)actual_bw/1000000.0f, lna_gain_str, actual_total_vga_gain, actual_vga1_gain, actual_vga2_gain);
+ printf("config_bladerf: set bladeRF to %fMHz %fMsps BW %fMHz VGA_GAIN automatic.\n", (float)actual_frequency/1000000.0f, (float)actual_sample_rate/1000000.0f, (float)actual_bw/1000000.0f);
return(status);
}
#endif
save the contents to a file and run 'patch < filename' where you replace filename with the name of the file you saved the contents above to.
Thanks @sab24
The same has to be changed in LTE-Tracker.cpp also i believe
I'm working on the BladeRF 2.0 microxA4 and I'm trying to use the CellSearch and LTE Tracker function. It appears that when I use the contents in that file that Hunks 1-3 and 5 work, but Hunk #4 fails for both CellSearch.cpp and LTETracker.cpp. Is there anything that I need to add to the contents of the file to make it work with my BladeRF? @sab24
I don’t have a Linux or MacOS computer right now to run this. I think the source of this repo has changed. You can checkout a previous commit in line with the date of my previous message to see if you can get that hunk working.
I was able to the fix my issue. The Hunk said that it failed, but it added the line long unsigned int frequency
for Hunk 4. I was able to edit the C++ code manually too to see if it would work. I realized that I should probably remake the LTE Tracker and CellSearch and that worked to get it running on my bladeRF.