Skip to content

Commit

Permalink
first version of hbridge
Browse files Browse the repository at this point in the history
  • Loading branch information
tknopp committed Dec 6, 2024
1 parent f1130c4 commit d5e364e
Show file tree
Hide file tree
Showing 7 changed files with 817 additions and 86 deletions.
40 changes: 40 additions & 0 deletions src/client/julia/src/SlowIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,43 @@ end
scpiCommand(::typeof(DIO), pin) = string("RP:DIO:", DIOPinToCommand(pin), "?")
scpiReturn(::typeof(DIO)) = String
parseReturn(::typeof(DIO), ret) = occursin("ON", ret)






export DIOHBridge!
"""
DIOHBridge!(rp::RedPitaya, pin::DIOPins, val::Bool)
Set the value of DIOHBridge pin `pin` to the value `val`.
# Example
```julia
julia> DIOHBridge!(rp, DIO7_P, true)
true
```
"""
function DIOHBridge!(rp::RedPitaya, pin, val)
return query(rp, scpiCommand(DIOHBridge!, pin, val), scpiReturn(DIOHBridge!))
end
scpiCommand(::typeof(DIOHBridge!), pin::DIOPins, val::Bool) = string("RP:DIO:", DIOPinToCommand(pin), ":HBRIDGE ", (val ? "ON" : "OFF"))
scpiReturn(::typeof(DIOHBridge!)) = Bool

export DIOHBridge
"""
DIOHBridge(rp::RedPitaya, pin::DIOPins)
Get the value of DIOHBridge pin `pin`.
# Example
```julia
julia>DIOHBridge(rp, DIO7_P)
true
```
"""
function DIOHBridge(rp::RedPitaya, pin)
return parseReturn(DIOHBridge, query(rp, scpiCommand(DIOHBridge, pin), scpiReturn(DIOHBridge)))
end
scpiCommand(::typeof(DIOHBridge), pin) = string("RP:DIO:", DIOPinToCommand(pin), ":HBRIDGE?")
scpiReturn(::typeof(DIOHBridge)) = String
parseReturn(::typeof(DIOHBridge), ret) = occursin("ON", ret)
2 changes: 2 additions & 0 deletions src/examples/julia/config.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# URLs= ["rp-f08ccb.local", "rp-f08caa.local"]
URLs= ["192.168.2.22"]#, "192.168.2.17"]
URLs= ["192.168.178.65"]#, "192.168.178.95"]

mkpath("images")
17 changes: 9 additions & 8 deletions src/examples/julia/sequenceIssue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ serverMode!(rp, CONFIGURATION)
dec = 128
base_frequency = 125000000

samples_per_step = 40 #30*16
samples_per_step = 4000 #30*16
steps_per_frame = 4
numSamples = steps_per_frame * samples_per_step

Expand All @@ -21,9 +21,10 @@ periodsPerFrame!(rp, numSamples)
samplesPerStep!(rp, samples_per_step)
triggerMode!(rp, INTERNAL)


amplitudeDAC!(rp, 1, 1, 0.0)
amplitudeDAC!(rp, 2, 1, 0.0 )
frequencyDAC!(rp, 1, 1, base_frequency/samples_per_step/dec)
frequencyDAC!(rp, 2, 1, base_frequency/samples_per_step/dec)
amplitudeDAC!(rp, 1, 1, 0.2)
amplitudeDAC!(rp, 2, 1, 0.2 )

clearSequence!(rp)

Expand All @@ -40,21 +41,21 @@ lutEnableDACA = ones(Bool, steps_per_frame)
enableLUT = collect( cat(lutEnableDACA,lutEnableDACA,lutEnableDACA,lutEnableDACA,lutEnableDACA,lutEnableDACA,dims=2)' )
#enableLUT = collect( cat(lutEnableDACA,dims=2)') #,lutEnableDACA,lutEnableDACA,lutEnableDACA,lutEnableDACA,dims=2)' )

seq = SimpleSequence(lut, 300, enableLUT)
seq = SimpleSequence(lut, 2, enableLUT)
sequence!(rp, seq)

serverMode!(rp, ACQUISITION)
masterTrigger!(rp, true)

uCurrentPeriod = readFrames(rp, 1, 3)
uCurrentPeriod = readFrames(rp, 1, 200)

masterTrigger!(rp, false)
serverMode!(rp, CONFIGURATION)

plot = lines(vec(uCurrentPeriod[:,1,:,1]), label = "Rx1")
lines!(plot.axis, vec(uCurrentPeriod[:,2,:,1]), label = "Rx2")
lines!(plot.axis, vec(uCurrentPeriod[:,1,:,2]), label = "Rx1_2")
lines!(plot.axis, vec(uCurrentPeriod[:,2,:,2]), label = "Rx2_2")
#lines!(plot.axis, vec(uCurrentPeriod[:,1,:,2]), label = "Rx1_2")
#lines!(plot.axis, vec(uCurrentPeriod[:,2,:,2]), label = "Rx2_2")
axislegend(plot.axis)
save(joinpath(@__DIR__(), "images", "sequenceIssue.png"), plot)
plot
404 changes: 326 additions & 78 deletions src/fpga/bd/bd.tcl

Large diffs are not rendered by default.

Loading

0 comments on commit d5e364e

Please sign in to comment.