Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fpga/usrp3: Fix DC truncation bias for B2xx by adding rounding to DDC chain #703

Closed

Conversation

ryanvolz
Copy link
Contributor

Pull Request Details

Description

Currently, the non-RFNOC usrp3 (i.e. B2xx) DDC code truncates to 18 bits from 24 bits after applying the halfband filters and before applying a scaling and final rounding. This truncation introduces a DC bias that is noticeable with small signal levels (or lots of integration), especially with high decimation rates. Changing the truncation to a rounding removes the DC bias.

This is essentially a forward port of a similar prior fix to the usrp2 DDC chain: EttusResearch/fpga#4. (Note: In order to not repeat the mistake of finding a similar issue in another part of the codebase ~8 years later =P, I checked the RFNOC usrp3's DDC to see what it does. Thankfully, it doesn't have this problem since it uses a wider multiplier and thus avoids the truncation.)

Related Issue

Which devices/areas does this affect?

USRP3-based non-RFNOC devices, i.e. B2xx and B2xxmini

Testing Done

I tested this with a B200mini using GNU Radio. Without the radio connected to anything, I tuned with an LO offset of 1 MHz, gain of 0, and high decimation factor (master clock of 40e6, sample rate of 200e3). Using the stock fpga, a DC bias is present:
b200mini_fpga_stock

Using this modification, the DC bias is gone:
b200mini_fpga_with_rounding

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project. See CODING.md.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes, and all previous tests pass.
  • I have checked all compat numbers if they need updating (FPGA compat,
    MPM compat, noc_shell, specific RFNoC block, ...)

@github-actions
Copy link

github-actions bot commented Sep 25, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ryanvolz
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@ryanvolz
Copy link
Contributor Author

recheck

A digital DC bias caused by various truncations in the DDC chain was
previously noticable with small signal levels, especially with high
decimation rates. This patch eliminates the bias by replacing the
truncation with rounding or simply keeping more bits for longer where it
makes sense.

This is essentially a forward port of a similar prior fix to the usrp2
DDC chain: EttusResearch/fpga#4.

Signed-off-by: Ryan Volz <[email protected]>
@ryanvolz ryanvolz force-pushed the fix_dc_truncation_bias_usrp3 branch from 7b7d5d8 to cc5d673 Compare September 25, 2023 20:37
@mbr0wn
Copy link
Contributor

mbr0wn commented Dec 11, 2023

@ryanvolz FYI we're reviewing this internally. I think this change is OK.

@mbr0wn
Copy link
Contributor

mbr0wn commented Dec 11, 2023

(Note: In order to not repeat the mistake of finding a similar issue in another part of the codebase ~8 years later =P, I checked the RFNOC usrp3's DDC to see what it does. Thankfully, it doesn't have this problem since it uses a wider multiplier and thus avoids the truncation.)

Oh, and we very much appreciate this ^^^ 👍

@joergho joergho closed this Jun 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants