Update format enum for libbladeRF 2.6.0 and fix bytes-per-sample - #1
Open
wormuz wants to merge 1 commit into
Open
Update format enum for libbladeRF 2.6.0 and fix bytes-per-sample#1wormuz wants to merge 1 commit into
wormuz wants to merge 1 commit into
Conversation
libbladeRF 2.6.0 inserted BLADERF_FORMAT_SC16_Q11_PACKED right after BLADERF_FORMAT_SC16_Q11, shifting every value after it. Since the .pxd declares the enum without explicit values, Cython numbers it positionally and PYBLADERF_FORMAT_SC16_Q11_META silently became 1 - which is now SC16_Q11_PACKED, a format without metadata. The failure is silent: bladerf_sync_config() accepts the value, sync_rx() returns samples, and only the metadata timestamps give it away by never advancing. Verified on a bladeRF 2.0 micro xA4 (FX3 2.6.0, FPGA 0.16.0): format 1 (PACKED) ac=32768, ts stuck at 133592988592904 format 2 (META) ac=32768, ts=[61, 32829, 65597], step exactly 32768 Also adds the missing BLADERF_IMAGE_TYPE_GAIN_CAL, and exposes SC16_Q11_PACKED and PACKET_META. Separately, bytes_per_sample treated every format except SC16_Q11 as 2 bytes, which is wrong for SC16_Q11_META: it carries 16-bit I and Q like SC16_Q11. Only the SC8_Q7 formats are 2 bytes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libbladeRF 2.6.0 inserted
BLADERF_FORMAT_SC16_Q11_PACKEDright afterBLADERF_FORMAT_SC16_Q11, shifting every value after it. Sincecbladerf.pxddeclares the enum without explicit values, Cython numbers it positionally, soPYBLADERF_FORMAT_SC16_Q11_METAsilently became1— which in 2.6.0 isSC16_Q11_PACKED, a format without metadata.The failure is silent:
bladerf_sync_config()accepts the value,sync_rx()returns samples, and only the metadata timestamps give it away by never advancing.Verified on a bladeRF 2.0 micro xA4 (FX3 2.6.0, FPGA 0.16.0), same device and request size:
Changes:
BLADERF_FORMAT_SC16_Q11_PACKEDto the enum so the values line up againPYBLADERF_FORMAT_SC16_Q11_PACKEDandPYBLADERF_FORMAT_PACKET_METABLADERF_IMAGE_TYPE_GAIN_CALbytes_per_sample: it treated every format exceptSC16_Q11as 2 bytes, butSC16_Q11_METAcarries 16-bit I and Q likeSC16_Q11. Only theSC8_Q7formats are 2 bytes.Note this makes the enum match 2.6.0; against 2.5.0 the values differ, since that is where the ABI changed.