Skip to content

Commit

Permalink
fix bladerf error
Browse files Browse the repository at this point in the history
fix "An unexpected error occurred" errors
  • Loading branch information
tjmullicani authored and wiedehopf committed Nov 17, 2023
1 parent b61bbeb commit 21634f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sdr_ubladerf.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ bool ubladeRFOpen() {
goto error;
}

// Close and re-open the bladeRF, otherwise we get "An unexpected error occurred" in later calls.
bladerf_close(uBladeRF.device);
if ((status = bladerf_open(&uBladeRF.device, Modes.dev_name)) < 0) {
fprintf(stderr, "Failed to open bladeRF: %s\n", bladerf_strerror(status));
goto error;
}

if ((status = bladerf_set_sample_rate(uBladeRF.device, BLADERF_MODULE_RX, Modes.sample_rate * uBladeRF.decimation, NULL)) < 0) {
fprintf(stderr, "bladerf_set_sample_rate failed: %s\n", bladerf_strerror(status));
goto error;
Expand Down

0 comments on commit 21634f5

Please sign in to comment.