libbladeRF: Fixed incorrect LMS LPF register configuration
Two issues existed in the LMS LPF configuration: (1) The LPF bypass was not being disabled when switching to BLADERF_LPF_DISABLED. Therefore, its state would be different depending on whether the previous state was BLADERF_LPF_BYPASSED or BLADERF_LPF_NORMAL. (2) BLADERF_LPF_BYPASSED was leaving the LPF powered on. According to the TX/RX LPF block diagram (Figure 3.5, in v1.1r4) in the LMS6002D programming guide, this implies that the LPF was enabled while its input was shorted to its output.
This commit is contained in:
parent
1b1a61bc88
commit
a5402b78d9
1 changed files with 19 additions and 8 deletions
|
|
@ -369,14 +369,25 @@ int lms_lpf_set_mode(struct bladerf *dev, bladerf_module mod,
|
|||
return status;
|
||||
}
|
||||
|
||||
if (mode == BLADERF_LPF_DISABLED) {
|
||||
data_l &= ~(1 << 1); /* Power down LPF */
|
||||
} else if (mode == BLADERF_LPF_BYPASSED) {
|
||||
data_l |= (1 << 1); /* Enable LPF */
|
||||
data_h |= (1 << 6); /* Enable LPF bypass */
|
||||
} else {
|
||||
data_l |= (1 << 1); /* Enable LPF */
|
||||
data_h &= ~(1 << 6); /* Disable LPF bypass */
|
||||
switch (mode) {
|
||||
case BLADERF_LPF_NORMAL:
|
||||
data_l |= (1 << 1); /* Enable LPF */
|
||||
data_h &= ~(1 << 6); /* Disable LPF bypass */
|
||||
break;
|
||||
|
||||
case BLADERF_LPF_BYPASSED:
|
||||
data_l &= ~(1 << 1); /* Power down LPF */
|
||||
data_h |= (1 << 6); /* Enable LPF bypass */
|
||||
break;
|
||||
|
||||
case BLADERF_LPF_DISABLED:
|
||||
data_l &= ~(1 << 1); /* Power down LPF */
|
||||
data_h &= ~(1 << 6); /* Disable LPF bypass */
|
||||
break;
|
||||
|
||||
default:
|
||||
log_debug("Invalid LPF mode: %d\n", mode);
|
||||
return BLADERF_ERR_INVAL;
|
||||
}
|
||||
|
||||
status = bladerf_lms_write(dev, reg, data_l);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue