Skip to content

Commit

Permalink
Correct issue of Q16 overflow for bladeRF
Browse files Browse the repository at this point in the history
  • Loading branch information
RGerzaguet committed Apr 12, 2024
1 parent e3ffd48 commit c6748b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AbstractSDRs"
uuid = "0bdde9fc-719a-4dc7-8589-49ca6634fa6b"
authors = ["Robin Gerzaguet <[email protected]>"]
version = "0.5.0"
version = "0.5.1"

[deps]
AdalmPluto = "af34ca7c-e544-47d5-a6fe-72495f08728e"
Expand Down
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ If you use `AbstractSDRs.jl` we encourage you to cite this work that you can fin

## Backends

AbstractSDRs wraps and implements different SDR backends that can be used when opening a radio device. The current list of supported SDR backends can be obtained via `getSupportedSDR`.
AbstractSDRs wraps and implements different SDR backends that can be used when opening a radio device. The current list of supported SDR backends can be obtained via `getSupportedSDRs`.
When instantiate a radio device (with `openSDR`), the first argument is the radio backend and parameters associated to a specific backend can be used with keywords.
Some specific functions can also be exported based in the selected backend. The list is given in the sub-backend part

Expand Down Expand Up @@ -114,3 +114,9 @@ This backend can be used with ADALM Pluto SDR device.
## Documentation

- [**STABLE**](https://juliatelecom.github.io/AbstractSDRs.jl/dev/index.html) &mdash; **documentation of the most recently tagged version.**



## Changelog

- 0.5.1 : Correct potential bug in data overflow for bladeRF backend
15 changes: 8 additions & 7 deletions src/Backends/BladeRF/BladeRFBindings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ function openBladeRF(carrierFreq,samplingRate,gain;agc_mode=0,packet_size=4096)
# --- Wrap all into a custom structure
# ----------------------------------------------------
# Instantiate a buffer to handle async receive. Size is arbritrary and will be modified afterwards
buffer = zeros(Int16,packet_size*2)
bladeRFRx = BladeRFRxWrapper(theChannelRx,buffer,ptr_metadata_rx)
bladeRFTx = BladeRFTxWrapper(theChannelTx,buffer,ptr_metadata_tx)
rx = BladeRFRx(
bufferTx = zeros(Int16,packet_size*2)
bufferRx = zeros(Int16,packet_size*2)
bladeRFRx = BladeRFRxWrapper(theChannelRx,bufferRx,ptr_metadata_rx)
bladeRFTx = BladeRFTxWrapper(theChannelTx,bufferTx,ptr_metadata_tx)
rx = BladeRFRx(
bladeRFRx,
effective_carrierFreq,
effective_sampling_rate,
Expand Down Expand Up @@ -232,7 +233,7 @@ function Base.print(rx::BladeRFRx);
end
function Base.print(tx::BladeRFTx);
strF = @sprintf("Carrier Frequency: %2.3f MHz\nSampling Frequency: %2.3f MHz\nRF Bandwidth: %2.3f MHz\nGain: %2.3f",tx.carrierFreq/1e6,tx.samplingRate/1e6,tx.rfBandwidth/1e6,tx.gain)
@infotx "Current BladeRF Radio Configuration in Rx mode\n$strF";
@infotx "Current BladeRF Radio Configuration in Tx mode\n$strF";
end
function Base.print(radio::BladeRFBinding)
print(radio.rx);
Expand Down Expand Up @@ -421,8 +422,8 @@ end
function _fill_tx_buffer!(internal_buffer,buffer,offset,nI)
vM = typemax(Int16)
@inbounds @simd for k 1 : nI
internal_buffer[2*(k-1)+1] = Int16(round(real(buffer[ offset + k] * vM)))
internal_buffer[2*(k-1)+2] = Int16(round(imag(buffer[ offset + k] * vM)))
internal_buffer[2*(k-1)+1] = Int16(round(real(buffer[ offset + k] * vM))) >> 4
internal_buffer[2*(k-1)+2] = Int16(round(imag(buffer[ offset + k] * vM))) >> 4
end
return nothing
end
Expand Down
2 changes: 1 addition & 1 deletion src/Scan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Scan interface and returns the founded SDR
sdr = scan()
sdr = scan(backend;key...)
# Input parameter
If the function is called without parameters il will search for all avaliable backends such as UHDBindings and AdalmPluto. Otherwise the search will be limited to the desired backend
If the function is called without parameters il will search for all available backends such as UHDBindings and AdalmPluto. Otherwise the search will be limited to the desired backend
The optionnal arguments are the one supported by UHDBindings and AdalmPluto. See `uhd_find_devices()` in UHDBindings and `scan` function in AdalmPluto
# Keywords
- args : String used in UHD backend to specify USRP IP address. Example: scan(:uhd;args="addr=192.168.10.16")
Expand Down

2 comments on commit c6748b5

@RGerzaguet
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/104758

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.1 -m "<description of version>" c6748b5b96b8d268b5dafaacb3a0eef3ab4a5a58
git push origin v0.5.1

Please sign in to comment.