-
Notifications
You must be signed in to change notification settings - Fork 464
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
python tx and rx with metadata and get_timestamp #932
base: master
Are you sure you want to change the base?
Conversation
Hey there! I am trying to get the metadata out using python example bu unable to fetch the meta. the execution stops at _check_error. bladerf._bladerf.InvalError: Invalid operation or parameter. Any leads on this will be highly appreciable. |
Hello! According to the API definition, one must send a meta object when requesting a rx with meta. That is in your line 144:
Can you try:
I don't have a bladeRF available right now, let me know if it fixes the issue. |
Hi! Thanks for the response! Yes, the above solution worked well.
Got this as response : Metadata(timestamp=3, flags=2147483648, status=196608, actual_count=1024) Could you please help me with how to interpret the timestamps in order to verify no-loss? I am trying to achieve time-stamping for each chunk of samples. Was expecting actual timestamps. Thanks! :) |
The timestamp is a counter that increases at sample rate, and it's linked to the first sample of the buffer (note that enabling a channel resets the timestamp). If there's is no overrun flag in the status field that means that the chunk was send without drops, and if the timestamp is continuous (adding the number of samples) that means there was no gap between chunks. You can probably verify this using the loopback mode or another receiver. I encourage you to read the documentation since this questions are answered much clearer than I can. |
Got it! I very much appreciate your help :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
I wanted to use the transmission and reception with metadata using the Python bindings and, while it was possible, it required to manually interact with the cffi and remember all the fields and flags. Also, the
bladerf_get_timestamp
function was missing.Hence, I created an IntEnum to organize the Metadata Flags and a class for the Metadata object that follows the style of similar classes declared on the bindings.
For the
sync_tx
andsync_rx
, it makes sense to be able to directly send a Metadata object instead of having to call object.struct on the method call. However, to make it backwards compatible, I have to check for the type. Also, thesync_rx
has to return the Metadata object. If this approach is not correct and you prefer to maintain the previous approach or ditch the legacy version, let me know and I'll update the PR.I've tested the functionality by implementing the C examples for TX with metadata and RX with metadata listed in the API documentation. The functionality is not exactly the same because the calls are blocking, so for example to test the TX metadata flags I had to launch multiple threads; but that is expected.
Thanks!