Skip to content

Commit 59688a7

Browse files
committed
Updated -s option to support lower than 2 MHz sample rates
1 parent 8506e60 commit 59688a7

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

rsp_tcp.c

+26-2
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ static void *command_worker(void *arg)
13761376

13771377
int init_rsp_device(unsigned int sr, unsigned int freq, int enable_bias_t, unsigned int notch, int enable_refout, int antenna)
13781378
{
1379-
int r;
1379+
int r, dec;
13801380
uint8_t ifgain, lnastate;
13811381

13821382
// initialise frequency state
@@ -1388,14 +1388,38 @@ int init_rsp_device(unsigned int sr, unsigned int freq, int enable_bias_t, unsig
13881388
gain_reduction = ifgain;
13891389
lna_state = lnastate;
13901390
}
1391-
1391+
1392+
if (sr < 300e3) { bwType = mir_sdr_BW_0_200; }
1393+
else if (sr < 600e3) { bwType = mir_sdr_BW_0_300; }
1394+
else if (sr < 1536e3) { bwType = mir_sdr_BW_0_600; }
1395+
else if (sr < 5e6) { bwType = mir_sdr_BW_1_536; }
1396+
else if (sr < 6e6) { bwType = mir_sdr_BW_5_000; }
1397+
else if (sr < 7e6) { bwType = mir_sdr_BW_6_000; }
1398+
else if (sr < 8e6) { bwType = mir_sdr_BW_7_000; }
1399+
else { bwType = mir_sdr_BW_8_000; }
1400+
1401+
dec = 1;
1402+
if (sr < 2e6)
1403+
{
1404+
while (sr < 2e6)
1405+
{
1406+
sr = sr * 2;
1407+
dec = dec * 2;
1408+
}
1409+
}
1410+
13921411
r = mir_sdr_StreamInit(&gain_reduction, (sr / 1e6), (freq / 1e6), bwType, mir_sdr_IF_Zero,
13931412
lna_state, &infoOverallGr, mir_sdr_USE_RSP_SET_GR,
13941413
&samples_per_packet, rx_callback, gc_callback, (void *)NULL);
13951414
if (r != mir_sdr_Success) {
13961415
fprintf(stderr, "failed to start the RSP device, return (%d)\n", r);
13971416
return -1;
13981417
}
1418+
1419+
if (dec > 1)
1420+
{
1421+
mir_sdr_DecimateControl(1, dec, 1);
1422+
}
13991423

14001424
printf("started rx\n");
14011425

0 commit comments

Comments
 (0)