Ok I got it, the issue is I had to change FDwfAnalogOutTriggerSourceSet to this:
dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(-1), trigsrcAnalogIn)
So the full code looks like:
#set up acquisition
dwf.FDwfAnalogInFrequencySet(hdwf, c_double(20000000.0))
dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(8192))
dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True))
dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5))
#set up trigger
dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(0)) # disable auto trigger
dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn) # one of the analog in channels
dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge)
dwf.FDwfAnalogInTriggerChannelSet(hdwf, c_int(0)) # first channel
dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(0.5)) # 0.5V
dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive)
print("Getting sine wave ready...")
# AWG 1 carrier
dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), c_int(0), c_bool(True))
dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), c_int(0), funcSine)
dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), c_int(0), c_double(freq_test[0]))
dwf.FDwfAnalogOutNodeOffsetSet(hdwf, c_int(0), c_int(0), c_double(0.0))
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), c_int(0), c_double(.09))
dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(-1), trigsrcAnalogIn)
# dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), 3)
dwf.FDwfAnalogInConfigure(hdwf, c_bool(False), c_bool(True))
dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True))
for iTrigger in range(len(freq_test)):
# reg_ack.write_reg(0x0, 0x1)
# new acquisition is started automatically after done state
while True:
dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts))
# print(sts.value == DwfStateArmed.value)
if sts.value == DwfStateDone.value:
print("Triggered")
freq_test_index += 1
time.sleep(3)
dwf.FDwfAnalogOutReset(hdwf)
time.sleep(1)
dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), c_int(0), c_bool(True))
dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), c_int(0), funcSine)
dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), c_int(0), c_double(freq_test[iTrigger]))
dwf.FDwfAnalogOutNodeOffsetSet(hdwf, c_int(0), c_int(0), c_double(0.0))
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), c_int(0), c_double(.09))
dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(-1), trigsrcAnalogIn)
dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True))
# dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), 3)
time.sleep(2)
break
Second part of the code shows to switch to the next frequency after the trigger. Change it to your liking.