Modify the RXVGA2 calibration routines to enable test mode signals

This commit is contained in:
Brian Padalino 2014-03-15 23:50:21 -04:00 • committed by Jon Szymaniak
commit f5fb4617ef
2 changed files with 53 additions and 5 deletions

View file

@ -1935,6 +1935,55 @@ int lms_calibrate_dc(struct bladerf *dev, bladerf_cal_module module)
if (status != 0) {
return status;
}
/* Special decoding addressing case for RXVGA2 */
if (module == BLADERF_DC_CAL_RXVGA2) {
switch (i) {
case 0:
/* Set to direct control signals: RXVGA2 Decode = 1 */
status = bladerf_lms_read(dev, 0x64, &val);
if (status != 0) {
return status;
}
val |= 1;
status = bladerf_lms_write(dev, 0x64, val);
if (status != 0) {
return status;
}
/* VGA2GAINA = 0110, VGA2GAINB = 0 */
val = 6;
status = bladerf_lms_write(dev, 0x68, val);
if (status != 0) {
return status;
}
case 2:
/* VGA2GAINA = 0, VGA2GAINB = 0110 */
val = 6 << 4;
status = bladerf_lms_write(dev, 0x68, val);
if (status != 0) {
return status;
}
case 4:
/* Set to decode control signals: RXVGA2 Decode = 0 */
status = bladerf_lms_read(dev, 0x64, &val);
if (status != 0) {
return status;
}
val &= (~1);
status = bladerf_lms_write(dev, 0x64, val);
if (status != 0) {
return status;
}
break;
}
}
}
/* Special case for LPF tuning module where results are

View file

@ -46,7 +46,7 @@ int cmd_calibrate(struct cli_state *state, int argc, char **argv)
}
if (argc == 1) {
if (argc == 1) {
/* Ensure both TX and RX are enabled */
status = bladerf_enable_module(state->dev, BLADERF_MODULE_TX, true);
@ -103,10 +103,9 @@ int cmd_calibrate(struct cli_state *state, int argc, char **argv)
return CLI_RET_INVPARAM;
}
if (status != 0) {
/* Calibrate it */
status = bladerf_calibrate_dc(state->dev, module);
}
/* Calibrate it */
status = bladerf_calibrate_dc(state->dev, module);
} else {
return CLI_RET_INVPARAM;
}